Add GNOME_GNORBA_CHECK if gnome-config is found. New GNOMEGNORBA_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(GNOME_LIBDIR)
15         AC_SUBST(GNOME_INCLUDEDIR)
16
17         AC_PATH_PROG(GNOME_CONFIG,gnome-config,no)
18         if test "$GNOME_CONFIG" = "no"; then
19           no_gnome_config="yes"
20         else
21           AC_MSG_CHECKING(if $GNOME_CONFIG works)
22           if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
23             AC_MSG_RESULT(yes)
24             GNOME_GNORBA_CHECK
25             GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
26             GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
27             GNOMEGNORBA_LIBS="`$GNOME_CONFIG --libs-only-l gnorba gnomeui`"
28             GTKXMHTML_LIBS="`$GNOME_CONFIG --libs-only-l gtkxmhtml`"
29             GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
30             GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
31             $1
32           else
33             AC_MSG_RESULT(no)
34             no_gnome_config="yes"
35           fi
36         fi
37
38         if test x$exec_prefix = xNONE; then
39             if test x$prefix = xNONE; then
40                 gnome_prefix=$ac_default_prefix/lib
41             else
42                 gnome_prefix=$prefix/lib
43             fi
44         else
45             gnome_prefix=`eval echo \`echo $libdir\``
46         fi
47         
48         AC_ARG_WITH(gnome-includes,
49         [  --with-gnome-includes   Specify location of GNOME headers],[
50         CFLAGS="$CFLAGS -I$withval"
51         ])
52         
53         AC_ARG_WITH(gnome-libs,
54         [  --with-gnome-libs       Specify location of GNOME libs],[
55         LDFLAGS="$LDFLAGS -L$withval"
56         gnome_prefix=$withval
57         ])
58
59         AC_ARG_WITH(gnome,
60         [  --with-gnome            Specify prefix for GNOME files],[
61         if test x$withval = xyes; then
62             dnl Note that an empty true branch is not valid sh syntax.
63             ifelse([$1], [], :, [$1])
64         else
65             LDFLAGS="$LDFLAGS -L$withval/lib"
66             CFLAGS="$CFLAGS -I$withval/include"
67             gnome_prefix=$withval/lib
68         fi
69         ])
70
71         if test "$no_gnome_config" = "yes"; then
72           AC_MSG_CHECKING(for gnomeConf.sh file in $gnome_prefix)
73           if test -f $gnome_prefix/gnomeConf.sh; then
74             AC_MSG_RESULT(found)
75             echo "loading gnome configuration from $gnome_prefix/gnomeConf.sh"
76             . $gnome_prefix/gnomeConf.sh
77             $1
78           else
79             AC_MSG_RESULT(not found)
80             if test x$2 = xfail; then
81               AC_MSG_ERROR(Could not find the gnomeConf.sh file that is generated by gnome-libs install)
82             fi
83           fi
84         fi
85 ])
86
87 AC_DEFUN([GNOME_INIT],[
88         GNOME_INIT_HOOK([],fail)
89 ])