064de272ca7c32b38d536b05f64edc7424a46123
[platform/upstream/rpm.git] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4a
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 dnl We require 2.13 because we rely on SHELL being computed by configure.
25 AC_PREREQ([2.13])
26 PACKAGE=[$1]
27 AC_SUBST(PACKAGE)
28 VERSION=[$2]
29 AC_SUBST(VERSION)
30 dnl test to see if srcdir already configured
31 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
32   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
33 fi
34 ifelse([$3],,
35 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
36 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
37 AC_REQUIRE([AM_SANITY_CHECK])
38 AC_REQUIRE([AC_ARG_PROGRAM])
39 dnl FIXME This is truly gross.
40 missing_dir=`cd $ac_aux_dir && pwd`
41 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
42 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
43 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
44 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
45 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
46 AC_REQUIRE([AC_PROG_MAKE_SET])])
47
48 #
49 # Check to make sure that the build environment is sane.
50 #
51
52 AC_DEFUN(AM_SANITY_CHECK,
53 [AC_MSG_CHECKING([whether build environment is sane])
54 # Just in case
55 sleep 1
56 echo timestamp > conftestfile
57 # Do `set' in a subshell so we don't clobber the current shell's
58 # arguments.  Must try -L first in case configure is actually a
59 # symlink; some systems play weird games with the mod time of symlinks
60 # (eg FreeBSD returns the mod time of the symlink's containing
61 # directory).
62 if (
63    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
64    if test "[$]*" = "X"; then
65       # -L didn't work.
66       set X `ls -t $srcdir/configure conftestfile`
67    fi
68    if test "[$]*" != "X $srcdir/configure conftestfile" \
69       && test "[$]*" != "X conftestfile $srcdir/configure"; then
70
71       # If neither matched, then we have a broken ls.  This can happen
72       # if, for instance, CONFIG_SHELL is bash and it inherits a
73       # broken ls alias from the environment.  This has actually
74       # happened.  Such a system could not be considered "sane".
75       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
76 alias in your environment])
77    fi
78
79    test "[$]2" = conftestfile
80    )
81 then
82    # Ok.
83    :
84 else
85    AC_MSG_ERROR([newly created file is older than distributed files!
86 Check your system clock])
87 fi
88 rm -f conftest*
89 AC_MSG_RESULT(yes)])
90
91 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
92 dnl The program must properly implement --version.
93 AC_DEFUN(AM_MISSING_PROG,
94 [AC_MSG_CHECKING(for working $2)
95 # Run test in a subshell; some versions of sh will print an error if
96 # an executable is not found, even if stderr is redirected.
97 # Redirect stdin to placate older versions of autoconf.  Sigh.
98 if ($2 --version) < /dev/null > /dev/null 2>&1; then
99    $1=$2
100    AC_MSG_RESULT(found)
101 else
102    $1="$3/missing $2"
103    AC_MSG_RESULT(missing)
104 fi
105 AC_SUBST($1)])
106
107 # Like AC_CONFIG_HEADER, but automatically create stamp file.
108
109 AC_DEFUN(AM_CONFIG_HEADER,
110 [AC_PREREQ([2.12])
111 AC_CONFIG_HEADER([$1])
112 dnl When config.status generates a header, we must update the stamp-h file.
113 dnl This file resides in the same directory as the config header
114 dnl that is generated.  We must strip everything past the first ":",
115 dnl and everything past the last "/".
116 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
117 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
118 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
119 <<am_indx=1
120 for am_file in <<$1>>; do
121   case " <<$>>CONFIG_HEADERS " in
122   *" <<$>>am_file "*<<)>>
123     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
124     ;;
125   esac
126   am_indx=`expr "<<$>>am_indx" + 1`
127 done<<>>dnl>>)
128 changequote([,]))])
129
130
131 # serial 1
132
133 AC_DEFUN(AM_C_PROTOTYPES,
134 [AC_REQUIRE([AM_PROG_CC_STDC])
135 AC_REQUIRE([AC_PROG_CPP])
136 AC_MSG_CHECKING([for function prototypes])
137 if test "$am_cv_prog_cc_stdc" != no; then
138   AC_MSG_RESULT(yes)
139   AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
140   U= ANSI2KNR=
141 else
142   AC_MSG_RESULT(no)
143   U=_ ANSI2KNR=./ansi2knr
144   # Ensure some checks needed by ansi2knr itself.
145   AC_HEADER_STDC
146   AC_CHECK_HEADERS(string.h)
147 fi
148 AC_SUBST(U)dnl
149 AC_SUBST(ANSI2KNR)dnl
150 ])
151
152
153 # serial 1
154
155 # @defmac AC_PROG_CC_STDC
156 # @maindex PROG_CC_STDC
157 # @ovindex CC
158 # If the C compiler in not in ANSI C mode by default, try to add an option
159 # to output variable @code{CC} to make it so.  This macro tries various
160 # options that select ANSI C on some system or another.  It considers the
161 # compiler to be in ANSI C mode if it handles function prototypes correctly.
162 #
163 # If you use this macro, you should check after calling it whether the C
164 # compiler has been set to accept ANSI C; if not, the shell variable
165 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
166 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
167 # program @code{ansi2knr}, which comes with Ghostscript.
168 # @end defmac
169
170 AC_DEFUN(AM_PROG_CC_STDC,
171 [AC_REQUIRE([AC_PROG_CC])
172 AC_BEFORE([$0], [AC_C_INLINE])
173 AC_BEFORE([$0], [AC_C_CONST])
174 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
175 dnl a magic option to avoid problems with ANSI preprocessor commands
176 dnl like #elif.
177 dnl FIXME: can't do this because then AC_AIX won't work due to a
178 dnl circular dependency.
179 dnl AC_BEFORE([$0], [AC_PROG_CPP])
180 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
181 AC_CACHE_VAL(am_cv_prog_cc_stdc,
182 [am_cv_prog_cc_stdc=no
183 ac_save_CC="$CC"
184 # Don't try gcc -ansi; that turns off useful extensions and
185 # breaks some systems' header files.
186 # AIX                   -qlanglvl=ansi
187 # Ultrix and OSF/1      -std1
188 # HP-UX                 -Aa -D_HPUX_SOURCE
189 # SVR4                  -Xc -D__EXTENSIONS__
190 for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
191 do
192   CC="$ac_save_CC $ac_arg"
193   AC_TRY_COMPILE(
194 [#include <stdarg.h>
195 #include <stdio.h>
196 #include <sys/types.h>
197 #include <sys/stat.h>
198 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
199 struct buf { int x; };
200 FILE * (*rcsopen) (struct buf *, struct stat *, int);
201 static char *e (p, i)
202      char **p;
203      int i;
204 {
205   return p[i];
206 }
207 static char *f (char * (*g) (char **, int), char **p, ...)
208 {
209   char *s;
210   va_list v;
211   va_start (v,p);
212   s = g (p, va_arg (v,int));
213   va_end (v);
214   return s;
215 }
216 int test (int i, double x);
217 struct s1 {int (*f) (int a);};
218 struct s2 {int (*f) (double a);};
219 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
220 int argc;
221 char **argv;
222 ], [
223 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
224 ],
225 [am_cv_prog_cc_stdc="$ac_arg"; break])
226 done
227 CC="$ac_save_CC"
228 ])
229 if test -z "$am_cv_prog_cc_stdc"; then
230   AC_MSG_RESULT([none needed])
231 else
232   AC_MSG_RESULT($am_cv_prog_cc_stdc)
233 fi
234 case "x$am_cv_prog_cc_stdc" in
235   x|xno) ;;
236   *) CC="$CC $am_cv_prog_cc_stdc" ;;
237 esac
238 ])
239
240
241 # serial 29 AM_PROG_LIBTOOL
242 AC_DEFUN(AM_PROG_LIBTOOL,
243 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
244 AC_REQUIRE([AM_ENABLE_STATIC])dnl
245 AC_REQUIRE([AC_CANONICAL_HOST])dnl
246 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
247 AC_REQUIRE([AC_PROG_RANLIB])dnl
248 AC_REQUIRE([AC_PROG_CC])dnl
249 AC_REQUIRE([AM_PROG_LD])dnl
250 AC_REQUIRE([AM_PROG_NM])dnl
251 AC_REQUIRE([AM_SYS_NM_PARSE])dnl
252 AC_REQUIRE([AM_SYS_SYMBOL_UNDERSCORE])dnl
253 AC_REQUIRE([AC_PROG_LN_S])dnl
254 dnl
255 # Always use our own libtool.
256 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
257 AC_SUBST(LIBTOOL)dnl
258
259 # Check for any special flags to pass to ltconfig.
260 libtool_flags=
261 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
262 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
263 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
264 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
265 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
266
267 # Some flags need to be propagated to the compiler or linker for good
268 # libtool support.
269 case "$host" in
270 *-*-irix6*)
271   # Find out which ABI we are using.
272   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
273   if AC_TRY_EVAL(ac_compile); then
274     case "`/usr/bin/file conftest.o`" in
275     *32-bit*)
276       LD="${LD-ld} -32"
277       ;;
278     *N32*)
279       LD="${LD-ld} -n32"
280       ;;
281     *64-bit*)
282       LD="${LD-ld} -64"
283       ;;
284     esac
285   fi
286   rm -rf conftest*
287   ;;
288
289 *-*-sco3.2v5*)
290   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
291   SAVE_CFLAGS="$CFLAGS"
292   CFLAGS="$CFLAGS -belf"
293   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
294     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
295   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
296     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
297     CFLAGS="$SAVE_CFLAGS"
298   fi
299   ;;
300
301 *-*-cygwin32*)
302   AM_SYS_LIBTOOL_CYGWIN32
303   ;;
304
305 esac
306
307 # enable the --disable-libtool-lock switch
308
309 AC_ARG_ENABLE(libtool-lock,
310 [  --disable-libtool-lock  force libtool not to do file locking],
311 need_locks=$enableval,
312 need_locks=yes)
313
314 if test x"$need_locks" = xno; then
315   libtool_flags="$libtool_flags --disable-lock"
316 fi
317
318
319 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
320 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
321 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
322 DLLTOOL="$DLLTOOL" AS="$AS" \
323 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
324 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
325 || AC_MSG_ERROR([libtool configure failed])
326
327 # Redirect the config.log output again, so that the ltconfig log is not
328 # clobbered by the next message.
329 exec 5>>./config.log
330 ])
331
332 # AM_ENABLE_SHARED - implement the --enable-shared flag
333 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
334 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
335 #   `yes'.
336 AC_DEFUN(AM_ENABLE_SHARED,
337 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
338 AC_ARG_ENABLE(shared,
339 changequote(<<, >>)dnl
340 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
341 changequote([, ])dnl
342 [p=${PACKAGE-default}
343 case "$enableval" in
344 yes) enable_shared=yes ;;
345 no) enable_shared=no ;;
346 *)
347   enable_shared=no
348   # Look at the argument we got.  We use all the common list separators.
349   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
350   for pkg in $enableval; do
351     if test "X$pkg" = "X$p"; then
352       enable_shared=yes
353     fi
354   done
355   IFS="$ac_save_ifs"
356   ;;
357 esac],
358 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
359 ])
360
361 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
362 AC_DEFUN(AM_DISABLE_SHARED,
363 [AM_ENABLE_SHARED(no)])
364
365 # AM_DISABLE_STATIC - set the default static flag to --disable-static
366 AC_DEFUN(AM_DISABLE_STATIC,
367 [AM_ENABLE_STATIC(no)])
368
369 # AM_ENABLE_STATIC - implement the --enable-static flag
370 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
371 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
372 #   `yes'.
373 AC_DEFUN(AM_ENABLE_STATIC,
374 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
375 AC_ARG_ENABLE(static,
376 changequote(<<, >>)dnl
377 <<  --enable-static[=PKGS]  build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
378 changequote([, ])dnl
379 [p=${PACKAGE-default}
380 case "$enableval" in
381 yes) enable_static=yes ;;
382 no) enable_static=no ;;
383 *)
384   enable_static=no
385   # Look at the argument we got.  We use all the common list separators.
386   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
387   for pkg in $enableval; do
388     if test "X$pkg" = "X$p"; then
389       enable_static=yes
390     fi
391   done
392   IFS="$ac_save_ifs"
393   ;;
394 esac],
395 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
396 ])
397
398
399 # AM_PROG_LD - find the path to the GNU or non-GNU linker
400 AC_DEFUN(AM_PROG_LD,
401 [AC_ARG_WITH(gnu-ld,
402 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
403 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
404 AC_REQUIRE([AC_PROG_CC])dnl
405 AC_REQUIRE([AC_CANONICAL_HOST])dnl
406 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
407 ac_prog=ld
408 if test "$ac_cv_prog_gcc" = yes; then
409   # Check if gcc -print-prog-name=ld gives a path.
410   AC_MSG_CHECKING([for ld used by GCC])
411   ac_prog=`($CC -print-prog-name=ld) 2>&5`
412   case "$ac_prog" in
413     # Accept absolute paths.
414 changequote(,)dnl
415     /* | [A-Za-z]:/*)
416       # Canonicalize the path of ld
417       re_direlt='/[^/][^/]*/\.\./'
418       sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%'
419 changequote([,])dnl
420       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
421         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
422       done
423       case "$host_os" in
424       cygwin*)
425         # Convert to a UNC path for cygwin
426         test -z "$LD" && LD=`echo X$ac_prog | $Xsed -e "$sub_uncdrive"`
427         ;;
428       *)
429         test -z "$LD" && LD="$ac_prog"
430         ;;
431       esac
432       ;;
433     ##
434     ## FIXME:  The code fails later on if we try to use an $LD with
435     ##         '\\' path separators.
436     ##
437 changequote(,)dnl
438     [A-Za-z]:[\\]*)
439       # Canonicalize the path of ld
440       re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)'
441       sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%'
442 changequote([,])dnl
443       sub_uncdir='s%\\%/%g'
444       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
445         ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"`
446       done
447       case "$host_os" in
448       cygwin*)
449         # Convert to a UNC path for cygwin
450         test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"`
451         ;;
452       *)
453         test -z "$LD" && LD="$ac_prog"
454         ;;
455       esac
456       ;;
457   "")
458     # If it fails, then pretend we aren't using GCC.
459     ac_prog=ld
460     ;;
461   *)
462     # If it is relative, then search for the first ld in PATH.
463     with_gnu_ld=unknown
464     ;;
465   esac
466 elif test "$with_gnu_ld" = yes; then
467   AC_MSG_CHECKING([for GNU ld])
468 else
469   AC_MSG_CHECKING([for non-GNU ld])
470 fi
471 AC_CACHE_VAL(ac_cv_path_LD,
472 [if test -z "$LD"; then
473   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
474   for ac_dir in $PATH; do
475     test -z "$ac_dir" && ac_dir=.
476     if test -f "$ac_dir/$ac_prog"; then
477       ac_cv_path_LD="$ac_dir/$ac_prog"
478       # Check to see if the program is GNU ld.  I'd rather use --version,
479       # but apparently some GNU ld's only accept -v.
480       # Break only if it was the GNU/non-GNU ld that we prefer.
481       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
482         test "$with_gnu_ld" != no && break
483       else
484         test "$with_gnu_ld" != yes && break
485       fi
486     fi
487   done
488   IFS="$ac_save_ifs"
489 else
490   ac_cv_path_LD="$LD" # Let the user override the test with a path.
491 fi])
492 LD="$ac_cv_path_LD"
493 if test -n "$LD"; then
494   AC_MSG_RESULT($LD)
495 else
496   AC_MSG_RESULT(no)
497 fi
498 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
499 AC_SUBST(LD)
500 AM_PROG_LD_GNU
501 ])
502
503 AC_DEFUN(AM_PROG_LD_GNU,
504 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
505 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
506 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
507   ac_cv_prog_gnu_ld=yes
508 else
509   ac_cv_prog_gnu_ld=no
510 fi])
511 ])
512
513 # AM_PROG_NM - find the path to a BSD-compatible name lister
514 AC_DEFUN(AM_PROG_NM,
515 [AC_MSG_CHECKING([for BSD-compatible nm])
516 AC_CACHE_VAL(ac_cv_path_NM,
517 [if test -n "$NM"; then
518   # Let the user override the test.
519   ac_cv_path_NM="$NM"
520 else
521   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
522   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
523     test -z "$ac_dir" && ac_dir=.
524     if test -f $ac_dir/nm; then
525       # Check to see if the nm accepts a BSD-compat flag.
526       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
527       #   nm: unknown option "B" ignored
528       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
529         ac_cv_path_NM="$ac_dir/nm -B"
530       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
531         ac_cv_path_NM="$ac_dir/nm -p"
532       else
533         ac_cv_path_NM="$ac_dir/nm"
534       fi
535       break
536     fi
537   done
538   IFS="$ac_save_ifs"
539   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
540 fi])
541 NM="$ac_cv_path_NM"
542 AC_MSG_RESULT([$NM])
543 AC_SUBST(NM)
544 ])
545
546 # AM_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed
547 # by C symbol name from nm.
548 AC_DEFUN(AM_SYS_NM_PARSE,
549 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
550 AC_REQUIRE([AM_PROG_NM])dnl
551 # Check for command to grab the raw symbol name followed by C symbol from nm.
552 AC_MSG_CHECKING([command to parse $NM output])
553 AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
554 [# These are sane defaults that work on at least a few old systems.
555 # {They come from Ultrix.  What could be older than Ultrix?!! ;)}
556
557 changequote(,)dnl
558 # Character class describing NM global symbol codes.
559 ac_symcode='[BCDEGRSTU]'
560
561 # Regexp to match symbols that can be accessed directly from C.
562 ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
563
564 # Transform the above into a raw symbol and a C symbol.
565 ac_symxfrm='\1 \1'
566
567 # Define system-specific variables.
568 case "$host_os" in
569 aix*)
570   ac_symcode='[BCDTU]'
571   ;;
572 sunos* | cygwin32* | mingw32*)
573   ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
574   ac_symxfrm='_\1 \1'
575   ;;
576 irix*)
577   # Cannot use undefined symbols on IRIX because inlined functions mess us up.
578   ac_symcode='[BCDEGRST]'
579   ;;
580 solaris*)
581   ac_symcode='[BDTU]'
582   ;;
583 esac
584
585 # If we're using GNU nm, then use its standard symbol codes.
586 if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
587   ac_symcode='[ABCDGISTUW]'
588 fi
589
590 case "$host_os" in
591 cygwin32* | mingw32*)
592   # We do not want undefined symbols on cygwin32.  The user must
593   # arrange to define them via -l arguments.
594   ac_symcode='[ABCDGISTW]'
595   ;;
596 esac
597 changequote([,])dnl
598
599 # Write the raw and C identifiers.
600 ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'"
601
602 # Check to see that the pipe works correctly.
603 ac_pipe_works=no
604 cat > conftest.$ac_ext <<EOF
605 #ifdef __cplusplus
606 extern "C" {
607 #endif
608 char nm_test_var;
609 void nm_test_func(){}
610 #ifdef __cplusplus
611 }
612 #endif
613 int main(){nm_test_var='a';nm_test_func;return 0;}
614 EOF
615 if AC_TRY_EVAL(ac_compile); then
616   # Now try to grab the symbols.
617   ac_nlist=conftest.nm
618   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
619
620     # Try sorting and uniquifying the output.
621     if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
622       mv -f "$ac_nlist"T "$ac_nlist"
623       ac_wcout=`wc "$ac_nlist" 2>/dev/null`
624 changequote(,)dnl
625       ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[    ]*\([0-9][0-9]*\).*$/\1/'`
626 changequote([,])dnl
627       (test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
628     else
629       rm -f "$ac_nlist"T
630       ac_count=-1
631     fi
632
633     # Make sure that we snagged all the symbols we need.
634     if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
635       if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
636         cat <<EOF > conftest.c
637 #ifdef __cplusplus
638 extern "C" {
639 #endif
640
641 EOF
642         # Now generate the symbol file.
643         sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
644
645         cat <<EOF >> conftest.c
646 #if defined (__STDC__) && __STDC__
647 # define __ptr_t void *
648 #else
649 # define __ptr_t char *
650 #endif
651
652 /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
653 int dld_preloaded_symbol_count = $ac_count;
654
655 /* The mapping between symbol names and symbols. */
656 struct {
657   char *name;
658   __ptr_t address;
659 }
660 changequote(,)dnl
661 dld_preloaded_symbols[] =
662 changequote([,])dnl
663 {
664 EOF
665         sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
666         cat <<\EOF >> conftest.c
667   {0, (__ptr_t) 0}
668 };
669
670 #ifdef __cplusplus
671 }
672 #endif
673 EOF
674         # Now try linking the two files.
675         mv conftest.$ac_objext conftestm.$ac_objext
676         ac_save_LIBS="$LIBS"
677         ac_save_CFLAGS="$CFLAGS"
678         LIBS="conftestm.$ac_objext"
679         CFLAGS="$CFLAGS$no_builtin_flag"
680         if AC_TRY_EVAL(ac_link) && test -s conftest; then
681           ac_pipe_works=yes
682         else
683           echo "configure: failed program was:" >&AC_FD_CC
684           cat conftest.c >&AC_FD_CC
685         fi
686         LIBS="$ac_save_LIBS"
687         CFLAGS="$ac_save_CFLAGS"
688       else
689         echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
690       fi
691     else
692       echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
693     fi
694   else
695     echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
696   fi
697 else
698   echo "$progname: failed program was:" >&AC_FD_CC
699   cat conftest.c >&AC_FD_CC
700 fi
701 rm -rf conftest*
702
703 # Do not use the global_symbol_pipe unless it works.
704 test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe=
705 ])
706
707 ac_result=yes
708 if test -z "$ac_cv_sys_global_symbol_pipe"; then
709    ac_result=no
710 fi
711 AC_MSG_RESULT($ac_result)
712 ])
713
714 # AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
715 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
716 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
717 AC_CHECK_TOOL(AS, as, false)
718 ])
719
720 # AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
721 #                            with an underscore?
722 AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE,
723 [AC_REQUIRE([AM_PROG_NM])dnl
724 AC_REQUIRE([AM_SYS_NM_PARSE])dnl
725 AC_MSG_CHECKING([for _ prefix in compiled symbols])
726 AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
727 [ac_cv_sys_symbol_underscore=no
728 cat > conftest.$ac_ext <<EOF
729 void nm_test_func(){}
730 int main(){nm_test_func;return 0;}
731 EOF
732 if AC_TRY_EVAL(ac_compile); then
733   # Now try to grab the symbols.
734   ac_nlist=conftest.nm
735   if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
736     # See whether the symbols have a leading underscore.
737     if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then
738       ac_cv_sys_symbol_underscore=yes
739     else
740       if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
741         :
742       else
743         echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
744       fi
745     fi
746   else
747     echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
748   fi
749 else
750   echo "configure: failed program was:" >&AC_FD_CC
751   cat conftest.c >&AC_FD_CC
752 fi
753 rm -rf conftest*
754 ])
755 AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
756 if test x$ac_cv_sys_symbol_underscore = xyes; then
757   AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1,
758   [define if compiled symbols have a leading underscore])
759 fi
760 ])
761
762 dnl From Jim Meyering.  Use this if you use the GNU error.[ch].
763 dnl FIXME: Migrate into libit
764
765 AC_DEFUN(AM_FUNC_ERROR_AT_LINE,
766 [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
767  [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
768               am_cv_lib_error_at_line=yes,
769               am_cv_lib_error_at_line=no)])
770  if test $am_cv_lib_error_at_line = no; then
771    LIBOBJS="$LIBOBJS error.o"
772  fi
773  AC_SUBST(LIBOBJS)dnl
774 ])
775
776 # Macro to add for using GNU gettext.
777 # Ulrich Drepper <drepper@cygnus.com>, 1995.
778 #
779 # This file can be copied and used freely without restrictions.  It can
780 # be used in projects which are not available under the GNU Public License
781 # but which still want to provide support for the GNU gettext functionality.
782 # Please note that the actual code is *not* freely available.
783
784 # serial 5
785
786 AC_DEFUN(AM_WITH_NLS,
787   [AC_MSG_CHECKING([whether NLS is requested])
788     dnl Default is enabled NLS
789     AC_ARG_ENABLE(nls,
790       [  --disable-nls           do not use Native Language Support],
791       USE_NLS=$enableval, USE_NLS=yes)
792     AC_MSG_RESULT($USE_NLS)
793     AC_SUBST(USE_NLS)
794
795     USE_INCLUDED_LIBINTL=no
796
797     dnl If we use NLS figure out what method
798     if test "$USE_NLS" = "yes"; then
799       AC_DEFINE(ENABLE_NLS)
800       AC_MSG_CHECKING([whether included gettext is requested])
801       AC_ARG_WITH(included-gettext,
802         [  --with-included-gettext use the GNU gettext library included here],
803         nls_cv_force_use_gnu_gettext=$withval,
804         nls_cv_force_use_gnu_gettext=no)
805       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
806
807       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
808       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
809         dnl User does not insist on using GNU NLS library.  Figure out what
810         dnl to use.  If gettext or catgets are available (in this order) we
811         dnl use this.  Else we have to fall back to GNU NLS library.
812         dnl catgets is only used if permitted by option --with-catgets.
813         nls_cv_header_intl=
814         nls_cv_header_libgt=
815         CATOBJEXT=NONE
816
817         AC_CHECK_HEADER(libintl.h,
818           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
819             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
820                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
821
822            if test "$gt_cv_func_gettext_libc" != "yes"; then
823              AC_CHECK_LIB(intl, bindtextdomain,
824                [AC_CACHE_CHECK([for gettext in libintl],
825                  gt_cv_func_gettext_libintl,
826                  [AC_CHECK_LIB(intl, gettext,
827                   gt_cv_func_gettext_libintl=yes,
828                   gt_cv_func_gettext_libintl=no)],
829                  gt_cv_func_gettext_libintl=no)])
830            fi
831
832            if test "$gt_cv_func_gettext_libc" = "yes" \
833               || test "$gt_cv_func_gettext_libintl" = "yes"; then
834               AC_DEFINE(HAVE_GETTEXT)
835               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
836                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
837               if test "$MSGFMT" != "no"; then
838                 AC_CHECK_FUNCS(dcgettext)
839                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
840                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
841                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
842                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
843                                return _nl_msg_cat_cntr],
844                   [CATOBJEXT=.gmo
845                    DATADIRNAME=share],
846                   [CATOBJEXT=.mo
847                    DATADIRNAME=lib])
848                 INSTOBJEXT=.mo
849               fi
850             fi
851         ])
852
853         if test "$CATOBJEXT" = "NONE"; then
854           AC_MSG_CHECKING([whether catgets can be used])
855           AC_ARG_WITH(catgets,
856             [  --with-catgets          use catgets functions if available],
857             nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
858           AC_MSG_RESULT($nls_cv_use_catgets)
859
860           if test "$nls_cv_use_catgets" = "yes"; then
861             dnl No gettext in C library.  Try catgets next.
862             AC_CHECK_LIB(i, main)
863             AC_CHECK_FUNC(catgets,
864               [AC_DEFINE(HAVE_CATGETS)
865                INTLOBJS="\$(CATOBJS)"
866                AC_PATH_PROG(GENCAT, gencat, no)dnl
867                if test "$GENCAT" != "no"; then
868                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
869                  if test "$GMSGFMT" = "no"; then
870                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
871                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
872                  fi
873                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
874                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
875                  USE_INCLUDED_LIBINTL=yes
876                  CATOBJEXT=.cat
877                  INSTOBJEXT=.cat
878                  DATADIRNAME=lib
879                  INTLDEPS='$(top_builddir)/intl/libintl.a'
880                  INTLLIBS=$INTLDEPS
881                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
882                  nls_cv_header_intl=intl/libintl.h
883                  nls_cv_header_libgt=intl/libgettext.h
884                fi])
885           fi
886         fi
887
888         if test "$CATOBJEXT" = "NONE"; then
889           dnl Neither gettext nor catgets in included in the C library.
890           dnl Fall back on GNU gettext library.
891           nls_cv_use_gnu_gettext=yes
892         fi
893       fi
894
895       if test "$nls_cv_use_gnu_gettext" = "yes"; then
896         dnl Mark actions used to generate GNU NLS library.
897         INTLOBJS="\$(GETTOBJS)"
898         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
899           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
900         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
901         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
902           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
903         AC_SUBST(MSGFMT)
904         USE_INCLUDED_LIBINTL=yes
905         CATOBJEXT=.gmo
906         INSTOBJEXT=.mo
907         DATADIRNAME=share
908         INTLDEPS='$(top_builddir)/intl/libintl.a'
909         INTLLIBS=$INTLDEPS
910         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
911         nls_cv_header_intl=intl/libintl.h
912         nls_cv_header_libgt=intl/libgettext.h
913       fi
914
915       dnl Test whether we really found GNU xgettext.
916       if test "$XGETTEXT" != ":"; then
917         dnl If it is no GNU xgettext we define it as : so that the
918         dnl Makefiles still can work.
919         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
920           : ;
921         else
922           AC_MSG_RESULT(
923             [found xgettext program is not GNU xgettext; ignore it])
924           XGETTEXT=":"
925         fi
926       fi
927
928       # We need to process the po/ directory.
929       POSUB=po
930     else
931       DATADIRNAME=share
932       nls_cv_header_intl=intl/libintl.h
933       nls_cv_header_libgt=intl/libgettext.h
934     fi
935     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
936     AC_OUTPUT_COMMANDS(
937      [case "$CONFIG_FILES" in *po/Makefile.in*)
938         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
939       esac])
940
941
942     # If this is used in GNU gettext we have to set USE_NLS to `yes'
943     # because some of the sources are only built for this goal.
944     if test "$PACKAGE" = gettext; then
945       USE_NLS=yes
946       USE_INCLUDED_LIBINTL=yes
947     fi
948
949     dnl These rules are solely for the distribution goal.  While doing this
950     dnl we only have to keep exactly one list of the available catalogs
951     dnl in configure.in.
952     for lang in $ALL_LINGUAS; do
953       GMOFILES="$GMOFILES $lang.gmo"
954       POFILES="$POFILES $lang.po"
955     done
956
957     dnl Make all variables we use known to autoconf.
958     AC_SUBST(USE_INCLUDED_LIBINTL)
959     AC_SUBST(CATALOGS)
960     AC_SUBST(CATOBJEXT)
961     AC_SUBST(DATADIRNAME)
962     AC_SUBST(GMOFILES)
963     AC_SUBST(INSTOBJEXT)
964     AC_SUBST(INTLDEPS)
965     AC_SUBST(INTLLIBS)
966     AC_SUBST(INTLOBJS)
967     AC_SUBST(POFILES)
968     AC_SUBST(POSUB)
969   ])
970
971 AC_DEFUN(AM_GNU_GETTEXT,
972   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
973    AC_REQUIRE([AC_PROG_CC])dnl
974    AC_REQUIRE([AC_PROG_RANLIB])dnl
975    AC_REQUIRE([AC_ISC_POSIX])dnl
976    AC_REQUIRE([AC_HEADER_STDC])dnl
977    AC_REQUIRE([AC_C_CONST])dnl
978    AC_REQUIRE([AC_C_INLINE])dnl
979    AC_REQUIRE([AC_TYPE_OFF_T])dnl
980    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
981    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
982    AC_REQUIRE([AC_FUNC_MMAP])dnl
983
984    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
985 unistd.h sys/param.h])
986    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
987 strdup __argz_count __argz_stringify __argz_next])
988
989    if test "${ac_cv_func_stpcpy+set}" != "set"; then
990      AC_CHECK_FUNCS(stpcpy)
991    fi
992    if test "${ac_cv_func_stpcpy}" = "yes"; then
993      AC_DEFINE(HAVE_STPCPY)
994    fi
995
996    AM_LC_MESSAGES
997    AM_WITH_NLS
998
999    if test "x$CATOBJEXT" != "x"; then
1000      if test "x$ALL_LINGUAS" = "x"; then
1001        LINGUAS=
1002      else
1003        AC_MSG_CHECKING(for catalogs to be installed)
1004        NEW_LINGUAS=
1005        for lang in ${LINGUAS=$ALL_LINGUAS}; do
1006          case "$ALL_LINGUAS" in
1007           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
1008          esac
1009        done
1010        LINGUAS=$NEW_LINGUAS
1011        AC_MSG_RESULT($LINGUAS)
1012      fi
1013
1014      dnl Construct list of names of catalog files to be constructed.
1015      if test -n "$LINGUAS"; then
1016        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1017      fi
1018    fi
1019
1020    dnl The reference to <locale.h> in the installed <libintl.h> file
1021    dnl must be resolved because we cannot expect the users of this
1022    dnl to define HAVE_LOCALE_H.
1023    if test $ac_cv_header_locale_h = yes; then
1024      INCLUDE_LOCALE_H="#include <locale.h>"
1025    else
1026      INCLUDE_LOCALE_H="\
1027 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
1028    fi
1029    AC_SUBST(INCLUDE_LOCALE_H)
1030
1031    dnl Determine which catalog format we have (if any is needed)
1032    dnl For now we know about two different formats:
1033    dnl   Linux libc-5 and the normal X/Open format
1034    test -d intl || mkdir intl
1035    if test "$CATOBJEXT" = ".cat"; then
1036      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
1037
1038      dnl Transform the SED scripts while copying because some dumb SEDs
1039      dnl cannot handle comments.
1040      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
1041    fi
1042    dnl po2tbl.sed is always needed.
1043    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
1044      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
1045
1046    dnl In the intl/Makefile.in we have a special dependency which makes
1047    dnl only sense for gettext.  We comment this out for non-gettext
1048    dnl packages.
1049    if test "$PACKAGE" = "gettext"; then
1050      GT_NO="#NO#"
1051      GT_YES=
1052    else
1053      GT_NO=
1054      GT_YES="#YES#"
1055    fi
1056    AC_SUBST(GT_NO)
1057    AC_SUBST(GT_YES)
1058
1059    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1060    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
1061    dnl Try to locate is.
1062    MKINSTALLDIRS=
1063    if test -n "$ac_aux_dir"; then
1064      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1065    fi
1066    if test -z "$MKINSTALLDIRS"; then
1067      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1068    fi
1069    AC_SUBST(MKINSTALLDIRS)
1070
1071    dnl *** For now the libtool support in intl/Makefile is not for real.
1072    l=
1073    AC_SUBST(l)
1074
1075    dnl Generate list of files to be processed by xgettext which will
1076    dnl be included in po/Makefile.
1077    test -d po || mkdir po
1078    if test "x$srcdir" != "x."; then
1079      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
1080        posrcprefix="$srcdir/"
1081      else
1082        posrcprefix="../$srcdir/"
1083      fi
1084    else
1085      posrcprefix="../"
1086    fi
1087    rm -f po/POTFILES
1088    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
1089         < $srcdir/po/POTFILES.in > po/POTFILES
1090   ])
1091
1092 # Search path for a program which passes the given test.
1093 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1094 #
1095 # This file can be copied and used freely without restrictions.  It can
1096 # be used in projects which are not available under the GNU Public License
1097 # but which still want to provide support for the GNU gettext functionality.
1098 # Please note that the actual code is *not* freely available.
1099
1100 # serial 1
1101
1102 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1103 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1104 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
1105 [# Extract the first word of "$2", so it can be a program name with args.
1106 set dummy $2; ac_word=[$]2
1107 AC_MSG_CHECKING([for $ac_word])
1108 AC_CACHE_VAL(ac_cv_path_$1,
1109 [case "[$]$1" in
1110   /*)
1111   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1112   ;;
1113   *)
1114   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1115   for ac_dir in ifelse([$5], , $PATH, [$5]); do
1116     test -z "$ac_dir" && ac_dir=.
1117     if test -f $ac_dir/$ac_word; then
1118       if [$3]; then
1119         ac_cv_path_$1="$ac_dir/$ac_word"
1120         break
1121       fi
1122     fi
1123   done
1124   IFS="$ac_save_ifs"
1125 dnl If no 4th arg is given, leave the cache variable unset,
1126 dnl so AC_PATH_PROGS will keep looking.
1127 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1128 ])dnl
1129   ;;
1130 esac])dnl
1131 $1="$ac_cv_path_$1"
1132 if test -n "[$]$1"; then
1133   AC_MSG_RESULT([$]$1)
1134 else
1135   AC_MSG_RESULT(no)
1136 fi
1137 AC_SUBST($1)dnl
1138 ])
1139
1140 # Check whether LC_MESSAGES is available in <locale.h>.
1141 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1142 #
1143 # This file can be copied and used freely without restrictions.  It can
1144 # be used in projects which are not available under the GNU Public License
1145 # but which still want to provide support for the GNU gettext functionality.
1146 # Please note that the actual code is *not* freely available.
1147
1148 # serial 1
1149
1150 AC_DEFUN(AM_LC_MESSAGES,
1151   [if test $ac_cv_header_locale_h = yes; then
1152     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1153       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1154        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1155     if test $am_cv_val_LC_MESSAGES = yes; then
1156       AC_DEFINE(HAVE_LC_MESSAGES)
1157     fi
1158   fi])
1159