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