1 AC_DEFUN(AM_PATH_GNOME,
3 dnl Get the cflags and libraries from the gnome-config script
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)
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
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
25 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
26 min_gnome_version=ifelse([$1], , 1.1.0, $1)
28 AC_MSG_CHECKING(for GNOME - version >= $min_gnome_version)
30 if test "$GNOME_CONFIG" = "no" ; then
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`"
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/'`
51 if test $gnome_config_major_version -lt $needed_major_version; then
52 ifelse([$3], , :, [$3])
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])
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])
66 AC_SUBST(GNOME_CFLAGS)
68 AC_SUBST(GNOMEUI_CFLAGS)
69 AC_SUBST(GNOMEUI_LIBS)
71 if test "x$no_gnome" = x ; then
73 ifelse([$2], , :, [$2])
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."
86 ifelse([$3], , :, [$3])
89 tmp_gnome_libdir=`$GNOME_CONFIG $gnome_config_args --libdir`
91 AC_MSG_CHECKING([for additional GNOME modules])
93 for module in $4 ""; do
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`"
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`"
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)
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`"
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
124 AC_MSG_RESULT([*** $module library is not installed])
125 ifelse([$3], , :, [$3])
126 gnome_m4_notfound=yes
128 if test "$gnome_m4_notfound" = no; then
129 echo $ac_n " $module" 1>&6
132 if test -n "$4"; then