aboutsummaryrefslogtreecommitdiffstats
path: root/macros/mozilla.m4
blob: 4d753be8e24caa4c75237922b6c191f6f1027404 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
dnl - Determine where and which version of mozilla is installed on the system
dnl - Author: Andrew Chatham

AC_DEFUN([AC_CHECK_MOZILLA],[
    has_mozilla=false

    CFLAGS=${CFLAGS--O}

    mozprefix="/usr"

    AC_ARG_WITH(mozilla,
      [  --with-mozilla=dir      Specify the Mozilla directory],[
      if test x$withval != x; then
         mozprefix=$withval
      fi
    ], [
      if test x$MOZILLA != x; then
         mozprefix="$MOZILLA/dist"
      fi
    ])

    MOZILLA_INCLUDE_DIR="$mozprefix/include"
    MOZILLA_LIB_DIR="$mozprefix/lib"
    MOZILLA_BIN_DIR="$mozprefix/bin"
    MOZILLA_IDL_DIR="$mozprefix/idl"

    AC_MSG_CHECKING(for mozilla)

    if ! test -f $MOZILLA_INCLUDE_DIR/nsError.h; then
        AC_MSG_ERROR("Could not find header nsError.h in includes dir $MOZILLA_INCLUDE_DIR")
    fi

    if ! test -f $MOZILLA_LIB_DIR/libgtkembedmoz.so; then
        AC_MSG_ERROR("Could not find library libgtkembedmoz.so in lib dir $MOZILLA_LIB_DIR")
    fi

    if ! test -f $MOZILLA_IDL_DIR/nsISupports.idl; then
        AC_MSG_ERROR("Could not find nsISupports.idl in idl dir $MOZILLA_IDL_DIR")
    fi

    if test -f $MOZILLA_LIB_DIR/defaults/pref/all.js; then
        ALLJSLOC=$MOZILLA_LIB_DIR/defaults/pref/all.js
    else
        ALLJSLOC=$MOZILLA_FIVE_HOME/defaults/pref/all.js
    fi

    MOZILLA_VER=$(perl $srcdir/macros/mozilla-version.pl $ALLJSLOC)

    if test $MOZILLA_VER -eq "0"; then 
        AC_MSG_ERROR("Could not determine mozilla version")
    fi

    if test $MOZILLA_VER -lt "91"; then
        AC_MSG_ERROR("Mozilla version must be at least 0.9.1")
    else
        AC_MSG_RESULT(found)
    fi

    AC_SUBST(MOZILLA_BIN_DIR)
    AC_SUBST(MOZILLA_LIB_DIR)
    AC_SUBST(MOZILLA_INCLUDE_DIR)
    AC_SUBST(MOZILLA_IDL_DIR)
    AC_SUBST(MOZILLA_VER)
])