source: trunk/third/rep-gtk/aclocal.m4 @ 15286

Revision 15286, 26.6 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15285, which included commits to RCS files with non-trunk default branches.
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl Configure paths for librep
14dnl $Id: aclocal.m4,v 1.1.1.1 2000-11-12 06:16:42 ghudson Exp $
15dnl
16dnl AM_PATH_REP([MINIMUM_VERSION])
17dnl Test for librep, define REP_VERSION, REP_CFLAGS, REP_LIBS and REP_EXECDIR
18dnl
19AC_DEFUN(AM_PATH_REP,
20[dnl
21  AC_ARG_WITH(rep_prefix,[  --with-rep-prefix=PFX   Prefix where rep is installed (optional)],
22              [rep_prefix="$withval"], [rep_prefix=""])
23  if test "x$rep_prefix" = "x"; then
24    rep_config="rep-config"
25  else
26    rep_config="${rep_prefix}/bin/rep-config"
27  fi
28  min_rep_version=ifelse([$1], ,0.1,$1)
29  AC_MSG_CHECKING(for rep - version >= $min_rep_version)
30  rep_version=`$rep_config --version`
31  if test $? -eq 0; then
32    rep_major=`echo $rep_version \
33        | sed -e 's/\([[0-9]]*\)\..*/\1/'`
34    rep_minor=`echo $rep_version \
35        | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
36    min_rep_major=`echo $min_rep_version \
37        | sed -e 's/\([[0-9]]*\)\..*/\1/'`
38    min_rep_minor=`echo $min_rep_version \
39        | sed -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
40    if test '(' $rep_major -gt $min_rep_major ')' \
41        -o '(' $rep_major -eq $min_rep_major \
42               -a $rep_minor -ge $min_rep_minor ')';
43    then
44      REP_VERSION="${rep_version}"
45      REP_CFLAGS="`$rep_config --cflags`"
46      REP_LIBS="`$rep_config --libs`"
47      REP_EXECDIR="`$rep_config --execdir`"
48      AC_SUBST(REP_VERSION)
49      AC_SUBST(REP_CFLAGS)
50      AC_SUBST(REP_LIBS)
51      AC_SUBST(REP_EXECDIR)
52      AC_MSG_RESULT([version ${rep_version}])
53    else
54      AC_MSG_ERROR([version ${rep_version}; require $min_rep_version])
55    fi
56  else
57    AC_MSG_ERROR([can't find librep; is it installed?])
58  fi
59
60  dnl scan for GNU msgfmt
61  AC_MSG_CHECKING(for GNU msgfmt)
62  REP_MSGFMT=
63  for p in `echo "$PATH" | sed -e 's/:/ /g'`; do
64    if test -x $p/msgfmt; then
65      if $p/msgfmt --version 2>&1 | grep GNU >/dev/null; then
66        REP_MSGFMT=$p/msgfmt
67      fi
68    fi
69  done
70  if test x$REP_MSGFMT != x; then
71    AC_MSG_RESULT($REP_MSGFMT)
72  else
73    AC_MSG_RESULT(unavailable, disabling i18n)
74    REP_MSGFMT=true
75  fi
76  AC_SUBST(REP_MSGFMT)
77])
78
79# Configure paths for GLIB
80# Owen Taylor     97-11-3
81
82dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
83dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or
84dnl gthread is specified in MODULES, pass to glib-config
85dnl
86AC_DEFUN(AM_PATH_GLIB,
87[dnl
88dnl Get the cflags and libraries from the glib-config script
89dnl
90AC_ARG_WITH(glib-prefix,[  --with-glib-prefix=PFX   Prefix where GLIB is installed (optional)],
91            glib_config_prefix="$withval", glib_config_prefix="")
92AC_ARG_WITH(glib-exec-prefix,[  --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
93            glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
94AC_ARG_ENABLE(glibtest, [  --disable-glibtest       Do not try to compile and run a test GLIB program],
95                    , enable_glibtest=yes)
96
97  if test x$glib_config_exec_prefix != x ; then
98     glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
99     if test x${GLIB_CONFIG+set} != xset ; then
100        GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
101     fi
102  fi
103  if test x$glib_config_prefix != x ; then
104     glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
105     if test x${GLIB_CONFIG+set} != xset ; then
106        GLIB_CONFIG=$glib_config_prefix/bin/glib-config
107     fi
108  fi
109
110  for module in . $4
111  do
112      case "$module" in
113         gmodule)
114             glib_config_args="$glib_config_args gmodule"
115         ;;
116         gthread)
117             glib_config_args="$glib_config_args gthread"
118         ;;
119      esac
120  done
121
122  AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
123  min_glib_version=ifelse([$1], ,0.99.7,$1)
124  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
125  no_glib=""
126  if test "$GLIB_CONFIG" = "no" ; then
127    no_glib=yes
128  else
129    GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
130    GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
131    glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
132           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
133    glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
134           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
135    glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
136           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
137    if test "x$enable_glibtest" = "xyes" ; then
138      ac_save_CFLAGS="$CFLAGS"
139      ac_save_LIBS="$LIBS"
140      CFLAGS="$CFLAGS $GLIB_CFLAGS"
141      LIBS="$GLIB_LIBS $LIBS"
142dnl
143dnl Now check if the installed GLIB is sufficiently new. (Also sanity
144dnl checks the results of glib-config to some extent
145dnl
146      rm -f conf.glibtest
147      AC_TRY_RUN([
148#include <glib.h>
149#include <stdio.h>
150#include <stdlib.h>
151
152int
153main ()
154{
155  int major, minor, micro;
156  char *tmp_version;
157
158  system ("touch conf.glibtest");
159
160  /* HP/UX 9 (%@#!) writes to sscanf strings */
161  tmp_version = g_strdup("$min_glib_version");
162  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
163     printf("%s, bad version string\n", "$min_glib_version");
164     exit(1);
165   }
166
167  if ((glib_major_version != $glib_config_major_version) ||
168      (glib_minor_version != $glib_config_minor_version) ||
169      (glib_micro_version != $glib_config_micro_version))
170    {
171      printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
172             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
173             glib_major_version, glib_minor_version, glib_micro_version);
174      printf ("*** was found! If glib-config was correct, then it is best\n");
175      printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
176      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
177      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
178      printf("*** required on your system.\n");
179      printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
180      printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
181      printf("*** before re-running configure\n");
182    }
183  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
184           (glib_minor_version != GLIB_MINOR_VERSION) ||
185           (glib_micro_version != GLIB_MICRO_VERSION))
186    {
187      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
188             GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
189      printf("*** library (version %d.%d.%d)\n",
190             glib_major_version, glib_minor_version, glib_micro_version);
191    }
192  else
193    {
194      if ((glib_major_version > major) ||
195        ((glib_major_version == major) && (glib_minor_version > minor)) ||
196        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
197      {
198        return 0;
199       }
200     else
201      {
202        printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
203               glib_major_version, glib_minor_version, glib_micro_version);
204        printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
205               major, minor, micro);
206        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
207        printf("***\n");
208        printf("*** If you have already installed a sufficiently new version, this error\n");
209        printf("*** probably means that the wrong copy of the glib-config shell script is\n");
210        printf("*** being found. The easiest way to fix this is to remove the old version\n");
211        printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
212        printf("*** correct copy of glib-config. (In this case, you will have to\n");
213        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
214        printf("*** so that the correct libraries are found at run-time))\n");
215      }
216    }
217  return 1;
218}
219],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
220       CFLAGS="$ac_save_CFLAGS"
221       LIBS="$ac_save_LIBS"
222     fi
223  fi
224  if test "x$no_glib" = x ; then
225     AC_MSG_RESULT(yes)
226     ifelse([$2], , :, [$2])     
227  else
228     AC_MSG_RESULT(no)
229     if test "$GLIB_CONFIG" = "no" ; then
230       echo "*** The glib-config script installed by GLIB could not be found"
231       echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
232       echo "*** your path, or set the GLIB_CONFIG environment variable to the"
233       echo "*** full path to glib-config."
234     else
235       if test -f conf.glibtest ; then
236        :
237       else
238          echo "*** Could not run GLIB test program, checking why..."
239          CFLAGS="$CFLAGS $GLIB_CFLAGS"
240          LIBS="$LIBS $GLIB_LIBS"
241          AC_TRY_LINK([
242#include <glib.h>
243#include <stdio.h>
244],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
245        [ echo "*** The test program compiled, but did not run. This usually means"
246          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
247          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
248          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
249          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
250          echo "*** is required on your system"
251          echo "***"
252          echo "*** If you have an old version installed, it is best to remove it, although"
253          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
254          echo "***"
255          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
256          echo "*** came with the system with the command"
257          echo "***"
258          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
259        [ echo "*** The test program failed to compile or link. See the file config.log for the"
260          echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
261          echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
262          echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
263          CFLAGS="$ac_save_CFLAGS"
264          LIBS="$ac_save_LIBS"
265       fi
266     fi
267     GLIB_CFLAGS=""
268     GLIB_LIBS=""
269     ifelse([$3], , :, [$3])
270  fi
271  AC_SUBST(GLIB_CFLAGS)
272  AC_SUBST(GLIB_LIBS)
273  rm -f conf.glibtest
274])
275
276# Configure paths for GTK+
277# Owen Taylor     97-11-3
278
279dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
280dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
281dnl
282AC_DEFUN(AM_PATH_GTK,
283[dnl
284dnl Get the cflags and libraries from the gtk-config script
285dnl
286AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
287            gtk_config_prefix="$withval", gtk_config_prefix="")
288AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
289            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
290AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
291                    , enable_gtktest=yes)
292
293  for module in . $4
294  do
295      case "$module" in
296         gthread)
297             gtk_config_args="$gtk_config_args gthread"
298         ;;
299      esac
300  done
301
302  if test x$gtk_config_exec_prefix != x ; then
303     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
304     if test x${GTK_CONFIG+set} != xset ; then
305        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
306     fi
307  fi
308  if test x$gtk_config_prefix != x ; then
309     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
310     if test x${GTK_CONFIG+set} != xset ; then
311        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
312     fi
313  fi
314
315  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
316  min_gtk_version=ifelse([$1], ,0.99.7,$1)
317  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
318  no_gtk=""
319  if test "$GTK_CONFIG" = "no" ; then
320    no_gtk=yes
321  else
322    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
323    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
324    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
325           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
326    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
327           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
328    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
329           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
330    if test "x$enable_gtktest" = "xyes" ; then
331      ac_save_CFLAGS="$CFLAGS"
332      ac_save_LIBS="$LIBS"
333      CFLAGS="$CFLAGS $GTK_CFLAGS"
334      LIBS="$GTK_LIBS $LIBS"
335dnl
336dnl Now check if the installed GTK is sufficiently new. (Also sanity
337dnl checks the results of gtk-config to some extent
338dnl
339      rm -f conf.gtktest
340      AC_TRY_RUN([
341#include <gtk/gtk.h>
342#include <stdio.h>
343#include <stdlib.h>
344
345int
346main ()
347{
348  int major, minor, micro;
349  char *tmp_version;
350
351  system ("touch conf.gtktest");
352
353  /* HP/UX 9 (%@#!) writes to sscanf strings */
354  tmp_version = g_strdup("$min_gtk_version");
355  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
356     printf("%s, bad version string\n", "$min_gtk_version");
357     exit(1);
358   }
359
360  if ((gtk_major_version != $gtk_config_major_version) ||
361      (gtk_minor_version != $gtk_config_minor_version) ||
362      (gtk_micro_version != $gtk_config_micro_version))
363    {
364      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
365             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
366             gtk_major_version, gtk_minor_version, gtk_micro_version);
367      printf ("*** was found! If gtk-config was correct, then it is best\n");
368      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
369      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
370      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
371      printf("*** required on your system.\n");
372      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
373      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
374      printf("*** before re-running configure\n");
375    }
376#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
377  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
378           (gtk_minor_version != GTK_MINOR_VERSION) ||
379           (gtk_micro_version != GTK_MICRO_VERSION))
380    {
381      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
382             GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
383      printf("*** library (version %d.%d.%d)\n",
384             gtk_major_version, gtk_minor_version, gtk_micro_version);
385    }
386#endif /* defined (GTK_MAJOR_VERSION) ... */
387  else
388    {
389      if ((gtk_major_version > major) ||
390        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
391        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
392      {
393        return 0;
394       }
395     else
396      {
397        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
398               gtk_major_version, gtk_minor_version, gtk_micro_version);
399        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
400               major, minor, micro);
401        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
402        printf("***\n");
403        printf("*** If you have already installed a sufficiently new version, this error\n");
404        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
405        printf("*** being found. The easiest way to fix this is to remove the old version\n");
406        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
407        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
408        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
409        printf("*** so that the correct libraries are found at run-time))\n");
410      }
411    }
412  return 1;
413}
414],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
415       CFLAGS="$ac_save_CFLAGS"
416       LIBS="$ac_save_LIBS"
417     fi
418  fi
419  if test "x$no_gtk" = x ; then
420     AC_MSG_RESULT(yes)
421     ifelse([$2], , :, [$2])     
422  else
423     AC_MSG_RESULT(no)
424     if test "$GTK_CONFIG" = "no" ; then
425       echo "*** The gtk-config script installed by GTK could not be found"
426       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
427       echo "*** your path, or set the GTK_CONFIG environment variable to the"
428       echo "*** full path to gtk-config."
429     else
430       if test -f conf.gtktest ; then
431        :
432       else
433          echo "*** Could not run GTK test program, checking why..."
434          CFLAGS="$CFLAGS $GTK_CFLAGS"
435          LIBS="$LIBS $GTK_LIBS"
436          AC_TRY_LINK([
437#include <gtk/gtk.h>
438#include <stdio.h>
439],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
440        [ echo "*** The test program compiled, but did not run. This usually means"
441          echo "*** that the run-time linker is not finding GTK or finding the wrong"
442          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
443          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
444          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
445          echo "*** is required on your system"
446          echo "***"
447          echo "*** If you have an old version installed, it is best to remove it, although"
448          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
449          echo "***"
450          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
451          echo "*** came with the system with the command"
452          echo "***"
453          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
454        [ echo "*** The test program failed to compile or link. See the file config.log for the"
455          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
456          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
457          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
458          CFLAGS="$ac_save_CFLAGS"
459          LIBS="$ac_save_LIBS"
460       fi
461     fi
462     GTK_CFLAGS=""
463     GTK_LIBS=""
464     ifelse([$3], , :, [$3])
465  fi
466  AC_SUBST(GTK_CFLAGS)
467  AC_SUBST(GTK_LIBS)
468  rm -f conf.gtktest
469])
470
471# a macro to get the libs/cflags for libglade
472# serial 1
473
474dnl AM_PATH_LIBGLADE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]])
475dnl Test to see if libglade is installed, and define LIBGLADE_CFLAGS, LIBS
476dnl
477AC_DEFUN(AM_PATH_LIBGLADE,
478[dnl
479dnl Get the cflags and libraries from the libglade-config script
480dnl
481AC_ARG_WITH(libglade-config,
482[  --with-libglade-config=LIBGLADE_CONFIG  Location of libglade-config],
483LIBGLADE_CONFIG="$withval")
484
485module_args=
486for module in . $3; do
487  case "$module" in
488    gnome)
489      module_args="$module_args gnome"
490      ;;
491    bonobo)
492      module_args="$module_args bonobo"
493      ;;
494  esac
495done
496
497AC_PATH_PROG(LIBGLADE_CONFIG, libglade-config, no)
498AC_MSG_CHECKING(for libglade)
499if test "$LIBGLADE_CONFIG" = "no"; then
500  AC_MSG_RESULT(no)
501  ifelse([$2], , :, [$2])
502else
503  if $LIBGLADE_CONFIG --check $module_args; then
504    LIBGLADE_CFLAGS=`$LIBGLADE_CONFIG --cflags $module_args`
505    LIBGLADE_LIBS=`$LIBGLADE_CONFIG --libs $module_args`
506    AC_MSG_RESULT(yes)
507    ifelse([$1], , :, [$1])
508  else
509    echo "*** libglade was not compiled with support for $module_args" 1>&2
510    AC_MSG_RESULT(no)
511    ifelse([$2], , :, [$2])
512  fi
513fi
514AC_SUBST(LIBGLADE_CFLAGS)
515AC_SUBST(LIBGLADE_LIBS)
516])
517# Configure paths for gdk-pixbuf
518# Elliot Lee 2000-01-10
519# stolen from Raph Levien 98-11-18
520# stolen from Manish Singh    98-9-30
521# stolen back from Frank Belew
522# stolen from Manish Singh
523# Shamelessly stolen from Owen Taylor
524
525dnl AM_PATH_GDK_PIXBUF([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
526dnl Test for GDK_PIXBUF, and define GDK_PIXBUF_CFLAGS and GDK_PIXBUF_LIBS
527dnl
528AC_DEFUN(AM_PATH_GDK_PIXBUF,
529[dnl
530dnl Get the cflags and libraries from the gdk-pixbuf-config script
531dnl
532AC_ARG_WITH(gdk-pixbuf-prefix,[  --with-gdk-pixbuf-prefix=PFX   Prefix where GDK_PIXBUF is installed (optional)],
533            gdk_pixbuf_prefix="$withval", gdk_pixbuf_prefix="")
534AC_ARG_WITH(gdk-pixbuf-exec-prefix,[  --with-gdk-pixbuf-exec-prefix=PFX Exec prefix where GDK_PIXBUF is installed (optional)],
535            gdk_pixbuf_exec_prefix="$withval", gdk_pixbuf_exec_prefix="")
536AC_ARG_ENABLE(gdk_pixbuftest, [  --disable-gdk_pixbuftest       Do not try to compile and run a test GDK_PIXBUF program],
537                    , enable_gdk_pixbuftest=yes)
538
539  if test x$gdk_pixbuf_exec_prefix != x ; then
540     gdk_pixbuf_args="$gdk_pixbuf_args --exec-prefix=$gdk_pixbuf_exec_prefix"
541     if test x${GDK_PIXBUF_CONFIG+set} != xset ; then
542        GDK_PIXBUF_CONFIG=$gdk_pixbuf_exec_prefix/bin/gdk-pixbuf-config
543     fi
544  fi
545  if test x$gdk_pixbuf_prefix != x ; then
546     gdk_pixbuf_args="$gdk_pixbuf_args --prefix=$gdk_pixbuf_prefix"
547     if test x${GDK_PIXBUF_CONFIG+set} != xset ; then
548        GDK_PIXBUF_CONFIG=$gdk_pixbuf_prefix/bin/gdk-pixbuf-config
549     fi
550  fi
551
552  AC_PATH_PROG(GDK_PIXBUF_CONFIG, gdk-pixbuf-config, no)
553  min_gdk_pixbuf_version=ifelse([$1], ,0.2.5,$1)
554  AC_MSG_CHECKING(for GDK_PIXBUF - version >= $min_gdk_pixbuf_version)
555  no_gdk_pixbuf=""
556  if test "$GDK_PIXBUF_CONFIG" = "no" ; then
557    no_gdk_pixbuf=yes
558  else
559    GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --cflags`
560    GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --libs`
561
562    gdk_pixbuf_major_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
563           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
564    gdk_pixbuf_minor_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
565           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
566    gdk_pixbuf_micro_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_config_args --version | \
567           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
568    if test "x$enable_gdk_pixbuftest" = "xyes" ; then
569      ac_save_CFLAGS="$CFLAGS"
570      ac_save_LIBS="$LIBS"
571      CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
572      LIBS="$LIBS $GDK_PIXBUF_LIBS"
573dnl
574dnl Now check if the installed GDK_PIXBUF is sufficiently new. (Also sanity
575dnl checks the results of gdk-pixbuf-config to some extent
576dnl
577      rm -f conf.gdk_pixbuftest
578      AC_TRY_RUN([
579#include <stdio.h>
580#include <stdlib.h>
581#include <string.h>
582#include <gdk-pixbuf/gdk-pixbuf.h>
583
584char*
585my_strdup (char *str)
586{
587  char *new_str;
588 
589  if (str)
590    {
591      new_str = malloc ((strlen (str) + 1) * sizeof(char));
592      strcpy (new_str, str);
593    }
594  else
595    new_str = NULL;
596 
597  return new_str;
598}
599
600int main ()
601{
602  int major, minor, micro;
603  char *tmp_version;
604
605  system ("touch conf.gdk_pixbuftest");
606
607  /* HP/UX 9 (%@#!) writes to sscanf strings */
608  tmp_version = my_strdup("$min_gdk_pixbuf_version");
609  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
610     printf("%s, bad version string\n", "$min_gdk_pixbuf_version");
611     exit(1);
612   }
613
614   if (($gdk_pixbuf_major_version > major) ||
615      (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version > minor)) ||
616      (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version == minor) && ($gdk_pixbuf_micro_version >= micro)))
617    {
618      return 0;
619    }
620  else
621    {
622      printf("\n*** 'gdk-pixbuf-config --version' returned %d.%d.%d, but the minimum version\n", $gdk_pixbuf_major_version, $gdk_pixbuf_minor_version, $gdk_pixbuf_micro_version);
623      printf("*** of GDK_PIXBUF required is %d.%d.%d. If gdk-pixbuf-config is correct, then it is\n", major, minor, micro);
624      printf("*** best to upgrade to the required version.\n");
625      printf("*** If gdk-pixbuf-config was wrong, set the environment variable GDK_PIXBUF_CONFIG\n");
626      printf("*** to point to the correct copy of gdk-pixbuf-config, and remove the file\n");
627      printf("*** config.cache before re-running configure\n");
628      return 1;
629    }
630}
631
632],, no_gdk_pixbuf=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
633       CFLAGS="$ac_save_CFLAGS"
634       LIBS="$ac_save_LIBS"
635     fi
636  fi
637  if test "x$no_gdk_pixbuf" = x ; then
638     AC_MSG_RESULT(yes)
639     ifelse([$2], , :, [$2])     
640  else
641     AC_MSG_RESULT(no)
642     if test "$GDK_PIXBUF_CONFIG" = "no" ; then
643       echo "*** The gdk-pixbuf-config script installed by GDK_PIXBUF could not be found"
644       echo "*** If GDK_PIXBUF was installed in PREFIX, make sure PREFIX/bin is in"
645       echo "*** your path, or set the GDK_PIXBUF_CONFIG environment variable to the"
646       echo "*** full path to gdk-pixbuf-config."
647     else
648       if test -f conf.gdk_pixbuftest ; then
649        :
650       else
651          echo "*** Could not run GDK_PIXBUF test program, checking why..."
652          CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
653          LIBS="$LIBS $GDK_PIXBUF_LIBS"
654          AC_TRY_LINK([
655#include <stdio.h>
656#include <gdk-pixbuf/gdk-pixbuf.h>
657],      [ return 0; ],
658        [ echo "*** The test program compiled, but did not run. This usually means"
659          echo "*** that the run-time linker is not finding GDK_PIXBUF or finding the wrong"
660          echo "*** version of GDK_PIXBUF. If it is not finding GDK_PIXBUF, you'll need to set your"
661          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
662          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
663          echo "*** is required on your system"
664          echo "***"
665          echo "*** If you have an old version installed, it is best to remove it, although"
666          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
667        [ echo "*** The test program failed to compile or link. See the file config.log for the"
668          echo "*** exact error that occured. This usually means GDK_PIXBUF was incorrectly installed"
669          echo "*** or that you have moved GDK_PIXBUF since it was installed. In the latter case, you"
670          echo "*** may want to edit the gdk-pixbuf-config script: $GDK_PIXBUF_CONFIG" ])
671          CFLAGS="$ac_save_CFLAGS"
672          LIBS="$ac_save_LIBS"
673       fi
674     fi
675     GDK_PIXBUF_CFLAGS=""
676     GDK_PIXBUF_LIBS=""
677     ifelse([$3], , :, [$3])
678  fi
679  AC_SUBST(GDK_PIXBUF_CFLAGS)
680  AC_SUBST(GDK_PIXBUF_LIBS)
681  rm -f conf.gdk_pixbuftest
682])
683
Note: See TracBrowser for help on using the repository browser.