Removed autogenerated files which do not belong in the CVS tree.
[claws.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 # Do all the work for Automake.  This macro actually does too much --
14 # some checks are only needed if your package does certain things.
15 # But this isn't really a big deal.
16
17 # serial 1
18
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22 AC_DEFUN(AM_INIT_AUTOMAKE,
23 [AC_REQUIRE([AC_PROG_INSTALL])
24 PACKAGE=[$1]
25 AC_SUBST(PACKAGE)
26 VERSION=[$2]
27 AC_SUBST(VERSION)
28 dnl test to see if srcdir already configured
29 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
30   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
31 fi
32 ifelse([$3],,
33 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
34 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
35 AC_REQUIRE([AM_SANITY_CHECK])
36 AC_REQUIRE([AC_ARG_PROGRAM])
37 dnl FIXME This is truly gross.
38 missing_dir=`cd $ac_aux_dir && pwd`
39 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
40 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
41 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
42 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
43 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
44 AC_REQUIRE([AC_PROG_MAKE_SET])])
45
46 #
47 # Check to make sure that the build environment is sane.
48 #
49
50 AC_DEFUN(AM_SANITY_CHECK,
51 [AC_MSG_CHECKING([whether build environment is sane])
52 # Just in case
53 sleep 1
54 echo timestamp > conftestfile
55 # Do `set' in a subshell so we don't clobber the current shell's
56 # arguments.  Must try -L first in case configure is actually a
57 # symlink; some systems play weird games with the mod time of symlinks
58 # (eg FreeBSD returns the mod time of the symlink's containing
59 # directory).
60 if (
61    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
62    if test "[$]*" = "X"; then
63       # -L didn't work.
64       set X `ls -t $srcdir/configure conftestfile`
65    fi
66    if test "[$]*" != "X $srcdir/configure conftestfile" \
67       && test "[$]*" != "X conftestfile $srcdir/configure"; then
68
69       # If neither matched, then we have a broken ls.  This can happen
70       # if, for instance, CONFIG_SHELL is bash and it inherits a
71       # broken ls alias from the environment.  This has actually
72       # happened.  Such a system could not be considered "sane".
73       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
74 alias in your environment])
75    fi
76
77    test "[$]2" = conftestfile
78    )
79 then
80    # Ok.
81    :
82 else
83    AC_MSG_ERROR([newly created file is older than distributed files!
84 Check your system clock])
85 fi
86 rm -f conftest*
87 AC_MSG_RESULT(yes)])
88
89 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
90 dnl The program must properly implement --version.
91 AC_DEFUN(AM_MISSING_PROG,
92 [AC_MSG_CHECKING(for working $2)
93 # Run test in a subshell; some versions of sh will print an error if
94 # an executable is not found, even if stderr is redirected.
95 # Redirect stdin to placate older versions of autoconf.  Sigh.
96 if ($2 --version) < /dev/null > /dev/null 2>&1; then
97    $1=$2
98    AC_MSG_RESULT(found)
99 else
100    $1="$3/missing $2"
101    AC_MSG_RESULT(missing)
102 fi
103 AC_SUBST($1)])
104
105 # Like AC_CONFIG_HEADER, but automatically create stamp file.
106
107 AC_DEFUN(AM_CONFIG_HEADER,
108 [AC_PREREQ([2.12])
109 AC_CONFIG_HEADER([$1])
110 dnl When config.status generates a header, we must update the stamp-h file.
111 dnl This file resides in the same directory as the config header
112 dnl that is generated.  We must strip everything past the first ":",
113 dnl and everything past the last "/".
114 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
115 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
116 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
117 <<am_indx=1
118 for am_file in <<$1>>; do
119   case " <<$>>CONFIG_HEADERS " in
120   *" <<$>>am_file "*<<)>>
121     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
122     ;;
123   esac
124   am_indx=`expr "<<$>>am_indx" + 1`
125 done<<>>dnl>>)
126 changequote([,]))])
127
128
129 # serial 40 AC_PROG_LIBTOOL
130 AC_DEFUN(AC_PROG_LIBTOOL,
131 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
132
133 # Save cache, so that ltconfig can load it
134 AC_CACHE_SAVE
135
136 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
137 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
138 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
139 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
140 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
141 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
142 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
143 || AC_MSG_ERROR([libtool configure failed])
144
145 # Reload cache, that may have been modified by ltconfig
146 AC_CACHE_LOAD
147
148 # This can be used to rebuild libtool when needed
149 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
150
151 # Always use our own libtool.
152 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
153 AC_SUBST(LIBTOOL)dnl
154
155 # Redirect the config.log output again, so that the ltconfig log is not
156 # clobbered by the next message.
157 exec 5>>./config.log
158 ])
159
160 AC_DEFUN(AC_LIBTOOL_SETUP,
161 [AC_PREREQ(2.13)dnl
162 AC_REQUIRE([AC_ENABLE_SHARED])dnl
163 AC_REQUIRE([AC_ENABLE_STATIC])dnl
164 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
165 AC_REQUIRE([AC_CANONICAL_HOST])dnl
166 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
167 AC_REQUIRE([AC_PROG_RANLIB])dnl
168 AC_REQUIRE([AC_PROG_CC])dnl
169 AC_REQUIRE([AC_PROG_LD])dnl
170 AC_REQUIRE([AC_PROG_NM])dnl
171 AC_REQUIRE([AC_PROG_LN_S])dnl
172 dnl
173
174 case "$target" in
175 NONE) lt_target="$host" ;;
176 *) lt_target="$target" ;;
177 esac
178
179 # Check for any special flags to pass to ltconfig.
180 libtool_flags="--cache-file=$cache_file"
181 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
182 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
183 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
184 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
185 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
186 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
187 [libtool_flags="$libtool_flags --enable-dlopen"])
188 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
189 [libtool_flags="$libtool_flags --enable-win32-dll"])
190 AC_ARG_ENABLE(libtool-lock,
191   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
192 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
193 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
194
195 # Some flags need to be propagated to the compiler or linker for good
196 # libtool support.
197 case "$lt_target" in
198 *-*-irix6*)
199   # Find out which ABI we are using.
200   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
201   if AC_TRY_EVAL(ac_compile); then
202     case "`/usr/bin/file conftest.o`" in
203     *32-bit*)
204       LD="${LD-ld} -32"
205       ;;
206     *N32*)
207       LD="${LD-ld} -n32"
208       ;;
209     *64-bit*)
210       LD="${LD-ld} -64"
211       ;;
212     esac
213   fi
214   rm -rf conftest*
215   ;;
216
217 *-*-sco3.2v5*)
218   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
219   SAVE_CFLAGS="$CFLAGS"
220   CFLAGS="$CFLAGS -belf"
221   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
222     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
223   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
224     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
225     CFLAGS="$SAVE_CFLAGS"
226   fi
227   ;;
228
229 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
230 [*-*-cygwin* | *-*-mingw*)
231   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
232   AC_CHECK_TOOL(AS, as, false)
233   AC_CHECK_TOOL(OBJDUMP, objdump, false)
234   ;;
235 ])
236 esac
237 ])
238
239 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
240 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
241
242 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
243 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
244
245 # AC_ENABLE_SHARED - implement the --enable-shared flag
246 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
247 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
248 #   `yes'.
249 AC_DEFUN(AC_ENABLE_SHARED, [dnl
250 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
251 AC_ARG_ENABLE(shared,
252 changequote(<<, >>)dnl
253 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
254 changequote([, ])dnl
255 [p=${PACKAGE-default}
256 case "$enableval" in
257 yes) enable_shared=yes ;;
258 no) enable_shared=no ;;
259 *)
260   enable_shared=no
261   # Look at the argument we got.  We use all the common list separators.
262   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
263   for pkg in $enableval; do
264     if test "X$pkg" = "X$p"; then
265       enable_shared=yes
266     fi
267   done
268   IFS="$ac_save_ifs"
269   ;;
270 esac],
271 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
272 ])
273
274 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
275 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
276 AC_ENABLE_SHARED(no)])
277
278 # AC_ENABLE_STATIC - implement the --enable-static flag
279 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
280 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
281 #   `yes'.
282 AC_DEFUN(AC_ENABLE_STATIC, [dnl
283 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
284 AC_ARG_ENABLE(static,
285 changequote(<<, >>)dnl
286 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
287 changequote([, ])dnl
288 [p=${PACKAGE-default}
289 case "$enableval" in
290 yes) enable_static=yes ;;
291 no) enable_static=no ;;
292 *)
293   enable_static=no
294   # Look at the argument we got.  We use all the common list separators.
295   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
296   for pkg in $enableval; do
297     if test "X$pkg" = "X$p"; then
298       enable_static=yes
299     fi
300   done
301   IFS="$ac_save_ifs"
302   ;;
303 esac],
304 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
305 ])
306
307 # AC_DISABLE_STATIC - set the default static flag to --disable-static
308 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
309 AC_ENABLE_STATIC(no)])
310
311
312 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
313 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
314 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
315 #   `yes'.
316 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
317 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
318 AC_ARG_ENABLE(fast-install,
319 changequote(<<, >>)dnl
320 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
321 changequote([, ])dnl
322 [p=${PACKAGE-default}
323 case "$enableval" in
324 yes) enable_fast_install=yes ;;
325 no) enable_fast_install=no ;;
326 *)
327   enable_fast_install=no
328   # Look at the argument we got.  We use all the common list separators.
329   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
330   for pkg in $enableval; do
331     if test "X$pkg" = "X$p"; then
332       enable_fast_install=yes
333     fi
334   done
335   IFS="$ac_save_ifs"
336   ;;
337 esac],
338 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
339 ])
340
341 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
342 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
343 AC_ENABLE_FAST_INSTALL(no)])
344
345 # AC_PROG_LD - find the path to the GNU or non-GNU linker
346 AC_DEFUN(AC_PROG_LD,
347 [AC_ARG_WITH(gnu-ld,
348 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
349 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
350 AC_REQUIRE([AC_PROG_CC])dnl
351 AC_REQUIRE([AC_CANONICAL_HOST])dnl
352 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
353 ac_prog=ld
354 if test "$ac_cv_prog_gcc" = yes; then
355   # Check if gcc -print-prog-name=ld gives a path.
356   AC_MSG_CHECKING([for ld used by GCC])
357   ac_prog=`($CC -print-prog-name=ld) 2>&5`
358   case "$ac_prog" in
359     # Accept absolute paths.
360 changequote(,)dnl
361     [\\/]* | [A-Za-z]:[\\/]*)
362       re_direlt='/[^/][^/]*/\.\./'
363 changequote([,])dnl
364       # Canonicalize the path of ld
365       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
366       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
367         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
368       done
369       test -z "$LD" && LD="$ac_prog"
370       ;;
371   "")
372     # If it fails, then pretend we aren't using GCC.
373     ac_prog=ld
374     ;;
375   *)
376     # If it is relative, then search for the first ld in PATH.
377     with_gnu_ld=unknown
378     ;;
379   esac
380 elif test "$with_gnu_ld" = yes; then
381   AC_MSG_CHECKING([for GNU ld])
382 else
383   AC_MSG_CHECKING([for non-GNU ld])
384 fi
385 AC_CACHE_VAL(ac_cv_path_LD,
386 [if test -z "$LD"; then
387   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
388   for ac_dir in $PATH; do
389     test -z "$ac_dir" && ac_dir=.
390     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
391       ac_cv_path_LD="$ac_dir/$ac_prog"
392       # Check to see if the program is GNU ld.  I'd rather use --version,
393       # but apparently some GNU ld's only accept -v.
394       # Break only if it was the GNU/non-GNU ld that we prefer.
395       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
396         test "$with_gnu_ld" != no && break
397       else
398         test "$with_gnu_ld" != yes && break
399       fi
400     fi
401   done
402   IFS="$ac_save_ifs"
403 else
404   ac_cv_path_LD="$LD" # Let the user override the test with a path.
405 fi])
406 LD="$ac_cv_path_LD"
407 if test -n "$LD"; then
408   AC_MSG_RESULT($LD)
409 else
410   AC_MSG_RESULT(no)
411 fi
412 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
413 AC_PROG_LD_GNU
414 ])
415
416 AC_DEFUN(AC_PROG_LD_GNU,
417 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
418 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
419 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
420   ac_cv_prog_gnu_ld=yes
421 else
422   ac_cv_prog_gnu_ld=no
423 fi])
424 ])
425
426 # AC_PROG_NM - find the path to a BSD-compatible name lister
427 AC_DEFUN(AC_PROG_NM,
428 [AC_MSG_CHECKING([for BSD-compatible nm])
429 AC_CACHE_VAL(ac_cv_path_NM,
430 [if test -n "$NM"; then
431   # Let the user override the test.
432   ac_cv_path_NM="$NM"
433 else
434   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
435   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
436     test -z "$ac_dir" && ac_dir=.
437     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
438       # Check to see if the nm accepts a BSD-compat flag.
439       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
440       #   nm: unknown option "B" ignored
441       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
442         ac_cv_path_NM="$ac_dir/nm -B"
443         break
444       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
445         ac_cv_path_NM="$ac_dir/nm -p"
446         break
447       else
448         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
449         continue # so that we can try to find one that supports BSD flags
450       fi
451     fi
452   done
453   IFS="$ac_save_ifs"
454   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
455 fi])
456 NM="$ac_cv_path_NM"
457 AC_MSG_RESULT([$NM])
458 ])
459
460 # AC_CHECK_LIBM - check for math library
461 AC_DEFUN(AC_CHECK_LIBM,
462 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
463 LIBM=
464 case "$lt_target" in
465 *-*-beos* | *-*-cygwin*)
466   # These system don't have libm
467   ;;
468 *-ncr-sysv4.3*)
469   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
470   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
471   ;;
472 *)
473   AC_CHECK_LIB(m, main, LIBM="-lm")
474   ;;
475 esac
476 ])
477
478 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
479 # the libltdl convenience library and INCLTDL to the include flags for
480 # the libltdl header and adds --enable-ltdl-convenience to the
481 # configure arguments.  Note that LIBLTDL and INCLTDL are not
482 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
483 # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
484 # with '${top_builddir}/' and INCLTDL will be prefixed with
485 # '${top_srcdir}/' (note the single quotes!).  If your package is not
486 # flat and you're not using automake, define top_builddir and
487 # top_srcdir appropriately in the Makefiles.
488 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
489   case "$enable_ltdl_convenience" in
490   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
491   "") enable_ltdl_convenience=yes
492       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
493   esac
494   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
495   INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
496 ])
497
498 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
499 # the libltdl installable library and INCLTDL to the include flags for
500 # the libltdl header and adds --enable-ltdl-install to the configure
501 # arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
502 # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
503 # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
504 # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
505 # with '${top_srcdir}/' (note the single quotes!).  If your package is
506 # not flat and you're not using automake, define top_builddir and
507 # top_srcdir appropriately in the Makefiles.
508 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
509 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
510   AC_CHECK_LIB(ltdl, main,
511   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
512   [if test x"$enable_ltdl_install" = xno; then
513      AC_MSG_WARN([libltdl not installed, but installation disabled])
514    else
515      enable_ltdl_install=yes
516    fi
517   ])
518   if test x"$enable_ltdl_install" = x"yes"; then
519     ac_configure_args="$ac_configure_args --enable-ltdl-install"
520     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
521     INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
522   else
523     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
524     LIBLTDL="-lltdl"
525     INCLTDL=
526   fi
527 ])
528
529 dnl old names
530 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
531 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
532 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
533 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
534 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
535 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
536 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
537
538 dnl This is just to silence aclocal about the macro not being used
539 ifelse([AC_DISABLE_FAST_INSTALL])dnl
540
541 # Add --enable-maintainer-mode option to configure.
542 # From Jim Meyering
543
544 # serial 1
545
546 AC_DEFUN(AM_MAINTAINER_MODE,
547 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
548   dnl maintainer-mode is disabled by default
549   AC_ARG_ENABLE(maintainer-mode,
550 [  --enable-maintainer-mode enable make rules and dependencies not useful
551                           (and sometimes confusing) to the casual installer],
552       USE_MAINTAINER_MODE=$enableval,
553       USE_MAINTAINER_MODE=no)
554   AC_MSG_RESULT($USE_MAINTAINER_MODE)
555   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
556   MAINT=$MAINTAINER_MODE_TRUE
557   AC_SUBST(MAINT)dnl
558 ]
559 )
560
561 # Define a conditional.
562
563 AC_DEFUN(AM_CONDITIONAL,
564 [AC_SUBST($1_TRUE)
565 AC_SUBST($1_FALSE)
566 if $2; then
567   $1_TRUE=
568   $1_FALSE='#'
569 else
570   $1_TRUE='#'
571   $1_FALSE=
572 fi])
573
574
575 # serial 1
576
577 # @defmac AC_PROG_CC_STDC
578 # @maindex PROG_CC_STDC
579 # @ovindex CC
580 # If the C compiler in not in ANSI C mode by default, try to add an option
581 # to output variable @code{CC} to make it so.  This macro tries various
582 # options that select ANSI C on some system or another.  It considers the
583 # compiler to be in ANSI C mode if it handles function prototypes correctly.
584 #
585 # If you use this macro, you should check after calling it whether the C
586 # compiler has been set to accept ANSI C; if not, the shell variable
587 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
588 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
589 # program @code{ansi2knr}, which comes with Ghostscript.
590 # @end defmac
591
592 AC_DEFUN(AM_PROG_CC_STDC,
593 [AC_REQUIRE([AC_PROG_CC])
594 AC_BEFORE([$0], [AC_C_INLINE])
595 AC_BEFORE([$0], [AC_C_CONST])
596 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
597 dnl a magic option to avoid problems with ANSI preprocessor commands
598 dnl like #elif.
599 dnl FIXME: can't do this because then AC_AIX won't work due to a
600 dnl circular dependency.
601 dnl AC_BEFORE([$0], [AC_PROG_CPP])
602 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
603 AC_CACHE_VAL(am_cv_prog_cc_stdc,
604 [am_cv_prog_cc_stdc=no
605 ac_save_CC="$CC"
606 # Don't try gcc -ansi; that turns off useful extensions and
607 # breaks some systems' header files.
608 # AIX                   -qlanglvl=ansi
609 # Ultrix and OSF/1      -std1
610 # HP-UX                 -Aa -D_HPUX_SOURCE
611 # SVR4                  -Xc -D__EXTENSIONS__
612 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
613 do
614   CC="$ac_save_CC $ac_arg"
615   AC_TRY_COMPILE(
616 [#include <stdarg.h>
617 #include <stdio.h>
618 #include <sys/types.h>
619 #include <sys/stat.h>
620 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
621 struct buf { int x; };
622 FILE * (*rcsopen) (struct buf *, struct stat *, int);
623 static char *e (p, i)
624      char **p;
625      int i;
626 {
627   return p[i];
628 }
629 static char *f (char * (*g) (char **, int), char **p, ...)
630 {
631   char *s;
632   va_list v;
633   va_start (v,p);
634   s = g (p, va_arg (v,int));
635   va_end (v);
636   return s;
637 }
638 int test (int i, double x);
639 struct s1 {int (*f) (int a);};
640 struct s2 {int (*f) (double a);};
641 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
642 int argc;
643 char **argv;
644 ], [
645 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
646 ],
647 [am_cv_prog_cc_stdc="$ac_arg"; break])
648 done
649 CC="$ac_save_CC"
650 ])
651 if test -z "$am_cv_prog_cc_stdc"; then
652   AC_MSG_RESULT([none needed])
653 else
654   AC_MSG_RESULT($am_cv_prog_cc_stdc)
655 fi
656 case "x$am_cv_prog_cc_stdc" in
657   x|xno) ;;
658   *) CC="$CC $am_cv_prog_cc_stdc" ;;
659 esac
660 ])
661
662 # aclocal-include.m4
663 #
664 # This macro adds the name macrodir to the set of directories
665 # that `aclocal' searches for macros.
666
667 dnl SYLPHEED_ACLOCAL_INCLUDE(macrodir)
668 AC_DEFUN([SYLPHEED_ACLOCAL_INCLUDE],
669 [
670         test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
671
672         for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
673 ])
674
675 # Macro to add for using GNU gettext.
676 # Ulrich Drepper <drepper@cygnus.com>, 1995.
677 #
678 # This file can be copied and used freely without restrictions.  It can
679 # be used in projects which are not available under the GNU Public License
680 # but which still want to provide support for the GNU gettext functionality.
681 # Please note that the actual code is *not* freely available.
682
683 # serial 5
684
685 AC_DEFUN(AM_WITH_NLS,
686   [AC_MSG_CHECKING([whether NLS is requested])
687     dnl Default is enabled NLS
688     AC_ARG_ENABLE(nls,
689       [  --disable-nls           do not use Native Language Support],
690       USE_NLS=$enableval, USE_NLS=yes)
691     AC_MSG_RESULT($USE_NLS)
692     AC_SUBST(USE_NLS)
693
694     USE_INCLUDED_LIBINTL=no
695
696     dnl If we use NLS figure out what method
697     if test "$USE_NLS" = "yes"; then
698       AC_DEFINE(ENABLE_NLS)
699       AC_MSG_CHECKING([whether included gettext is requested])
700       AC_ARG_WITH(included-gettext,
701         [  --with-included-gettext use the GNU gettext library included here],
702         nls_cv_force_use_gnu_gettext=$withval,
703         nls_cv_force_use_gnu_gettext=no)
704       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
705
706       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
707       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
708         dnl User does not insist on using GNU NLS library.  Figure out what
709         dnl to use.  If gettext or catgets are available (in this order) we
710         dnl use this.  Else we have to fall back to GNU NLS library.
711         dnl catgets is only used if permitted by option --with-catgets.
712         nls_cv_header_intl=
713         nls_cv_header_libgt=
714         CATOBJEXT=NONE
715
716         AC_CHECK_HEADER(libintl.h,
717           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
718             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
719                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
720
721            if test "$gt_cv_func_gettext_libc" != "yes"; then
722              AC_CHECK_LIB(intl, bindtextdomain,
723                [AC_CACHE_CHECK([for gettext in libintl],
724                  gt_cv_func_gettext_libintl,
725                  [AC_CHECK_LIB(intl, gettext,
726                   gt_cv_func_gettext_libintl=yes,
727                   gt_cv_func_gettext_libintl=no)],
728                  gt_cv_func_gettext_libintl=no)])
729            fi
730
731            if test "$gt_cv_func_gettext_libc" = "yes" \
732               || test "$gt_cv_func_gettext_libintl" = "yes"; then
733               AC_DEFINE(HAVE_GETTEXT)
734               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
735                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
736               if test "$MSGFMT" != "no"; then
737                 AC_CHECK_FUNCS(dcgettext)
738                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
739                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
740                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
741                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
742                                return _nl_msg_cat_cntr],
743                   [CATOBJEXT=.gmo
744                    DATADIRNAME=share],
745                   [CATOBJEXT=.mo
746                    DATADIRNAME=lib])
747                 INSTOBJEXT=.mo
748               fi
749             fi
750         ])
751
752         if test "$CATOBJEXT" = "NONE"; then
753           AC_MSG_CHECKING([whether catgets can be used])
754           AC_ARG_WITH(catgets,
755             [  --with-catgets          use catgets functions if available],
756             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
757           AC_MSG_RESULT($nls_cv_use_catgets)
758
759           if test "$nls_cv_use_catgets" = "yes"; then
760             dnl No gettext in C library.  Try catgets next.
761             AC_CHECK_LIB(i, main)
762             AC_CHECK_FUNC(catgets,
763               [AC_DEFINE(HAVE_CATGETS)
764                INTLOBJS="\$(CATOBJS)"
765                AC_PATH_PROG(GENCAT, gencat, no)dnl
766                if test "$GENCAT" != "no"; then
767                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
768                  if test "$GMSGFMT" = "no"; then
769                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
770                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
771                  fi
772                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
773                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
774                  USE_INCLUDED_LIBINTL=yes
775                  CATOBJEXT=.cat
776                  INSTOBJEXT=.cat
777                  DATADIRNAME=lib
778                  INTLDEPS='$(top_builddir)/intl/libintl.a'
779                  INTLLIBS=$INTLDEPS
780                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
781                  nls_cv_header_intl=intl/libintl.h
782                  nls_cv_header_libgt=intl/libgettext.h
783                fi])
784           fi
785         fi
786
787         if test "$CATOBJEXT" = "NONE"; then
788           dnl Neither gettext nor catgets in included in the C library.
789           dnl Fall back on GNU gettext library.
790           nls_cv_use_gnu_gettext=yes
791         fi
792       fi
793
794       if test "$nls_cv_use_gnu_gettext" = "yes"; then
795         dnl Mark actions used to generate GNU NLS library.
796         INTLOBJS="\$(GETTOBJS)"
797         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
798           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
799         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
800         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
801           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
802         AC_SUBST(MSGFMT)
803         USE_INCLUDED_LIBINTL=yes
804         CATOBJEXT=.gmo
805         INSTOBJEXT=.mo
806         DATADIRNAME=share
807         INTLDEPS='$(top_builddir)/intl/libintl.a'
808         INTLLIBS=$INTLDEPS
809         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
810         nls_cv_header_intl=intl/libintl.h
811         nls_cv_header_libgt=intl/libgettext.h
812       fi
813
814       dnl Test whether we really found GNU xgettext.
815       if test "$XGETTEXT" != ":"; then
816         dnl If it is no GNU xgettext we define it as : so that the
817         dnl Makefiles still can work.
818         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
819           : ;
820         else
821           AC_MSG_RESULT(
822             [found xgettext program is not GNU xgettext; ignore it])
823           XGETTEXT=":"
824         fi
825       fi
826
827       # We need to process the po/ directory.
828       POSUB=po
829     else
830       DATADIRNAME=share
831       nls_cv_header_intl=intl/libintl.h
832       nls_cv_header_libgt=intl/libgettext.h
833     fi
834     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
835     AC_OUTPUT_COMMANDS(
836      [case "$CONFIG_FILES" in *po/Makefile.in*)
837         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
838       esac])
839
840
841     # If this is used in GNU gettext we have to set USE_NLS to `yes'
842     # because some of the sources are only built for this goal.
843     if test "$PACKAGE" = gettext; then
844       USE_NLS=yes
845       USE_INCLUDED_LIBINTL=yes
846     fi
847
848     dnl These rules are solely for the distribution goal.  While doing this
849     dnl we only have to keep exactly one list of the available catalogs
850     dnl in configure.in.
851     for lang in $ALL_LINGUAS; do
852       GMOFILES="$GMOFILES $lang.gmo"
853       POFILES="$POFILES $lang.po"
854     done
855
856     dnl Make all variables we use known to autoconf.
857     AC_SUBST(USE_INCLUDED_LIBINTL)
858     AC_SUBST(CATALOGS)
859     AC_SUBST(CATOBJEXT)
860     AC_SUBST(DATADIRNAME)
861     AC_SUBST(GMOFILES)
862     AC_SUBST(INSTOBJEXT)
863     AC_SUBST(INTLDEPS)
864     AC_SUBST(INTLLIBS)
865     AC_SUBST(INTLOBJS)
866     AC_SUBST(POFILES)
867     AC_SUBST(POSUB)
868   ])
869
870 AC_DEFUN(AM_GNU_GETTEXT,
871   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
872    AC_REQUIRE([AC_PROG_CC])dnl
873    AC_REQUIRE([AC_PROG_RANLIB])dnl
874    AC_REQUIRE([AC_ISC_POSIX])dnl
875    AC_REQUIRE([AC_HEADER_STDC])dnl
876    AC_REQUIRE([AC_C_CONST])dnl
877    AC_REQUIRE([AC_C_INLINE])dnl
878    AC_REQUIRE([AC_TYPE_OFF_T])dnl
879    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
880    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
881    AC_REQUIRE([AC_FUNC_MMAP])dnl
882
883    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
884 unistd.h sys/param.h])
885    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
886 strdup __argz_count __argz_stringify __argz_next])
887
888    if test "${ac_cv_func_stpcpy+set}" != "set"; then
889      AC_CHECK_FUNCS(stpcpy)
890    fi
891    if test "${ac_cv_func_stpcpy}" = "yes"; then
892      AC_DEFINE(HAVE_STPCPY)
893    fi
894
895    AM_LC_MESSAGES
896    AM_WITH_NLS
897
898    if test "x$CATOBJEXT" != "x"; then
899      if test "x$ALL_LINGUAS" = "x"; then
900        LINGUAS=
901      else
902        AC_MSG_CHECKING(for catalogs to be installed)
903        NEW_LINGUAS=
904        for lang in ${LINGUAS=$ALL_LINGUAS}; do
905          case "$ALL_LINGUAS" in
906           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
907          esac
908        done
909        LINGUAS=$NEW_LINGUAS
910        AC_MSG_RESULT($LINGUAS)
911      fi
912
913      dnl Construct list of names of catalog files to be constructed.
914      if test -n "$LINGUAS"; then
915        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
916      fi
917    fi
918
919    dnl The reference to <locale.h> in the installed <libintl.h> file
920    dnl must be resolved because we cannot expect the users of this
921    dnl to define HAVE_LOCALE_H.
922    if test $ac_cv_header_locale_h = yes; then
923      INCLUDE_LOCALE_H="#include <locale.h>"
924    else
925      INCLUDE_LOCALE_H="\
926 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
927    fi
928    AC_SUBST(INCLUDE_LOCALE_H)
929
930    dnl Determine which catalog format we have (if any is needed)
931    dnl For now we know about two different formats:
932    dnl   Linux libc-5 and the normal X/Open format
933    test -d intl || mkdir intl
934    if test "$CATOBJEXT" = ".cat"; then
935      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
936
937      dnl Transform the SED scripts while copying because some dumb SEDs
938      dnl cannot handle comments.
939      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
940    fi
941    dnl po2tbl.sed is always needed.
942    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
943      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
944
945    dnl In the intl/Makefile.in we have a special dependency which makes
946    dnl only sense for gettext.  We comment this out for non-gettext
947    dnl packages.
948    if test "$PACKAGE" = "gettext"; then
949      GT_NO="#NO#"
950      GT_YES=
951    else
952      GT_NO=
953      GT_YES="#YES#"
954    fi
955    AC_SUBST(GT_NO)
956    AC_SUBST(GT_YES)
957
958    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
959    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
960    dnl Try to locate is.
961    MKINSTALLDIRS=
962    if test -n "$ac_aux_dir"; then
963      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
964    fi
965    if test -z "$MKINSTALLDIRS"; then
966      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
967    fi
968    AC_SUBST(MKINSTALLDIRS)
969
970    dnl *** For now the libtool support in intl/Makefile is not for real.
971    l=
972    AC_SUBST(l)
973
974    dnl Generate list of files to be processed by xgettext which will
975    dnl be included in po/Makefile.
976    test -d po || mkdir po
977    if test "x$srcdir" != "x."; then
978      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
979        posrcprefix="$srcdir/"
980      else
981        posrcprefix="../$srcdir/"
982      fi
983    else
984      posrcprefix="../"
985    fi
986    rm -f po/POTFILES
987    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
988         < $srcdir/po/POTFILES.in > po/POTFILES
989   ])
990
991 # Search path for a program which passes the given test.
992 # Ulrich Drepper <drepper@cygnus.com>, 1996.
993 #
994 # This file can be copied and used freely without restrictions.  It can
995 # be used in projects which are not available under the GNU Public License
996 # but which still want to provide support for the GNU gettext functionality.
997 # Please note that the actual code is *not* freely available.
998
999 # serial 1
1000
1001 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1002 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1003 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
1004 [# Extract the first word of "$2", so it can be a program name with args.
1005 set dummy $2; ac_word=[$]2
1006 AC_MSG_CHECKING([for $ac_word])
1007 AC_CACHE_VAL(ac_cv_path_$1,
1008 [case "[$]$1" in
1009   /*)
1010   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1011   ;;
1012   *)
1013   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1014   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1015     test -z "$ac_dir" && ac_dir=.
1016     if test -f $ac_dir/$ac_word; then
1017       if [$3]; then
1018         ac_cv_path_$1="$ac_dir/$ac_word"
1019         break
1020       fi
1021     fi
1022   done
1023   IFS="$ac_save_ifs"
1024 dnl If no 4th arg is given, leave the cache variable unset,
1025 dnl so AC_PATH_PROGS will keep looking.
1026 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1027 ])dnl
1028   ;;
1029 esac])dnl
1030 $1="$ac_cv_path_$1"
1031 if test -n "[$]$1"; then
1032   AC_MSG_RESULT([$]$1)
1033 else
1034   AC_MSG_RESULT(no)
1035 fi
1036 AC_SUBST($1)dnl
1037 ])
1038
1039 # Check whether LC_MESSAGES is available in <locale.h>.
1040 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1041 #
1042 # This file can be copied and used freely without restrictions.  It can
1043 # be used in projects which are not available under the GNU Public License
1044 # but which still want to provide support for the GNU gettext functionality.
1045 # Please note that the actual code is *not* freely available.
1046
1047 # serial 1
1048
1049 AC_DEFUN(AM_LC_MESSAGES,
1050   [if test $ac_cv_header_locale_h = yes; then
1051     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1052       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1053        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1054     if test $am_cv_val_LC_MESSAGES = yes; then
1055       AC_DEFINE(HAVE_LC_MESSAGES)
1056     fi
1057   fi])
1058
1059 # Configure paths for GLIB
1060 # Owen Taylor     97-11-3
1061
1062 dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
1063 dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or 
1064 dnl gthread is specified in MODULES, pass to glib-config
1065 dnl
1066 AC_DEFUN(AM_PATH_GLIB,
1067 [dnl 
1068 dnl Get the cflags and libraries from the glib-config script
1069 dnl
1070 AC_ARG_WITH(glib-prefix,[  --with-glib-prefix=PFX   Prefix where GLIB is installed (optional)],
1071             glib_config_prefix="$withval", glib_config_prefix="")
1072 AC_ARG_WITH(glib-exec-prefix,[  --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
1073             glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
1074 AC_ARG_ENABLE(glibtest, [  --disable-glibtest       Do not try to compile and run a test GLIB program],
1075                     , enable_glibtest=yes)
1076
1077   if test x$glib_config_exec_prefix != x ; then
1078      glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
1079      if test x${GLIB_CONFIG+set} != xset ; then
1080         GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
1081      fi
1082   fi
1083   if test x$glib_config_prefix != x ; then
1084      glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
1085      if test x${GLIB_CONFIG+set} != xset ; then
1086         GLIB_CONFIG=$glib_config_prefix/bin/glib-config
1087      fi
1088   fi
1089
1090   for module in . $4
1091   do
1092       case "$module" in
1093          gmodule) 
1094              glib_config_args="$glib_config_args gmodule"
1095          ;;
1096          gthread) 
1097              glib_config_args="$glib_config_args gthread"
1098          ;;
1099       esac
1100   done
1101
1102   AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
1103   min_glib_version=ifelse([$1], ,0.99.7,$1)
1104   AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
1105   no_glib=""
1106   if test "$GLIB_CONFIG" = "no" ; then
1107     no_glib=yes
1108   else
1109     GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
1110     GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
1111     glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
1112            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1113     glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
1114            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1115     glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
1116            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1117     if test "x$enable_glibtest" = "xyes" ; then
1118       ac_save_CFLAGS="$CFLAGS"
1119       ac_save_LIBS="$LIBS"
1120       CFLAGS="$CFLAGS $GLIB_CFLAGS"
1121       LIBS="$GLIB_LIBS $LIBS"
1122 dnl
1123 dnl Now check if the installed GLIB is sufficiently new. (Also sanity
1124 dnl checks the results of glib-config to some extent
1125 dnl
1126       rm -f conf.glibtest
1127       AC_TRY_RUN([
1128 #include <glib.h>
1129 #include <stdio.h>
1130 #include <stdlib.h>
1131
1132 int 
1133 main ()
1134 {
1135   int major, minor, micro;
1136   char *tmp_version;
1137
1138   system ("touch conf.glibtest");
1139
1140   /* HP/UX 9 (%@#!) writes to sscanf strings */
1141   tmp_version = g_strdup("$min_glib_version");
1142   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1143      printf("%s, bad version string\n", "$min_glib_version");
1144      exit(1);
1145    }
1146
1147   if ((glib_major_version != $glib_config_major_version) ||
1148       (glib_minor_version != $glib_config_minor_version) ||
1149       (glib_micro_version != $glib_config_micro_version))
1150     {
1151       printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
1152              $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
1153              glib_major_version, glib_minor_version, glib_micro_version);
1154       printf ("*** was found! If glib-config was correct, then it is best\n");
1155       printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
1156       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1157       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1158       printf("*** required on your system.\n");
1159       printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
1160       printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
1161       printf("*** before re-running configure\n");
1162     } 
1163   else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
1164            (glib_minor_version != GLIB_MINOR_VERSION) ||
1165            (glib_micro_version != GLIB_MICRO_VERSION))
1166     {
1167       printf("*** GLIB header files (version %d.%d.%d) do not match\n",
1168              GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
1169       printf("*** library (version %d.%d.%d)\n",
1170              glib_major_version, glib_minor_version, glib_micro_version);
1171     }
1172   else
1173     {
1174       if ((glib_major_version > major) ||
1175         ((glib_major_version == major) && (glib_minor_version > minor)) ||
1176         ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
1177       {
1178         return 0;
1179        }
1180      else
1181       {
1182         printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
1183                glib_major_version, glib_minor_version, glib_micro_version);
1184         printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
1185                major, minor, micro);
1186         printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
1187         printf("***\n");
1188         printf("*** If you have already installed a sufficiently new version, this error\n");
1189         printf("*** probably means that the wrong copy of the glib-config shell script is\n");
1190         printf("*** being found. The easiest way to fix this is to remove the old version\n");
1191         printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
1192         printf("*** correct copy of glib-config. (In this case, you will have to\n");
1193         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1194         printf("*** so that the correct libraries are found at run-time))\n");
1195       }
1196     }
1197   return 1;
1198 }
1199 ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1200        CFLAGS="$ac_save_CFLAGS"
1201        LIBS="$ac_save_LIBS"
1202      fi
1203   fi
1204   if test "x$no_glib" = x ; then
1205      AC_MSG_RESULT(yes)
1206      ifelse([$2], , :, [$2])     
1207   else
1208      AC_MSG_RESULT(no)
1209      if test "$GLIB_CONFIG" = "no" ; then
1210        echo "*** The glib-config script installed by GLIB could not be found"
1211        echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
1212        echo "*** your path, or set the GLIB_CONFIG environment variable to the"
1213        echo "*** full path to glib-config."
1214      else
1215        if test -f conf.glibtest ; then
1216         :
1217        else
1218           echo "*** Could not run GLIB test program, checking why..."
1219           CFLAGS="$CFLAGS $GLIB_CFLAGS"
1220           LIBS="$LIBS $GLIB_LIBS"
1221           AC_TRY_LINK([
1222 #include <glib.h>
1223 #include <stdio.h>
1224 ],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
1225         [ echo "*** The test program compiled, but did not run. This usually means"
1226           echo "*** that the run-time linker is not finding GLIB or finding the wrong"
1227           echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
1228           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1229           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1230           echo "*** is required on your system"
1231           echo "***"
1232           echo "*** If you have an old version installed, it is best to remove it, although"
1233           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1234           echo "***"
1235           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
1236           echo "*** came with the system with the command"
1237           echo "***"
1238           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
1239         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1240           echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
1241           echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
1242           echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
1243           CFLAGS="$ac_save_CFLAGS"
1244           LIBS="$ac_save_LIBS"
1245        fi
1246      fi
1247      GLIB_CFLAGS=""
1248      GLIB_LIBS=""
1249      ifelse([$3], , :, [$3])
1250   fi
1251   AC_SUBST(GLIB_CFLAGS)
1252   AC_SUBST(GLIB_LIBS)
1253   rm -f conf.glibtest
1254 ])
1255
1256 # Configure paths for GTK+
1257 # Owen Taylor     97-11-3
1258
1259 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
1260 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
1261 dnl
1262 AC_DEFUN(AM_PATH_GTK,
1263 [dnl 
1264 dnl Get the cflags and libraries from the gtk-config script
1265 dnl
1266 AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
1267             gtk_config_prefix="$withval", gtk_config_prefix="")
1268 AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
1269             gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
1270 AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
1271                     , enable_gtktest=yes)
1272
1273   for module in . $4
1274   do
1275       case "$module" in
1276          gthread) 
1277              gtk_config_args="$gtk_config_args gthread"
1278          ;;
1279       esac
1280   done
1281
1282   if test x$gtk_config_exec_prefix != x ; then
1283      gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
1284      if test x${GTK_CONFIG+set} != xset ; then
1285         GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
1286      fi
1287   fi
1288   if test x$gtk_config_prefix != x ; then
1289      gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
1290      if test x${GTK_CONFIG+set} != xset ; then
1291         GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
1292      fi
1293   fi
1294
1295   AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
1296   min_gtk_version=ifelse([$1], ,0.99.7,$1)
1297   AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
1298   no_gtk=""
1299   if test "$GTK_CONFIG" = "no" ; then
1300     no_gtk=yes
1301   else
1302     GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
1303     GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
1304     gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
1305            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1306     gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
1307            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1308     gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
1309            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1310     if test "x$enable_gtktest" = "xyes" ; then
1311       ac_save_CFLAGS="$CFLAGS"
1312       ac_save_LIBS="$LIBS"
1313       CFLAGS="$CFLAGS $GTK_CFLAGS"
1314       LIBS="$GTK_LIBS $LIBS"
1315 dnl
1316 dnl Now check if the installed GTK is sufficiently new. (Also sanity
1317 dnl checks the results of gtk-config to some extent
1318 dnl
1319       rm -f conf.gtktest
1320       AC_TRY_RUN([
1321 #include <gtk/gtk.h>
1322 #include <stdio.h>
1323 #include <stdlib.h>
1324
1325 int 
1326 main ()
1327 {
1328   int major, minor, micro;
1329   char *tmp_version;
1330
1331   system ("touch conf.gtktest");
1332
1333   /* HP/UX 9 (%@#!) writes to sscanf strings */
1334   tmp_version = g_strdup("$min_gtk_version");
1335   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1336      printf("%s, bad version string\n", "$min_gtk_version");
1337      exit(1);
1338    }
1339
1340   if ((gtk_major_version != $gtk_config_major_version) ||
1341       (gtk_minor_version != $gtk_config_minor_version) ||
1342       (gtk_micro_version != $gtk_config_micro_version))
1343     {
1344       printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
1345              $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
1346              gtk_major_version, gtk_minor_version, gtk_micro_version);
1347       printf ("*** was found! If gtk-config was correct, then it is best\n");
1348       printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
1349       printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
1350       printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
1351       printf("*** required on your system.\n");
1352       printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
1353       printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
1354       printf("*** before re-running configure\n");
1355     } 
1356 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
1357   else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
1358            (gtk_minor_version != GTK_MINOR_VERSION) ||
1359            (gtk_micro_version != GTK_MICRO_VERSION))
1360     {
1361       printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
1362              GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
1363       printf("*** library (version %d.%d.%d)\n",
1364              gtk_major_version, gtk_minor_version, gtk_micro_version);
1365     }
1366 #endif /* defined (GTK_MAJOR_VERSION) ... */
1367   else
1368     {
1369       if ((gtk_major_version > major) ||
1370         ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
1371         ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
1372       {
1373         return 0;
1374        }
1375      else
1376       {
1377         printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
1378                gtk_major_version, gtk_minor_version, gtk_micro_version);
1379         printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
1380                major, minor, micro);
1381         printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
1382         printf("***\n");
1383         printf("*** If you have already installed a sufficiently new version, this error\n");
1384         printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
1385         printf("*** being found. The easiest way to fix this is to remove the old version\n");
1386         printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
1387         printf("*** correct copy of gtk-config. (In this case, you will have to\n");
1388         printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
1389         printf("*** so that the correct libraries are found at run-time))\n");
1390       }
1391     }
1392   return 1;
1393 }
1394 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1395        CFLAGS="$ac_save_CFLAGS"
1396        LIBS="$ac_save_LIBS"
1397      fi
1398   fi
1399   if test "x$no_gtk" = x ; then
1400      AC_MSG_RESULT(yes)
1401      ifelse([$2], , :, [$2])     
1402   else
1403      AC_MSG_RESULT(no)
1404      if test "$GTK_CONFIG" = "no" ; then
1405        echo "*** The gtk-config script installed by GTK could not be found"
1406        echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
1407        echo "*** your path, or set the GTK_CONFIG environment variable to the"
1408        echo "*** full path to gtk-config."
1409      else
1410        if test -f conf.gtktest ; then
1411         :
1412        else
1413           echo "*** Could not run GTK test program, checking why..."
1414           CFLAGS="$CFLAGS $GTK_CFLAGS"
1415           LIBS="$LIBS $GTK_LIBS"
1416           AC_TRY_LINK([
1417 #include <gtk/gtk.h>
1418 #include <stdio.h>
1419 ],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
1420         [ echo "*** The test program compiled, but did not run. This usually means"
1421           echo "*** that the run-time linker is not finding GTK or finding the wrong"
1422           echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
1423           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1424           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1425           echo "*** is required on your system"
1426           echo "***"
1427           echo "*** If you have an old version installed, it is best to remove it, although"
1428           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
1429           echo "***"
1430           echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
1431           echo "*** came with the system with the command"
1432           echo "***"
1433           echo "***    rpm --erase --nodeps gtk gtk-devel" ],
1434         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1435           echo "*** exact error that occured. This usually means GTK was incorrectly installed"
1436           echo "*** or that you have moved GTK since it was installed. In the latter case, you"
1437           echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
1438           CFLAGS="$ac_save_CFLAGS"
1439           LIBS="$ac_save_LIBS"
1440        fi
1441      fi
1442      GTK_CFLAGS=""
1443      GTK_LIBS=""
1444      ifelse([$3], , :, [$3])
1445   fi
1446   AC_SUBST(GTK_CFLAGS)
1447   AC_SUBST(GTK_LIBS)
1448   rm -f conf.gtktest
1449 ])
1450
1451 # Configure paths for gdk-pixbuf
1452 # Elliot Lee 2000-01-10
1453 # stolen from Raph Levien 98-11-18
1454 # stolen from Manish Singh    98-9-30
1455 # stolen back from Frank Belew
1456 # stolen from Manish Singh
1457 # Shamelessly stolen from Owen Taylor
1458
1459 dnl AM_PATH_GDK_PIXBUF([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1460 dnl Test for GDK_PIXBUF, and define GDK_PIXBUF_CFLAGS and GDK_PIXBUF_LIBS
1461 dnl
1462 AC_DEFUN(AM_PATH_GDK_PIXBUF,
1463 [dnl 
1464 dnl Get the cflags and libraries from the gdk-pixbuf-config script
1465 dnl
1466 AC_ARG_WITH(gdk-pixbuf-prefix,[  --with-gdk-pixbuf-prefix=PFX   Prefix where GDK_PIXBUF is installed (optional)],
1467             gdk_pixbuf_prefix="$withval", gdk_pixbuf_prefix="")
1468 AC_ARG_WITH(gdk-pixbuf-exec-prefix,[  --with-gdk-pixbuf-exec-prefix=PFX Exec prefix where GDK_PIXBUF is installed (optional)],
1469             gdk_pixbuf_exec_prefix="$withval", gdk_pixbuf_exec_prefix="")
1470 AC_ARG_ENABLE(gdk_pixbuftest, [  --disable-gdk_pixbuftest       Do not try to compile and run a test GDK_PIXBUF program],
1471                     , enable_gdk_pixbuftest=yes)
1472
1473   if test x$gdk_pixbuf_exec_prefix != x ; then
1474      gdk_pixbuf_args="$gdk_pixbuf_args --exec-prefix=$gdk_pixbuf_exec_prefix"
1475      if test x${GDK_PIXBUF_CONFIG+set} = xset ; then
1476         GDK_PIXBUF_CONFIG=$gdk_pixbuf_exec_prefix/gdk-pixbuf-config
1477      fi
1478   fi
1479   if test x$gdk_pixbuf_prefix != x ; then
1480      gdk_pixbuf_args="$gdk_pixbuf_args --prefix=$gdk_pixbuf_prefix"
1481      if test x${GDK_PIXBUF_CONFIG+set} = xset ; then
1482         GDK_PIXBUF_CONFIG=$gdk_pixbuf_prefix/bin/gdk-pixbuf-config
1483      fi
1484   fi
1485
1486   AC_PATH_PROG(GDK_PIXBUF_CONFIG, gdk-pixbuf-config, no)
1487   min_gdk_pixbuf_version=ifelse([$1], ,0.2.5,$1)
1488   AC_MSG_CHECKING(for GDK_PIXBUF - version >= $min_gdk_pixbuf_version)
1489   no_gdk_pixbuf=""
1490   if test "$GDK_PIXBUF_CONFIG" = "no" ; then
1491     no_gdk_pixbuf=yes
1492   else
1493     GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --cflags`
1494     GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --libs`
1495
1496     gdk_pixbuf_major_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
1497            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1498     gdk_pixbuf_minor_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
1499            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1500     gdk_pixbuf_micro_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_config_args --version | \
1501            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1502     if test "x$enable_gdk_pixbuftest" = "xyes" ; then
1503       ac_save_CFLAGS="$CFLAGS"
1504       ac_save_LIBS="$LIBS"
1505       CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
1506       LIBS="$LIBS $GDK_PIXBUF_LIBS"
1507 dnl
1508 dnl Now check if the installed GDK_PIXBUF is sufficiently new. (Also sanity
1509 dnl checks the results of gdk-pixbuf-config to some extent
1510 dnl
1511       rm -f conf.gdk_pixbuftest
1512       AC_TRY_RUN([
1513 #include <stdio.h>
1514 #include <stdlib.h>
1515 #include <string.h>
1516 #include <gdk-pixbuf/gdk-pixbuf.h>
1517
1518 char*
1519 my_strdup (char *str)
1520 {
1521   char *new_str;
1522   
1523   if (str)
1524     {
1525       new_str = malloc ((strlen (str) + 1) * sizeof(char));
1526       strcpy (new_str, str);
1527     }
1528   else
1529     new_str = NULL;
1530   
1531   return new_str;
1532 }
1533
1534 int main ()
1535 {
1536   int major, minor, micro;
1537   char *tmp_version;
1538
1539   system ("touch conf.gdk_pixbuftest");
1540
1541   /* HP/UX 9 (%@#!) writes to sscanf strings */
1542   tmp_version = my_strdup("$min_gdk_pixbuf_version");
1543   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1544      printf("%s, bad version string\n", "$min_gdk_pixbuf_version");
1545      exit(1);
1546    }
1547
1548    if (($gdk_pixbuf_major_version > major) ||
1549       (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version > minor)) ||
1550       (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version == minor) && ($gdk_pixbuf_micro_version >= micro)))
1551     {
1552       return 0;
1553     }
1554   else
1555     {
1556       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);
1557       printf("*** of GDK_PIXBUF required is %d.%d.%d. If gdk-pixbuf-config is correct, then it is\n", major, minor, micro);
1558       printf("*** best to upgrade to the required version.\n");
1559       printf("*** If gdk-pixbuf-config was wrong, set the environment variable GDK_PIXBUF_CONFIG\n");
1560       printf("*** to point to the correct copy of gdk-pixbuf-config, and remove the file\n");
1561       printf("*** config.cache before re-running configure\n");
1562       return 1;
1563     }
1564 }
1565
1566 ],, no_gdk_pixbuf=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1567        CFLAGS="$ac_save_CFLAGS"
1568        LIBS="$ac_save_LIBS"
1569      fi
1570   fi
1571   if test "x$no_gdk_pixbuf" = x ; then
1572      AC_MSG_RESULT(yes)
1573      ifelse([$2], , :, [$2])     
1574   else
1575      AC_MSG_RESULT(no)
1576      if test "$GDK_PIXBUF_CONFIG" = "no" ; then
1577        echo "*** The gdk-pixbuf-config script installed by GDK_PIXBUF could not be found"
1578        echo "*** If GDK_PIXBUF was installed in PREFIX, make sure PREFIX/bin is in"
1579        echo "*** your path, or set the GDK_PIXBUF_CONFIG environment variable to the"
1580        echo "*** full path to gdk-pixbuf-config."
1581      else
1582        if test -f conf.gdk_pixbuftest ; then
1583         :
1584        else
1585           echo "*** Could not run GDK_PIXBUF test program, checking why..."
1586           CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
1587           LIBS="$LIBS $GDK_PIXBUF_LIBS"
1588           AC_TRY_LINK([
1589 #include <stdio.h>
1590 #include <gdk-pixbuf/gdk-pixbuf.h>
1591 ],      [ return 0; ],
1592         [ echo "*** The test program compiled, but did not run. This usually means"
1593           echo "*** that the run-time linker is not finding GDK_PIXBUF or finding the wrong"
1594           echo "*** version of GDK_PIXBUF. If it is not finding GDK_PIXBUF, you'll need to set your"
1595           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1596           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1597           echo "*** is required on your system"
1598           echo "***"
1599           echo "*** If you have an old version installed, it is best to remove it, although"
1600           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1601         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1602           echo "*** exact error that occured. This usually means GDK_PIXBUF was incorrectly installed"
1603           echo "*** or that you have moved GDK_PIXBUF since it was installed. In the latter case, you"
1604           echo "*** may want to edit the gdk-pixbuf-config script: $GDK_PIXBUF_CONFIG" ])
1605           CFLAGS="$ac_save_CFLAGS"
1606           LIBS="$ac_save_LIBS"
1607        fi
1608      fi
1609      GDK_PIXBUF_CFLAGS=""
1610      GDK_PIXBUF_LIBS=""
1611      ifelse([$3], , :, [$3])
1612   fi
1613   AC_SUBST(GDK_PIXBUF_CFLAGS)
1614   AC_SUBST(GDK_PIXBUF_LIBS)
1615   rm -f conf.gdk_pixbuftest
1616 ])
1617
1618 # Configure paths for IMLIB
1619 # Frank Belew     98-8-31
1620 # stolen from Manish Singh
1621 # Shamelessly stolen from Owen Taylor
1622
1623 dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
1624 dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS
1625 dnl
1626 AC_DEFUN(AM_PATH_IMLIB,
1627 [dnl 
1628 dnl Get the cflags and libraries from the imlib-config script
1629 dnl
1630 AC_ARG_WITH(imlib-prefix,[  --with-imlib-prefix=PFX   Prefix where IMLIB is installed (optional)],
1631             imlib_prefix="$withval", imlib_prefix="")
1632 AC_ARG_WITH(imlib-exec-prefix,[  --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)],
1633             imlib_exec_prefix="$withval", imlib_exec_prefix="")
1634 AC_ARG_ENABLE(imlibtest, [  --disable-imlibtest       Do not try to compile and run a test IMLIB program],
1635                     , enable_imlibtest=yes)
1636
1637   if test x$imlib_exec_prefix != x ; then
1638      imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
1639      if test x${IMLIB_CONFIG+set} != xset ; then
1640         IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config
1641      fi
1642   fi
1643   if test x$imlib_prefix != x ; then
1644      imlib_args="$imlib_args --prefix=$imlib_prefix"
1645      if test x${IMLIB_CONFIG+set} != xset ; then
1646         IMLIB_CONFIG=$imlib_prefix/bin/imlib-config
1647      fi
1648   fi
1649
1650   AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no)
1651   min_imlib_version=ifelse([$1], ,1.8.2,$1)
1652   AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version)
1653   no_imlib=""
1654   if test "$IMLIB_CONFIG" = "no" ; then
1655     no_imlib=yes
1656   else
1657     IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags`
1658     IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs`
1659
1660     imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \
1661            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1662     imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \
1663            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1664     imlib_micro_version=`$IMLIB_CONFIG $imlib_args --version | \
1665            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
1666     if test "x$enable_imlibtest" = "xyes" ; then
1667       ac_save_CFLAGS="$CFLAGS"
1668       ac_save_LIBS="$LIBS"
1669       CFLAGS="$CFLAGS $IMLIB_CFLAGS"
1670       LIBS="$LIBS $IMLIB_LIBS"
1671 dnl
1672 dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
1673 dnl checks the results of imlib-config to some extent
1674 dnl
1675       rm -f conf.imlibtest
1676       AC_TRY_RUN([
1677 #include <stdio.h>
1678 #include <stdlib.h>
1679 #include <string.h>
1680 #include <Imlib.h>
1681
1682 char*
1683 my_strdup (char *str)
1684 {
1685   char *new_str;
1686   
1687   if (str)
1688     {
1689       new_str = malloc ((strlen (str) + 1) * sizeof(char));
1690       strcpy (new_str, str);
1691     }
1692   else
1693     new_str = NULL;
1694   
1695   return new_str;
1696 }
1697
1698 int main ()
1699 {
1700   int major, minor, micro;
1701   char *tmp_version;
1702
1703   system ("touch conf.imlibtest");
1704
1705   /* HP/UX 9 (%@#!) writes to sscanf strings */
1706   tmp_version = my_strdup("$min_imlib_version");
1707   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
1708      printf("%s, bad version string\n", "$min_imlib_version");
1709      exit(1);
1710    }
1711
1712     if (($imlib_major_version > major) ||
1713         (($imlib_major_version == major) && ($imlib_minor_version > minor)) ||
1714         (($imlib_major_version == major) && ($imlib_minor_version == minor) &&
1715         ($imlib_micro_version >= micro)))
1716     {
1717       return 0;
1718     }
1719   else
1720     {
1721       printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
1722       printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
1723       printf("*** best to upgrade to the required version.\n");
1724       printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n");
1725       printf("*** to point to the correct copy of imlib-config, and remove the file\n");
1726       printf("*** config.cache before re-running configure\n");
1727       return 1;
1728     }
1729 }
1730
1731 ],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1732        CFLAGS="$ac_save_CFLAGS"
1733        LIBS="$ac_save_LIBS"
1734      fi
1735   fi
1736   if test "x$no_imlib" = x ; then
1737      AC_MSG_RESULT(yes)
1738      ifelse([$2], , :, [$2])     
1739   else
1740      AC_MSG_RESULT(no)
1741      if test "$IMLIB_CONFIG" = "no" ; then
1742        echo "*** The imlib-config script installed by IMLIB could not be found"
1743        echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
1744        echo "*** your path, or set the IMLIB_CONFIG environment variable to the"
1745        echo "*** full path to imlib-config."
1746      else
1747        if test -f conf.imlibtest ; then
1748         :
1749        else
1750           echo "*** Could not run IMLIB test program, checking why..."
1751           CFLAGS="$CFLAGS $IMLIB_CFLAGS"
1752           LIBS="$LIBS $IMLIB_LIBS"
1753           AC_TRY_LINK([
1754 #include <stdio.h>
1755 #include <Imlib.h>
1756 ],      [ return 0; ],
1757         [ echo "*** The test program compiled, but did not run. This usually means"
1758           echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
1759           echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
1760           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1761           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1762           echo "*** is required on your system"
1763           echo "***"
1764           echo "*** If you have an old version installed, it is best to remove it, although"
1765           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1766         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1767           echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
1768           echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
1769           echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ])
1770           CFLAGS="$ac_save_CFLAGS"
1771           LIBS="$ac_save_LIBS"
1772        fi
1773      fi
1774      IMLIB_CFLAGS=""
1775      IMLIB_LIBS=""
1776      ifelse([$3], , :, [$3])
1777   fi
1778   AC_SUBST(IMLIB_CFLAGS)
1779   AC_SUBST(IMLIB_LIBS)
1780   rm -f conf.imlibtest
1781 ])
1782
1783 # Check for gdk-imlib
1784 AC_DEFUN(AM_PATH_GDK_IMLIB,
1785 [dnl 
1786 dnl Get the cflags and libraries from the imlib-config script
1787 dnl
1788 AC_ARG_WITH(imlib-prefix,[  --with-imlib-prefix=PFX   Prefix where IMLIB is installed (optional)],
1789             imlib_prefix="$withval", imlib_prefix="")
1790 AC_ARG_WITH(imlib-exec-prefix,[  --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)],
1791             imlib_exec_prefix="$withval", imlib_exec_prefix="")
1792 AC_ARG_ENABLE(imlibtest, [  --disable-imlibtest       Do not try to compile and run a test IMLIB program],
1793                     , enable_imlibtest=yes)
1794
1795   if test x$imlib_exec_prefix != x ; then
1796      imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
1797      if test x${IMLIB_CONFIG+set} != xset ; then
1798         IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config
1799      fi
1800   fi
1801   if test x$imlib_prefix != x ; then
1802      imlib_args="$imlib_args --prefix=$imlib_prefix"
1803      if test x${IMLIB_CONFIG+set} != xset ; then
1804         IMLIB_CONFIG=$imlib_prefix/bin/imlib-config
1805      fi
1806   fi
1807
1808   AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no)
1809   min_imlib_version=ifelse([$1], ,1.8.2,$1)
1810   AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version)
1811   no_imlib=""
1812   if test "$IMLIB_CONFIG" = "no" ; then
1813     no_imlib=yes
1814   else
1815     GDK_IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags-gdk`
1816     GDK_IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs-gdk`
1817
1818     imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \
1819            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
1820     imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \
1821            sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
1822     if test "x$enable_imlibtest" = "xyes" ; then
1823       ac_save_CFLAGS="$CFLAGS"
1824       ac_save_LIBS="$LIBS"
1825       CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
1826       LIBS="$LIBS $GDK_IMLIB_LIBS"
1827 dnl
1828 dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
1829 dnl checks the results of imlib-config to some extent
1830 dnl
1831       rm -f conf.imlibtest
1832       AC_TRY_RUN([
1833 #include <stdio.h>
1834 #include <stdlib.h>
1835 #include <gdk_imlib.h>
1836
1837 int main ()
1838 {
1839   int major, minor;
1840   char *tmp_version;
1841
1842   system ("touch conf.gdkimlibtest");
1843
1844   /* HP/UX 9 (%@#!) writes to sscanf strings */
1845   tmp_version = g_strdup("$min_imlib_version");
1846   if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
1847      printf("%s, bad version string\n", "$min_imlib_version");
1848      exit(1);
1849    }
1850
1851     if (($imlib_major_version > major) ||
1852         (($imlib_major_version == major) && ($imlib_minor_version >= minor)))
1853     {
1854       return 0;
1855     }
1856   else
1857     {
1858       printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
1859       printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
1860       printf("*** best to upgrade to the required version.\n");
1861       printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n");
1862       printf("*** to point to the correct copy of imlib-config, and remove the file\n");
1863       printf("*** config.cache before re-running configure\n");
1864       return 1;
1865     }
1866 }
1867
1868 ],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
1869        CFLAGS="$ac_save_CFLAGS"
1870        LIBS="$ac_save_LIBS"
1871      fi
1872   fi
1873   if test "x$no_imlib" = x ; then
1874      AC_MSG_RESULT(yes)
1875      ifelse([$2], , :, [$2])     
1876   else
1877      AC_MSG_RESULT(no)
1878      if test "$IMLIB_CONFIG" = "no" ; then
1879        echo "*** The imlib-config script installed by IMLIB could not be found"
1880        echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
1881        echo "*** your path, or set the IMLIB_CONFIG environment variable to the"
1882        echo "*** full path to imlib-config."
1883      else
1884        if test -f conf.gdkimlibtest ; then
1885         :
1886        else
1887           echo "*** Could not run IMLIB test program, checking why..."
1888           CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
1889           LIBS="$LIBS $GDK_IMLIB_LIBS"
1890           AC_TRY_LINK([
1891 #include <stdio.h>
1892 #include <gdk_imlib.h>
1893 ],      [ return 0; ],
1894         [ echo "*** The test program compiled, but did not run. This usually means"
1895           echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
1896           echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
1897           echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
1898           echo "*** to the installed location  Also, make sure you have run ldconfig if that"
1899           echo "*** is required on your system"
1900           echo "***"
1901           echo "*** If you have an old version installed, it is best to remove it, although"
1902           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
1903         [ echo "*** The test program failed to compile or link. See the file config.log for the"
1904           echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
1905           echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
1906           echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ])
1907           CFLAGS="$ac_save_CFLAGS"
1908           LIBS="$ac_save_LIBS"
1909        fi
1910      fi
1911      IMLIB_CFLAGS=""
1912      IMLIB_LIBS=""
1913      ifelse([$3], , :, [$3])
1914   fi
1915   AC_SUBST(GDK_IMLIB_CFLAGS)
1916   AC_SUBST(GDK_IMLIB_LIBS)
1917   rm -f conf.gdkimlibtest
1918 ])
1919
1920 dnl Autoconf macros for libgpgme
1921 dnl $Id$
1922
1923 # Configure paths for GPGME
1924 # Shamelessly stolen from the one of XDELTA by Owen Taylor
1925 # Werner Koch  2000-11-17
1926
1927 dnl AM_PATH_GPGME([MINIMUM-VERSION,
1928 dnl               [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
1929 dnl Test for gpgme, and define GPGME_CFLAGS and GPGME_LIBS
1930 dnl
1931 AC_DEFUN(AM_PATH_GPGME,
1932 [dnl
1933 dnl Get the cflags and libraries from the gpgme-config script
1934 dnl
1935   AC_ARG_WITH(gpgme-prefix,
1936    [  --with-gpgme-prefix=PFX   Prefix where gpgme is installed (optional)],
1937           gpgme_config_prefix="$withval", gpgme_config_prefix="")
1938   AC_ARG_ENABLE(gpgmetest,
1939    [  --disable-gpgmetest    Do not try to compile and run a test gpgme program],
1940           , enable_gpgmetest=yes)
1941
1942   if test x$gpgme_config_prefix != x ; then
1943      gpgme_config_args="$gpgme_config_args --prefix=$gpgme_config_prefix"
1944      if test x${GPGME_CONFIG+set} != xset ; then
1945         GPGME_CONFIG=$gpgme_config_prefix/bin/gpgme-config
1946      fi
1947   fi
1948
1949   AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
1950   min_gpgme_version=ifelse([$1], ,1.0.0,$1)
1951   AC_MSG_CHECKING(for gpgme - version >= $min_gpgme_version)
1952   no_gpgme=""
1953   if test "$GPGME_CONFIG" = "no" ; then
1954     no_gpgme=yes
1955   else
1956     GPGME_CFLAGS=`$GPGME_CONFIG $gpgme_config_args --cflags`
1957     GPGME_LIBS=`$GPGME_CONFIG $gpgme_config_args --libs`
1958     gpgme_config_version=`$GPGME_CONFIG $gpgme_config_args --version`
1959     if test "x$enable_gpgmetest" = "xyes" ; then
1960       ac_save_CFLAGS="$CFLAGS"
1961       ac_save_LIBS="$LIBS"
1962       CFLAGS="$CFLAGS $GPGME_CFLAGS"
1963       LIBS="$LIBS $GPGME_LIBS"
1964 dnl
1965 dnl Now check if the installed gpgme is sufficiently new. Also sanity
1966 dnl checks the results of gpgme-config to some extent
1967 dnl
1968       rm -f conf.gpgmetest
1969       AC_TRY_RUN([
1970 #include <stdio.h>
1971 #include <stdlib.h>
1972 #include <string.h>
1973 #include <gpgme.h>
1974
1975 int
1976 main ()
1977 {
1978  system ("touch conf.gpgmetest");
1979
1980  if( strcmp( gpgme_check_version(NULL), "$gpgme_config_version" ) )
1981  {
1982    printf("\n"
1983 "*** 'gpgme-config --version' returned %s, but GPGME (%s) was found!\n",
1984               "$gpgme_config_version", gpgme_check_version(NULL) );
1985    printf(
1986 "*** If gpgme-config was correct, then it is best to remove the old\n"
1987 "*** version of GPGME.  You may also be able to fix the error\n"
1988 "*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"
1989 "*** /etc/ld.so.conf.  Make sure you have run ldconfig if that is\n"
1990 "*** required on your system.\n"
1991 "*** If gpgme-config was wrong, set the environment variable GPGME_CONFIG\n"
1992 "*** to point to the correct copy of gpgme-config, \n"
1993 "*** and remove the file config.cache before re-running configure\n"
1994         );
1995  }
1996  else if ( strcmp(gpgme_check_version(NULL), GPGME_VERSION ) )
1997  {
1998    printf("\n*** GPGME header file (version %s) does not match\n",
1999             GPGME_VERSION);
2000    printf("*** library (version %s)\n", gpgme_check_version(NULL) );
2001  }
2002  else
2003  {
2004         if ( gpgme_check_version( "$min_gpgme_version" ) )
2005              return 0;
2006   printf("no\n"
2007 "*** An old version of GPGME (%s) was found.\n", gpgme_check_version(NULL) );
2008   printf(
2009 "*** You need a version of GPGME newer than %s.\n", "$min_gpgme_version" );
2010   printf(
2011 "*** The latest version of GPGME is always available at\n"
2012 "***      ftp://ftp.gnupg.org/pub/gcrypt/alpha/gpgme/\n"
2013 "*** \n"
2014 "*** If you have already installed a sufficiently new version, this error\n"
2015 "*** probably means that the wrong copy of the gpgme-config shell script is\n"
2016 "*** being found. The easiest way to fix this is to remove the old version\n"
2017 "*** of GPGME, but you can also set the GPGME_CONFIG environment to point to\n"
2018 "*** the correct copy of gpgme-config. (In this case, you will have to\n"
2019 "*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"
2020 "*** so that the correct libraries are found at run-time).\n"
2021       );
2022     }
2023   return 1;
2024 }
2025 ],, no_gpgme=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
2026        CFLAGS="$ac_save_CFLAGS"
2027        LIBS="$ac_save_LIBS"
2028      fi
2029   fi
2030   if test "x$no_gpgme" = x ; then
2031      AC_MSG_RESULT(yes)
2032      ifelse([$2], , :, [$2])
2033   else
2034      if test -f conf.gpgmetest ; then
2035         :
2036      else
2037         AC_MSG_RESULT(no)
2038      fi
2039      if test "$GPGME_CONFIG" = "no" ; then
2040        echo "*** The gpgme-config script installed by GPGME could not be found"
2041        echo "*** If GPGME was installed in PREFIX, make sure PREFIX/bin is in"
2042        echo "*** your path, or set the GPGME_CONFIG environment variable to the"
2043        echo "*** full path to gpgme-config."
2044      else
2045        if test -f conf.gpgmetest ; then
2046         :
2047        else
2048           echo "*** Could not run gpgme test program, checking why..."
2049           CFLAGS="$CFLAGS $GPGME_CFLAGS"
2050           LIBS="$LIBS $GPGME_LIBS"
2051           AC_TRY_LINK([
2052 #include <stdio.h>
2053 #include <stdlib.h>
2054 #include <string.h>
2055 #include <gpgme.h>
2056 ],      [ gpgme_check_version(NULL); return 0 ],
2057         [ 
2058 echo "*** The test program compiled, but did not run. This usually means"
2059 echo "*** that the run-time linker is not finding GPGME or finding the wrong"
2060 echo "*** version of GPGME. If it is not finding GPGME, you'll need to set your"
2061 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
2062 echo "*** to the installed location  Also, make sure you have run ldconfig if"
2063 echo "*** that is required on your system"
2064 echo "***"
2065 echo "*** If you have an old version installed, it is best to remove it,"
2066 echo "*** although you may also be able to get things to work by"
2067 echo "*** modifying LD_LIBRARY_PATH"
2068 echo "***"
2069         ],
2070         [
2071 echo "*** The test program failed to compile or link. See the file config.log"
2072 echo "*** for the exact error that occured. This usually means GPGME was"
2073 echo "*** incorrectly installed or that you have moved GPGME since it was"
2074 echo "*** installed. In the latter case, you may want to edit the"
2075 echo "*** gpgme-config script: $GPGME_CONFIG" 
2076         ])
2077           CFLAGS="$ac_save_CFLAGS"
2078           LIBS="$ac_save_LIBS"
2079        fi
2080      fi
2081      GPGME_CFLAGS=""
2082      GPGME_LIBS=""
2083      ifelse([$3], , :, [$3])
2084   fi
2085   AC_SUBST(GPGME_CFLAGS)
2086   AC_SUBST(GPGME_LIBS)
2087   rm -f conf.gpgmetest
2088 ])
2089
2090