bfd:
[platform/upstream/binutils.git] / bfd / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.3b
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 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 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
14 AC_DEFUN(BFD_BINARY_FOPEN,
15 [AC_REQUIRE([AC_CANONICAL_SYSTEM])
16 case "${host}" in
17 changequote(,)dnl
18 i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows)
19 changequote([,])dnl
20   AC_DEFINE(USE_BINARY_FOPEN) ;;
21 esac])dnl
22
23 dnl Get a default for CC_FOR_BUILD to put into Makefile.
24 AC_DEFUN(BFD_CC_FOR_BUILD,
25 [# Put a plausible default for CC_FOR_BUILD in Makefile.
26 if test -z "$CC_FOR_BUILD"; then
27   if test "x$cross_compiling" = "xno"; then
28     CC_FOR_BUILD='$(CC)'
29   else
30     CC_FOR_BUILD=gcc
31   fi
32 fi
33 AC_SUBST(CC_FOR_BUILD)
34 # Also set EXEEXT_FOR_BUILD.
35 if test "x$cross_compiling" = "xno"; then
36   EXEEXT_FOR_BUILD='$(EXEEXT)'
37 else
38   AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
39     [cat > ac_c_test.c << 'EOF'
40 int main() {
41 /* Nothing needed here */
42 }
43 EOF
44     ${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
45     bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
46     rm -f ac_c_test*
47     test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
48   EXEEXT_FOR_BUILD=""
49   test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
50 fi
51 AC_SUBST(EXEEXT_FOR_BUILD)])dnl
52
53 dnl See whether we need a declaration for a function.
54 AC_DEFUN(BFD_NEED_DECLARATION,
55 [AC_MSG_CHECKING([whether $1 must be declared])
56 AC_CACHE_VAL(bfd_cv_decl_needed_$1,
57 [AC_TRY_COMPILE([
58 #include <stdio.h>
59 #ifdef HAVE_STRING_H
60 #include <string.h>
61 #else
62 #ifdef HAVE_STRINGS_H
63 #include <strings.h>
64 #endif
65 #endif
66 #ifdef HAVE_STDLIB_H
67 #include <stdlib.h>
68 #endif
69 #ifdef HAVE_UNISTD_H
70 #include <unistd.h>
71 #endif],
72 [char *(*pfn) = (char *(*)) $1],
73 bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
74 AC_MSG_RESULT($bfd_cv_decl_needed_$1)
75 if test $bfd_cv_decl_needed_$1 = yes; then
76   bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
77   AC_DEFINE_UNQUOTED($bfd_tr_decl)
78 fi
79 ])dnl
80
81
82 # This file is derived from `gettext.m4'.  The difference is that the
83 # included macros assume Cygnus-style source and build trees.
84
85 # Macro to add for using GNU gettext.
86 # Ulrich Drepper <drepper@cygnus.com>, 1995.
87 #
88 # This file file be copied and used freely without restrictions.  It can
89 # be used in projects which are not available under the GNU Public License
90 # but which still want to provide support for the GNU gettext functionality.
91 # Please note that the actual code is *not* freely available.
92
93 # serial 3
94
95 AC_DEFUN(CY_WITH_NLS,
96   [AC_MSG_CHECKING([whether NLS is requested])
97     dnl Default is enabled NLS
98     AC_ARG_ENABLE(nls,
99       [  --disable-nls           do not use Native Language Support],
100       USE_NLS=$enableval, USE_NLS=yes)
101     AC_MSG_RESULT($USE_NLS)
102     AC_SUBST(USE_NLS)
103
104     USE_INCLUDED_LIBINTL=no
105
106     dnl If we use NLS figure out what method
107     if test "$USE_NLS" = "yes"; then
108       AC_DEFINE(ENABLE_NLS)
109       AC_MSG_CHECKING([whether included gettext is requested])
110       AC_ARG_WITH(included-gettext,
111         [  --with-included-gettext use the GNU gettext library included here],
112         nls_cv_force_use_gnu_gettext=$withval,
113         nls_cv_force_use_gnu_gettext=no)
114       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
115
116       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
117       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
118         dnl User does not insist on using GNU NLS library.  Figure out what
119         dnl to use.  If gettext or catgets are available (in this order) we
120         dnl use this.  Else we have to fall back to GNU NLS library.
121         dnl catgets is only used if permitted by option --with-catgets.
122         nls_cv_header_intl=
123         nls_cv_header_libgt=
124         CATOBJEXT=NONE
125
126         AC_CHECK_HEADER(libintl.h,
127           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
128             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
129                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
130
131            if test "$gt_cv_func_gettext_libc" != "yes"; then
132              AC_CHECK_LIB(intl, bindtextdomain,
133                [AC_CACHE_CHECK([for gettext in libintl],
134                  gt_cv_func_gettext_libintl,
135                  [AC_TRY_LINK([], [return (int) gettext ("")],
136                  gt_cv_func_gettext_libintl=yes,
137                  gt_cv_func_gettext_libintl=no)])])
138            fi
139
140            if test "$gt_cv_func_gettext_libc" = "yes" \
141               || test "$gt_cv_func_gettext_libintl" = "yes"; then
142               AC_DEFINE(HAVE_GETTEXT)
143               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
144                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
145               if test "$MSGFMT" != "no"; then
146                 AC_CHECK_FUNCS(dcgettext)
147                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
148                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
149                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
150                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
151                                return _nl_msg_cat_cntr],
152                   [CATOBJEXT=.gmo
153                    DATADIRNAME=share],
154                   [CATOBJEXT=.mo
155                    DATADIRNAME=lib])
156                 INSTOBJEXT=.mo
157               fi
158             fi
159         ])
160
161         dnl In the standard gettext, we would now check for catgets.
162         dnl However, we never want to use catgets for our releases.
163
164         if test "$CATOBJEXT" = "NONE"; then
165           dnl Neither gettext nor catgets in included in the C library.
166           dnl Fall back on GNU gettext library.
167           nls_cv_use_gnu_gettext=yes
168         fi
169       fi
170
171       if test "$nls_cv_use_gnu_gettext" = "yes"; then
172         dnl Mark actions used to generate GNU NLS library.
173         INTLOBJS="\$(GETTOBJS)"
174         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
175           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
176         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
177         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
178           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
179         AC_SUBST(MSGFMT)
180         USE_INCLUDED_LIBINTL=yes
181         CATOBJEXT=.gmo
182         INSTOBJEXT=.mo
183         DATADIRNAME=share
184         INTLDEPS='$(top_builddir)/../intl/libintl.a'
185         INTLLIBS=$INTLDEPS
186         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
187         nls_cv_header_intl=libintl.h
188         nls_cv_header_libgt=libgettext.h
189       fi
190
191       dnl Test whether we really found GNU xgettext.
192       if test "$XGETTEXT" != ":"; then
193         dnl If it is no GNU xgettext we define it as : so that the
194         dnl Makefiles still can work.
195         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
196           : ;
197         else
198           AC_MSG_RESULT(
199             [found xgettext programs is not GNU xgettext; ignore it])
200           XGETTEXT=":"
201         fi
202       fi
203
204       # We need to process the po/ directory.
205       POSUB=po
206     else
207       DATADIRNAME=share
208       nls_cv_header_intl=libintl.h
209       nls_cv_header_libgt=libgettext.h
210     fi
211
212     # If this is used in GNU gettext we have to set USE_NLS to `yes'
213     # because some of the sources are only built for this goal.
214     if test "$PACKAGE" = gettext; then
215       USE_NLS=yes
216       USE_INCLUDED_LIBINTL=yes
217     fi
218
219     dnl These rules are solely for the distribution goal.  While doing this
220     dnl we only have to keep exactly one list of the available catalogs
221     dnl in configure.in.
222     for lang in $ALL_LINGUAS; do
223       GMOFILES="$GMOFILES $lang.gmo"
224       POFILES="$POFILES $lang.po"
225     done
226
227     dnl Make all variables we use known to autoconf.
228     AC_SUBST(USE_INCLUDED_LIBINTL)
229     AC_SUBST(CATALOGS)
230     AC_SUBST(CATOBJEXT)
231     AC_SUBST(DATADIRNAME)
232     AC_SUBST(GMOFILES)
233     AC_SUBST(INSTOBJEXT)
234     AC_SUBST(INTLDEPS)
235     AC_SUBST(INTLLIBS)
236     AC_SUBST(INTLOBJS)
237     AC_SUBST(POFILES)
238     AC_SUBST(POSUB)
239   ])
240
241 AC_DEFUN(CY_GNU_GETTEXT,
242   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
243    AC_REQUIRE([AC_PROG_CC])dnl
244    AC_REQUIRE([AC_PROG_RANLIB])dnl
245    AC_REQUIRE([AC_ISC_POSIX])dnl
246    AC_REQUIRE([AC_HEADER_STDC])dnl
247    AC_REQUIRE([AC_C_CONST])dnl
248    AC_REQUIRE([AC_C_INLINE])dnl
249    AC_REQUIRE([AC_TYPE_OFF_T])dnl
250    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
251    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
252    AC_REQUIRE([AC_FUNC_MMAP])dnl
253
254    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
255 unistd.h values.h sys/param.h])
256    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
257 __argz_count __argz_stringify __argz_next])
258
259    if test "${ac_cv_func_stpcpy+set}" != "set"; then
260      AC_CHECK_FUNCS(stpcpy)
261    fi
262    if test "${ac_cv_func_stpcpy}" = "yes"; then
263      AC_DEFINE(HAVE_STPCPY)
264    fi
265
266    AM_LC_MESSAGES
267    CY_WITH_NLS
268
269    if test "x$CATOBJEXT" != "x"; then
270      if test "x$ALL_LINGUAS" = "x"; then
271        LINGUAS=
272      else
273        AC_MSG_CHECKING(for catalogs to be installed)
274        NEW_LINGUAS=
275        for lang in ${LINGUAS=$ALL_LINGUAS}; do
276          case "$ALL_LINGUAS" in
277           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
278          esac
279        done
280        LINGUAS=$NEW_LINGUAS
281        AC_MSG_RESULT($LINGUAS)
282      fi
283
284      dnl Construct list of names of catalog files to be constructed.
285      if test -n "$LINGUAS"; then
286        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
287      fi
288    fi
289
290    dnl The reference to <locale.h> in the installed <libintl.h> file
291    dnl must be resolved because we cannot expect the users of this
292    dnl to define HAVE_LOCALE_H.
293    if test $ac_cv_header_locale_h = yes; then
294      INCLUDE_LOCALE_H="#include <locale.h>"
295    else
296      INCLUDE_LOCALE_H="\
297 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
298    fi
299    AC_SUBST(INCLUDE_LOCALE_H)
300
301    dnl Determine which catalog format we have (if any is needed)
302    dnl For now we know about two different formats:
303    dnl   Linux libc-5 and the normal X/Open format
304    if test -f $srcdir/po2tbl.sed.in; then
305       if test "$CATOBJEXT" = ".cat"; then
306          AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
307
308          dnl Transform the SED scripts while copying because some dumb SEDs
309          dnl cannot handle comments.
310          sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
311       fi
312       dnl po2tbl.sed is always needed.
313       sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
314          $srcdir/po2tbl.sed.in > po2tbl.sed
315    fi
316
317    dnl In the intl/Makefile.in we have a special dependency which makes
318    dnl only sense for gettext.  We comment this out for non-gettext
319    dnl packages.
320    if test "$PACKAGE" = "gettext"; then
321      GT_NO="#NO#"
322      GT_YES=
323    else
324      GT_NO=
325      GT_YES="#YES#"
326    fi
327    AC_SUBST(GT_NO)
328    AC_SUBST(GT_YES)
329
330    MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
331    AC_SUBST(MKINSTALLDIRS)
332
333    dnl *** For now the libtool support in intl/Makefile is not for real.
334    l=
335    AC_SUBST(l)
336
337    dnl Generate list of files to be processed by xgettext which will
338    dnl be included in po/Makefile.  But only do this if the po directory
339    dnl exists in srcdir.
340    if test -d $srcdir/po; then
341       test -d po || mkdir po
342       if test "x$srcdir" != "x."; then
343          if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
344             posrcprefix="$srcdir/"
345          else
346             posrcprefix="../$srcdir/"
347          fi
348       else
349          posrcprefix="../"
350       fi
351       rm -f po/POTFILES
352       sed -e "/^#/d" -e "/^\$/d" -e "s,.*,      $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
353          < $srcdir/po/POTFILES.in > po/POTFILES
354    fi
355   ])
356
357 # Search path for a program which passes the given test.
358 # Ulrich Drepper <drepper@cygnus.com>, 1996.
359 #
360 # This file file be copied and used freely without restrictions.  It can
361 # be used in projects which are not available under the GNU Public License
362 # but which still want to provide support for the GNU gettext functionality.
363 # Please note that the actual code is *not* freely available.
364
365 # serial 1
366
367 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
368 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
369 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
370 [# Extract the first word of "$2", so it can be a program name with args.
371 set dummy $2; ac_word=[$]2
372 AC_MSG_CHECKING([for $ac_word])
373 AC_CACHE_VAL(ac_cv_path_$1,
374 [case "[$]$1" in
375   /*)
376   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
377   ;;
378   *)
379   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
380   for ac_dir in ifelse([$5], , $PATH, [$5]); do
381     test -z "$ac_dir" && ac_dir=.
382     if test -f $ac_dir/$ac_word; then
383       if [$3]; then
384         ac_cv_path_$1="$ac_dir/$ac_word"
385         break
386       fi
387     fi
388   done
389   IFS="$ac_save_ifs"
390 dnl If no 4th arg is given, leave the cache variable unset,
391 dnl so AC_PATH_PROGS will keep looking.
392 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
393 ])dnl
394   ;;
395 esac])dnl
396 $1="$ac_cv_path_$1"
397 if test -n "[$]$1"; then
398   AC_MSG_RESULT([$]$1)
399 else
400   AC_MSG_RESULT(no)
401 fi
402 AC_SUBST($1)dnl
403 ])
404
405 # Check whether LC_MESSAGES is available in <locale.h>.
406 # Ulrich Drepper <drepper@cygnus.com>, 1995.
407 #
408 # This file file be copied and used freely without restrictions.  It can
409 # be used in projects which are not available under the GNU Public License
410 # but which still want to provide support for the GNU gettext functionality.
411 # Please note that the actual code is *not* freely available.
412
413 # serial 1
414
415 AC_DEFUN(AM_LC_MESSAGES,
416   [if test $ac_cv_header_locale_h = yes; then
417     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
418       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
419        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
420     if test $am_cv_val_LC_MESSAGES = yes; then
421       AC_DEFINE(HAVE_LC_MESSAGES)
422     fi
423   fi])
424
425
426 dnl Check for existence of a type $1 in sys/procfs.h
427
428 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
429 [AC_MSG_CHECKING([for $1 in sys/procfs.h])
430  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
431    [AC_TRY_COMPILE([#include <sys/procfs.h>],
432       [$1 avar],
433       bfd_cv_have_sys_procfs_type_$1=yes
434       AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])),
435       bfd_cv_have_sys_procfs_type_$1=no
436    )])
437  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
438 ])
439
440
441 dnl Check for existence of member $2 in type $1 in sys/procfs.h
442
443 AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
444 [AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
445  AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
446    [AC_TRY_COMPILE([#include <sys/procfs.h>],
447       [$1 avar; void* aref = (void*) &avar.$2],
448       bfd_cv_have_sys_procfs_type_member_$1_$2=yes
449       AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z])),
450       bfd_cv_have_sys_procfs_type_member_$1_$2=no
451    )])
452  AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
453 ])
454
455
456
457 # Do all the work for Automake.  This macro actually does too much --
458 # some checks are only needed if your package does certain things.
459 # But this isn't really a big deal.
460
461 # serial 1
462
463 dnl Usage:
464 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
465
466 AC_DEFUN(AM_INIT_AUTOMAKE,
467 [AC_REQUIRE([AM_PROG_INSTALL])
468 PACKAGE=[$1]
469 AC_SUBST(PACKAGE)
470 VERSION=[$2]
471 AC_SUBST(VERSION)
472 dnl test to see if srcdir already configured
473 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
474   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
475 fi
476 ifelse([$3],,
477 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
478 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
479 AC_REQUIRE([AM_SANITY_CHECK])
480 AC_REQUIRE([AC_ARG_PROGRAM])
481 dnl FIXME This is truly gross.
482 missing_dir=`cd $ac_aux_dir && pwd`
483 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
484 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
485 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
486 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
487 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
488 AC_REQUIRE([AC_PROG_MAKE_SET])])
489
490
491 # serial 1
492
493 AC_DEFUN(AM_PROG_INSTALL,
494 [AC_REQUIRE([AC_PROG_INSTALL])
495 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
496 AC_SUBST(INSTALL_SCRIPT)dnl
497 ])
498
499 #
500 # Check to make sure that the build environment is sane.
501 #
502
503 AC_DEFUN(AM_SANITY_CHECK,
504 [AC_MSG_CHECKING([whether build environment is sane])
505 # Just in case
506 sleep 1
507 echo timestamp > conftestfile
508 # Do `set' in a subshell so we don't clobber the current shell's
509 # arguments.  Must try -L first in case configure is actually a
510 # symlink; some systems play weird games with the mod time of symlinks
511 # (eg FreeBSD returns the mod time of the symlink's containing
512 # directory).
513 if (
514    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
515    if test "[$]*" = "X"; then
516       # -L didn't work.
517       set X `ls -t $srcdir/configure conftestfile`
518    fi
519    if test "[$]*" != "X $srcdir/configure conftestfile" \
520       && test "[$]*" != "X conftestfile $srcdir/configure"; then
521
522       # If neither matched, then we have a broken ls.  This can happen
523       # if, for instance, CONFIG_SHELL is bash and it inherits a
524       # broken ls alias from the environment.  This has actually
525       # happened.  Such a system could not be considered "sane".
526       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
527 alias in your environment])
528    fi
529
530    test "[$]2" = conftestfile
531    )
532 then
533    # Ok.
534    :
535 else
536    AC_MSG_ERROR([newly created file is older than distributed files!
537 Check your system clock])
538 fi
539 rm -f conftest*
540 AC_MSG_RESULT(yes)])
541
542 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
543 dnl The program must properly implement --version.
544 AC_DEFUN(AM_MISSING_PROG,
545 [AC_MSG_CHECKING(for working $2)
546 # Run test in a subshell; some versions of sh will print an error if
547 # an executable is not found, even if stderr is redirected.
548 # Redirect stdin to placate older versions of autoconf.  Sigh.
549 if ($2 --version) < /dev/null > /dev/null 2>&1; then
550    $1=$2
551    AC_MSG_RESULT(found)
552 else
553    $1="$3/missing $2"
554    AC_MSG_RESULT(missing)
555 fi
556 AC_SUBST($1)])
557
558
559 # serial 25 AM_PROG_LIBTOOL
560 AC_DEFUN(AM_PROG_LIBTOOL,
561 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
562 AC_REQUIRE([AM_ENABLE_STATIC])dnl
563 AC_REQUIRE([AC_CANONICAL_HOST])dnl
564 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
565 AC_REQUIRE([AC_PROG_RANLIB])dnl
566 AC_REQUIRE([AC_PROG_CC])dnl
567 AC_REQUIRE([AM_PROG_LD])dnl
568 AC_REQUIRE([AM_PROG_NM])dnl
569 AC_REQUIRE([AC_PROG_LN_S])dnl
570 dnl
571 # Always use our own libtool.
572 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
573 AC_SUBST(LIBTOOL)dnl
574
575 # Check for any special flags to pass to ltconfig.
576 libtool_flags=
577 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
578 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
579 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
580 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
581 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
582
583 # Some flags need to be propagated to the compiler or linker for good
584 # libtool support.
585 case "$host" in
586 *-*-irix6*)
587   # Find out which ABI we are using.
588   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
589   if AC_TRY_EVAL(ac_compile); then
590     case "`/usr/bin/file conftest.o`" in
591     *32-bit*)
592       LD="${LD-ld} -32"
593       ;;
594     *N32*)
595       LD="${LD-ld} -n32"
596       ;;
597     *64-bit*)
598       LD="${LD-ld} -64"
599       ;;
600     esac
601   fi
602   rm -rf conftest*
603   ;;
604
605 *-*-sco3.2v5*)
606   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
607   CFLAGS="$CFLAGS -belf"
608   ;;
609
610 *-*-cygwin32*)
611   AM_SYS_LIBTOOL_CYGWIN32
612   ;;
613
614 esac
615
616 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
617 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
618 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
619 DLLTOOL="$DLLTOOL" AS="$AS" \
620 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
621 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
622 || AC_MSG_ERROR([libtool configure failed])
623
624 # Redirect the config.log output again, so that the ltconfig log is not
625 # clobbered by the next message.
626 exec 5>>./config.log
627 ])
628
629 # AM_ENABLE_SHARED - implement the --enable-shared flag
630 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
631 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
632 #   `yes'.
633 AC_DEFUN(AM_ENABLE_SHARED,
634 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
635 AC_ARG_ENABLE(shared,
636 changequote(<<, >>)dnl
637 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
638 changequote([, ])dnl
639 [p=${PACKAGE-default}
640 case "$enableval" in
641 yes) enable_shared=yes ;;
642 no) enable_shared=no ;;
643 *)
644   enable_shared=no
645   # Look at the argument we got.  We use all the common list separators.
646   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
647   for pkg in $enableval; do
648     if test "X$pkg" = "X$p"; then
649       enable_shared=yes
650     fi
651   done
652   IFS="$ac_save_ifs"
653   ;;
654 esac],
655 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
656 ])
657
658 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
659 AC_DEFUN(AM_DISABLE_SHARED,
660 [AM_ENABLE_SHARED(no)])
661
662 # AM_DISABLE_STATIC - set the default static flag to --disable-static
663 AC_DEFUN(AM_DISABLE_STATIC,
664 [AM_ENABLE_STATIC(no)])
665
666 # AM_ENABLE_STATIC - implement the --enable-static flag
667 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
668 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
669 #   `yes'.
670 AC_DEFUN(AM_ENABLE_STATIC,
671 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
672 AC_ARG_ENABLE(static,
673 changequote(<<, >>)dnl
674 <<  --enable-static[=PKGS]  build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
675 changequote([, ])dnl
676 [p=${PACKAGE-default}
677 case "$enableval" in
678 yes) enable_static=yes ;;
679 no) enable_static=no ;;
680 *)
681   enable_static=no
682   # Look at the argument we got.  We use all the common list separators.
683   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
684   for pkg in $enableval; do
685     if test "X$pkg" = "X$p"; then
686       enable_static=yes
687     fi
688   done
689   IFS="$ac_save_ifs"
690   ;;
691 esac],
692 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
693 ])
694
695
696 # AM_PROG_LD - find the path to the GNU or non-GNU linker
697 AC_DEFUN(AM_PROG_LD,
698 [AC_ARG_WITH(gnu-ld,
699 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
700 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
701 AC_REQUIRE([AC_PROG_CC])
702 ac_prog=ld
703 if test "$ac_cv_prog_gcc" = yes; then
704   # Check if gcc -print-prog-name=ld gives a path.
705   AC_MSG_CHECKING([for ld used by GCC])
706   ac_prog=`($CC -print-prog-name=ld) 2>&5`
707   case "$ac_prog" in
708   # Accept absolute paths.
709 changequote(,)dnl
710   /* | [A-Za-z]:\\*)
711 changequote([,])dnl
712     test -z "$LD" && LD="$ac_prog"
713     ;;
714   "")
715     # If it fails, then pretend we aren't using GCC.
716     ac_prog=ld
717     ;;
718   *)
719     # If it is relative, then search for the first ld in PATH.
720     with_gnu_ld=unknown
721     ;;
722   esac
723 elif test "$with_gnu_ld" = yes; then
724   AC_MSG_CHECKING([for GNU ld])
725 else
726   AC_MSG_CHECKING([for non-GNU ld])
727 fi
728 AC_CACHE_VAL(ac_cv_path_LD,
729 [if test -z "$LD"; then
730   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
731   for ac_dir in $PATH; do
732     test -z "$ac_dir" && ac_dir=.
733     if test -f "$ac_dir/$ac_prog"; then
734       ac_cv_path_LD="$ac_dir/$ac_prog"
735       # Check to see if the program is GNU ld.  I'd rather use --version,
736       # but apparently some GNU ld's only accept -v.
737       # Break only if it was the GNU/non-GNU ld that we prefer.
738       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
739         test "$with_gnu_ld" != no && break
740       else
741         test "$with_gnu_ld" != yes && break
742       fi
743     fi
744   done
745   IFS="$ac_save_ifs"
746 else
747   ac_cv_path_LD="$LD" # Let the user override the test with a path.
748 fi])
749 LD="$ac_cv_path_LD"
750 if test -n "$LD"; then
751   AC_MSG_RESULT($LD)
752 else
753   AC_MSG_RESULT(no)
754 fi
755 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
756 AC_SUBST(LD)
757 AM_PROG_LD_GNU
758 ])
759
760 AC_DEFUN(AM_PROG_LD_GNU,
761 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
762 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
763 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
764   ac_cv_prog_gnu_ld=yes
765 else
766   ac_cv_prog_gnu_ld=no
767 fi])
768 ])
769
770 # AM_PROG_NM - find the path to a BSD-compatible name lister
771 AC_DEFUN(AM_PROG_NM,
772 [AC_MSG_CHECKING([for BSD-compatible nm])
773 AC_CACHE_VAL(ac_cv_path_NM,
774 [if test -n "$NM"; then
775   # Let the user override the test.
776   ac_cv_path_NM="$NM"
777 else
778   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
779   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
780     test -z "$ac_dir" && ac_dir=.
781     if test -f $ac_dir/nm; then
782       # Check to see if the nm accepts a BSD-compat flag.
783       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
784       #   nm: unknown option "B" ignored
785       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
786         ac_cv_path_NM="$ac_dir/nm -B"
787       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
788         ac_cv_path_NM="$ac_dir/nm -p"
789       else
790         ac_cv_path_NM="$ac_dir/nm"
791       fi
792       break
793     fi
794   done
795   IFS="$ac_save_ifs"
796   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
797 fi])
798 NM="$ac_cv_path_NM"
799 AC_MSG_RESULT([$NM])
800 AC_SUBST(NM)
801 ])
802
803 # AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
804 AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
805 [AC_CHECK_TOOL(DLLTOOL, dlltool, false)
806 AC_CHECK_TOOL(AS, as, false)
807 ])
808
809 # Like AC_CONFIG_HEADER, but automatically create stamp file.
810
811 AC_DEFUN(AM_CONFIG_HEADER,
812 [AC_PREREQ([2.12])
813 AC_CONFIG_HEADER([$1])
814 dnl When config.status generates a header, we must update the stamp-h file.
815 dnl This file resides in the same directory as the config header
816 dnl that is generated.  We must strip everything past the first ":",
817 dnl and everything past the last "/".
818 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
819 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
820 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
821 <<am_indx=1
822 for am_file in <<$1>>; do
823   case " <<$>>CONFIG_HEADERS " in
824   *" <<$>>am_file "*<<)>>
825     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
826     ;;
827   esac
828   am_indx=`expr "<<$>>am_indx" + 1`
829 done<<>>dnl>>)
830 changequote([,]))])
831
832 # Add --enable-maintainer-mode option to configure.
833 # From Jim Meyering
834
835 # serial 1
836
837 AC_DEFUN(AM_MAINTAINER_MODE,
838 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
839   dnl maintainer-mode is disabled by default
840   AC_ARG_ENABLE(maintainer-mode,
841 [  --enable-maintainer-mode enable make rules and dependencies not useful
842                           (and sometimes confusing) to the casual installer],
843       USE_MAINTAINER_MODE=$enableval,
844       USE_MAINTAINER_MODE=no)
845   AC_MSG_RESULT($USE_MAINTAINER_MODE)
846   if test $USE_MAINTAINER_MODE = yes; then
847     MAINT=
848   else
849     MAINT='#M#'
850   fi
851   AC_SUBST(MAINT)dnl
852 ]
853 )
854
855 # Check to see if we're running under Cygwin32, without using
856 # AC_CANONICAL_*.  If so, set output variable CYGWIN32 to "yes".
857 # Otherwise set it to "no".
858
859 dnl AM_CYGWIN32()
860 AC_DEFUN(AM_CYGWIN32,
861 [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
862 [AC_TRY_COMPILE(,[return __CYGWIN32__;],
863 am_cv_cygwin32=yes, am_cv_cygwin32=no)
864 rm -f conftest*])
865 CYGWIN32=
866 test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
867
868 # Check to see if we're running under Win32, without using
869 # AC_CANONICAL_*.  If so, set output variable EXEEXT to ".exe".
870 # Otherwise set it to "".
871
872 dnl AM_EXEEXT()
873 dnl This knows we add .exe if we're building in the Cygwin32
874 dnl environment. But if we're not, then it compiles a test program
875 dnl to see if there is a suffix for executables.
876 AC_DEFUN(AM_EXEEXT,
877 [AC_REQUIRE([AM_CYGWIN32])
878 AC_REQUIRE([AM_MINGW32])
879 AC_MSG_CHECKING([for executable suffix])
880 AC_CACHE_VAL(am_cv_exeext,
881 [if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
882 am_cv_exeext=.exe
883 else
884 cat > am_c_test.c << 'EOF'
885 int main() {
886 /* Nothing needed here */
887 }
888 EOF
889 ${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
890 am_cv_exeext=
891 for file in am_c_test.*; do
892    case $file in
893     *.c) ;;
894     *.o) ;;
895     *) am_cv_exeext=`echo $file | sed -e s/am_c_test//` ;;
896    esac
897 done
898 rm -f am_c_test*])
899 test x"${am_cv_exeext}" = x && am_cv_exeext=no
900 fi
901 EXEEXT=""
902 test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
903 AC_MSG_RESULT(${am_cv_exeext})
904 AC_SUBST(EXEEXT)])
905
906 # Check to see if we're running under Mingw, without using
907 # AC_CANONICAL_*.  If so, set output variable MINGW32 to "yes".
908 # Otherwise set it to "no".
909
910 dnl AM_MINGW32()
911 AC_DEFUN(AM_MINGW32,
912 [AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32,
913 [AC_TRY_COMPILE(,[return __MINGW32__;],
914 am_cv_mingw32=yes, am_cv_mingw32=no)
915 rm -f conftest*])
916 MINGW32=
917 test "$am_cv_mingw32" = yes && MINGW32=yes])
918