ZVT_LIBS
[platform/upstream/gnome-common.git] / macros / gnome.m4
1 dnl
2 dnl GNOME_INIT_HOOK (script-if-gnome-enabled, failflag)
3 dnl
4 dnl if failflag is "fail" then GNOME_INIT_HOOK will abort if gnomeConf.sh
5 dnl is not found. 
6 dnl
7
8 AC_DEFUN([GNOME_INIT_HOOK],
9 [       
10         AC_SUBST(GNOME_LIBS)
11         AC_SUBST(GNOMEUI_LIBS)
12         AC_SUBST(GNOMEGNORBA_LIBS)
13         AC_SUBST(GTKXMHTML_LIBS)
14         AC_SUBST(ZVT_LIBS)
15         AC_SUBST(GNOME_APPLET_LIBS)
16         AC_SUBST(GNOME_LIBDIR)
17         AC_SUBST(GNOME_INCLUDEDIR)
18
19         AC_ARG_WITH(gnome-includes,
20         [  --with-gnome-includes   Specify location of GNOME headers],[
21         CFLAGS="$CFLAGS -I$withval"
22         ])
23         
24         AC_ARG_WITH(gnome-libs,
25         [  --with-gnome-libs       Specify location of GNOME libs],[
26         LDFLAGS="$LDFLAGS -L$withval"
27         gnome_prefix=$withval
28         ])
29
30         AC_ARG_WITH(gnome,
31         [  --with-gnome            Specify prefix for GNOME files],
32                 if test x$withval = xyes; then
33                         want_gnome=yes
34                         dnl Note that an empty true branch is not
35                         dnl valid sh syntax.
36                         ifelse([$1], [], :, [$1])
37                 else
38                         if test "x$withval" = xno; then
39                                 want_gnome=no
40                         else
41                                 want_gnome=yes
42                                 LDFLAGS="$LDFLAGS -L$withval/lib"
43                                 CFLAGS="$CFLAGS -I$withval/include"
44                                 gnome_prefix=$withval/lib
45                         fi
46                 fi,
47                 want_gnome=yes)
48
49         if test "x$want_gnome" = xyes; then
50
51             AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
52             if test "$GNOME_CONFIG" = "no"; then
53               no_gnome_config="yes"
54             else
55               AC_MSG_CHECKING(if $GNOME_CONFIG works)
56               if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
57                 AC_MSG_RESULT(yes)
58                 GNOME_GNORBA_HOOK([],$2)
59                 GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
60                 GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
61                 GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
62                 GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
63                 ZVT_LIBS="`$GNOME_CONFIG --libs-only-l zvt`"
64                 GNOME_APPLET_LIBS="`$GNOME_CONFIG --libs-only-l applets`"
65                 GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
66                 GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
67                 $1
68               else
69                 AC_MSG_RESULT(no)
70                 no_gnome_config="yes"
71               fi
72             fi
73
74             if test x$exec_prefix = xNONE; then
75                 if test x$prefix = xNONE; then
76                     gnome_prefix=$ac_default_prefix/lib
77                 else
78                     gnome_prefix=$prefix/lib
79                 fi
80             else
81                 gnome_prefix=`eval echo \`echo $libdir\``
82             fi
83         
84             if test "$no_gnome_config" = "yes"; then
85               AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
86               if test -f $gnome_prefix/gnomeConf.sh; then
87                 AC_MSG_RESULT(found)
88                 echo "loading gnome configuration from" \
89                      "$gnome_prefix/gnomeConf.sh"
90                 . $gnome_prefix/gnomeConf.sh
91                 $1
92               else
93                 AC_MSG_RESULT(not found)
94                 if test x$2 = xfail; then
95                   AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
96                 fi
97               fi
98             fi
99         fi
100 ])
101
102 AC_DEFUN([GNOME_INIT],[
103         GNOME_INIT_HOOK([],fail)
104 ])