aboutsummaryrefslogtreecommitdiffstats
path: root/macros/gnome.m4
blob: c1c98491f2bc5c4c543185cd62d909bd4d5fd6ba (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
dnl
dnl GNOME_INIT_HOOK (script-if-gnome-enabled, failflag)
dnl
dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
dnl is not found. 
dnl

AC_DEFUN([GNOME_INIT_HOOK],
[   
    AC_SUBST(GNOME_LIBS)
    AC_SUBST(GNOMEUI_LIBS)
    AC_SUBST(GNOMEGNORBA_LIBS)
    AC_SUBST(GTKXMHTML_LIBS)
    AC_SUBST(GNOME_APPLET_LIBS)
    AC_SUBST(GNOME_LIBDIR)
    AC_SUBST(GNOME_INCLUDEDIR)

    AC_ARG_WITH(gnome-includes,
    [  --with-gnome-includes   Specify location of GNOME headers],[
    CFLAGS="$CFLAGS -I$withval"
    ])
    
    AC_ARG_WITH(gnome-libs,
    [  --with-gnome-libs       Specify location of GNOME libs],[
    LDFLAGS="$LDFLAGS -L$withval"
    gnome_prefix=$withval
    ])

    AC_ARG_WITH(gnome,
    [  --with-gnome            Specify prefix for GNOME files],
        if test x$withval = xyes; then
                want_gnome=yes
                dnl Note that an empty true branch is not
            dnl valid sh syntax.
                ifelse([$1], [], :, [$1])
            else
                if test "x$withval" = xno; then
                    want_gnome=no
                else
                    want_gnome=yes
                    LDFLAGS="$LDFLAGS -L$withval/lib"
                    CFLAGS="$CFLAGS -I$withval/include"
                    gnome_prefix=$withval/lib
                fi
        fi,
        want_gnome=yes)

    if test "x$want_gnome" = xyes; then

        AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
        if test "$GNOME_CONFIG" = "no"; then
          no_gnome_config="yes"
        else
          AC_MSG_CHECKING(if $GNOME_CONFIG works)
          if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
            AC_MSG_RESULT(yes)
            GNOME_GNORBA_HOOK([],$2)
            GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
            GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
            GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
            GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
            GNOME_APPLET_LIBS="`$GNOME_CONFIG --libs-only-l applets`"
            GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
            GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
                $1
          else
            AC_MSG_RESULT(no)
            no_gnome_config="yes"
              fi
            fi

        if test x$exec_prefix = xNONE; then
            if test x$prefix = xNONE; then
            gnome_prefix=$ac_default_prefix/lib
            else
            gnome_prefix=$prefix/lib
            fi
        else
            gnome_prefix=`eval echo \`echo $libdir\``
        fi
    
        if test "$no_gnome_config" = "yes"; then
              AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
          if test -f $gnome_prefix/gnomeConf.sh; then
            AC_MSG_RESULT(found)
            echo "loading gnome configuration from" \
             "$gnome_prefix/gnomeConf.sh"
            . $gnome_prefix/gnomeConf.sh
            $1
          else
            AC_MSG_RESULT(not found)
            if test x$2 = xfail; then
              AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
            fi
          fi
            fi
    fi
])

AC_DEFUN([GNOME_INIT],[
    GNOME_INIT_HOOK([],fail)
])