No mo gtk-xmhtml or libgnorba.
[platform/upstream/gnome-common.git] / hack-macros / gnome.m4
1 AC_DEFUN(AM_PATH_GNOME,
2 [dnl 
3 dnl Get the cflags and libraries from the gnome-config script
4 dnl
5 AC_ARG_WITH(gnome-prefix,[  --with-gnome-prefix=PFX   Prefix where GNOME is installed (optional)],
6             gnome_config_prefix="$withval", gnome_config_prefix="")
7 AC_ARG_WITH(gnome-exec-prefix,[  --with-gnome-exec-prefix=PFX Exec prefix where GNOME is installed (optional)],
8             gnome_config_exec_prefix="$withval", gnome_config_exec_prefix="")
9 AC_ARG_ENABLE(gnometest, [  --disable-gnometest       Do not try to compile and run a test GNOME program],
10                     , enable_gnometest=yes)
11
12   if test x$gnome_config_exec_prefix != x ; then
13      gnome_config_args="$gnome_config_args --exec-prefix=$gnome_config_exec_prefix"
14      if test x${GNOME_CONFIG+set} != xset ; then
15         GNOME_CONFIG=$gnome_config_exec_prefix/bin/gnome-config
16      fi
17   fi
18   if test x$gnome_config_prefix != x ; then
19      gnome_config_args="$gnome_config_args --prefix=$gnome_config_prefix"
20      if test x${GNOME_CONFIG+set} != xset ; then
21         GNOME_CONFIG=$gnome_config_prefix/bin/gnome-config
22      fi
23   fi
24
25   AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
26   min_gnome_version=ifelse([$1], , 1.1.0, $1)
27
28   AC_MSG_CHECKING(for GNOME - version >= $min_gnome_version)
29   no_gnome=""
30   if test "$GNOME_CONFIG" = "no" ; then
31     no_gnome=yes
32   else
33     GNOME_CFLAGS="`$GNOME_CONFIG $gnome_config_args --cflags gnome`"
34     GNOME_LIBS="`$GNOME_CONFIG $gnome_config_args --libs gnome`"
35     GNOMEUI_CFLAGS="`$GNOME_CONFIG $gnome_config_args --cflags gnomeui`"
36     GNOMEUI_LIBS="`$GNOME_CONFIG $gnome_config_args --libs gnomeui`"
37
38     gnome_config_major_version=`$GNOME_CONFIG $gnome_config_args --version | \
39            sed 's/[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
40     gnome_config_minor_version=`$GNOME_CONFIG $gnome_config_args --version | \
41            sed 's/[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
42     gnome_config_micro_version=`$GNOME_CONFIG $gnome_config_args --version | \
43            sed 's/[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
44     needed_major_version=`echo $min_gnome_version | \
45            sed 's/[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
46     needed_minor_version=`echo $min_gnome_version | \
47            sed 's/[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
48     needed_micro_version=`echo $min_gnome_version | \
49            sed 's/[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
50
51     if test $gnome_config_major_version -lt $needed_major_version; then
52         ifelse([$3], , :, [$3])
53         no_gnome=yes
54     elif test $gnome_config_major_version = $needed_major_version; then
55         if test -n "$needed_minor_version" -a $gnome_config_minor_version -lt $needed_minor_version; then
56                 ifelse([$3], , :, [$3])
57                 no_gnome=yes
58         elif test -n "$needed_minor_version" -a $gnome_config_minor_version = $needed_minor_version; then
59                 if test -n "$needed_micro_version" -a $gnome_config_micro_version -lt $needed_micro_version; then
60                         ifelse([$3], , :, [$3])
61                         no_gnome=yes
62                 fi
63         fi
64     fi
65   fi
66   AC_SUBST(GNOME_CFLAGS)
67   AC_SUBST(GNOME_LIBS)
68   AC_SUBST(GNOMEUI_CFLAGS)
69   AC_SUBST(GNOMEUI_LIBS)
70
71   if test "x$no_gnome" = x ; then
72      AC_MSG_RESULT(yes)
73      ifelse([$2], , :, [$2])     
74   else
75      AC_MSG_RESULT(no)
76      if test "$GNOME_CONFIG" = "no" ; then
77        echo "*** The gnome-config script installed by GNOME could not be found"
78        echo "*** If GNOME was installed in PREFIX, make sure PREFIX/bin is in"
79        echo "*** your path, or set the GNOME_CONFIG environment variable to the"
80        echo "*** full path to gnome-config."
81      else
82         :
83      fi
84      GNOME_CFLAGS=""
85      GNOME_LIBS=""
86      ifelse([$3], , :, [$3])
87   fi
88
89   tmp_gnome_libdir=`$GNOME_CONFIG $gnome_config_args --libdir`
90   if test -n "$4"; then
91         AC_MSG_CHECKING([for additional GNOME modules])
92   fi
93   for module in $4 ""; do
94         gnome_m4_notfound=no
95         if test -f $tmp_gnome_libdir/${module}Conf.sh; then
96                 tmp_bsnom=`echo $module | tr a-z A-Z`
97                 eval $tmp_bsnom'_CFLAGS'=\"`$GNOME_CONFIG $gnome_config_args --cflags $module`\"
98                 eval $tmp_bsnom'_LIBS'=\"`$GNOME_CONFIG $gnome_config_args --libs $module`\"
99         elif test "$module" = zvt; then
100           ZVT_LIBS="`$GNOME_CONFIG $gnome_config_args --libs zvt`"
101           AC_SUBST(ZVT_LIBS)
102         elif test "$module" = gtk; then
103           GTK_CFLAGS="`$GNOME_CONFIG $gnome_config_args --cflags gtk`"
104           GTK_LIBS="`$GNOME_CONFIG $gnome_config_args --libs gtk`"
105           AC_SUBST(GTK_CFLAGS)
106           AC_SUBST(GTK_LIBS)
107         elif test "$module" = "glib"; then
108           GLIB_CFLAGS="`$GNOME_CONFIG $gnome_config_args --cflags glib`"
109           GLIB_LIBS="`$GNOME_CONFIG $gnome_config_args --libs glib`"
110           AC_SUBST(GLIB_CFLAGS)
111           AC_SUBST(GLIB_LIBS)
112         elif test "$module" = "oaf"; then
113           OAF_CFLAGS="`$GNOME_CONFIG $gnome_config_args --cflags oaf`"
114           OAF_LIBS="`$GNOME_CONFIG $gnome_config_args --libs oaf`"
115           AC_SUBST(OAF_CFLAGS)
116           AC_SUBST(OAF_LIBS)
117         elif test "$module" = "gnorba"; then
118           GNORBA_CFLAGS="`$GNOME_CONFIG $gnome_config_args --cflags gnorba`"
119           GNORBA_LIBS="`$GNOME_CONFIG $gnome_config_args --libs gnorba`"
120           AC_SUBST(GNORBA_CFLAGS)
121           AC_SUBST(GNORBA_LIBS)
122         elif test -n "$module"; then
123           echo
124           AC_MSG_RESULT([*** $module library is not installed])
125           ifelse([$3], , :, [$3])
126           gnome_m4_notfound=yes
127         fi
128         if test "$gnome_m4_notfound" = no; then
129           echo $ac_n " $module" 1>&6
130         fi
131   done
132   if test -n "$4"; then
133         AC_MSG_RESULT([])
134   fi
135
136   rm -f conf.gnometest
137 ])