Increase minor version number (to 2.10.91) to help tools detect the new
[external/binutils.git] / binutils / 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 sinclude(../bfd/acinclude.m4)
14
15 dnl sinclude(../libtool.m4) already included in bfd/acinclude.m4
16 dnl The lines below arrange for aclocal not to bring libtool.m4
17 dnl AM_PROG_LIBTOOL into aclocal.m4, while still arranging for automake
18 dnl to add a definition of LIBTOOL to Makefile.in.
19 ifelse(yes,no,[
20 AC_DEFUN([AM_PROG_LIBTOOL],)
21 AC_SUBST(LIBTOOL)
22 ])
23
24 dnl sinclude(../gettext.m4) already included in bfd/acinclude.m4
25 ifelse(yes,no,[
26 AC_DEFUN([CY_WITH_NLS],)
27 AC_SUBST(INTLLIBS)
28 ])
29
30 # Do all the work for Automake.  This macro actually does too much --
31 # some checks are only needed if your package does certain things.
32 # But this isn't really a big deal.
33
34 # serial 1
35
36 dnl Usage:
37 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
38
39 AC_DEFUN(AM_INIT_AUTOMAKE,
40 [AC_REQUIRE([AC_PROG_INSTALL])
41 PACKAGE=[$1]
42 AC_SUBST(PACKAGE)
43 VERSION=[$2]
44 AC_SUBST(VERSION)
45 dnl test to see if srcdir already configured
46 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
47   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
48 fi
49 ifelse([$3],,
50 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
51 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
52 AC_REQUIRE([AM_SANITY_CHECK])
53 AC_REQUIRE([AC_ARG_PROGRAM])
54 dnl FIXME This is truly gross.
55 missing_dir=`cd $ac_aux_dir && pwd`
56 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
57 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
58 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
59 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
60 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
61 AC_REQUIRE([AC_PROG_MAKE_SET])])
62
63 #
64 # Check to make sure that the build environment is sane.
65 #
66
67 AC_DEFUN(AM_SANITY_CHECK,
68 [AC_MSG_CHECKING([whether build environment is sane])
69 # Just in case
70 sleep 1
71 echo timestamp > conftestfile
72 # Do `set' in a subshell so we don't clobber the current shell's
73 # arguments.  Must try -L first in case configure is actually a
74 # symlink; some systems play weird games with the mod time of symlinks
75 # (eg FreeBSD returns the mod time of the symlink's containing
76 # directory).
77 if (
78    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
79    if test "[$]*" = "X"; then
80       # -L didn't work.
81       set X `ls -t $srcdir/configure conftestfile`
82    fi
83    if test "[$]*" != "X $srcdir/configure conftestfile" \
84       && test "[$]*" != "X conftestfile $srcdir/configure"; then
85
86       # If neither matched, then we have a broken ls.  This can happen
87       # if, for instance, CONFIG_SHELL is bash and it inherits a
88       # broken ls alias from the environment.  This has actually
89       # happened.  Such a system could not be considered "sane".
90       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
91 alias in your environment])
92    fi
93
94    test "[$]2" = conftestfile
95    )
96 then
97    # Ok.
98    :
99 else
100    AC_MSG_ERROR([newly created file is older than distributed files!
101 Check your system clock])
102 fi
103 rm -f conftest*
104 AC_MSG_RESULT(yes)])
105
106 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
107 dnl The program must properly implement --version.
108 AC_DEFUN(AM_MISSING_PROG,
109 [AC_MSG_CHECKING(for working $2)
110 # Run test in a subshell; some versions of sh will print an error if
111 # an executable is not found, even if stderr is redirected.
112 # Redirect stdin to placate older versions of autoconf.  Sigh.
113 if ($2 --version) < /dev/null > /dev/null 2>&1; then
114    $1=$2
115    AC_MSG_RESULT(found)
116 else
117    $1="$3/missing $2"
118    AC_MSG_RESULT(missing)
119 fi
120 AC_SUBST($1)])
121
122 # Like AC_CONFIG_HEADER, but automatically create stamp file.
123
124 AC_DEFUN(AM_CONFIG_HEADER,
125 [AC_PREREQ([2.12])
126 AC_CONFIG_HEADER([$1])
127 dnl When config.status generates a header, we must update the stamp-h file.
128 dnl This file resides in the same directory as the config header
129 dnl that is generated.  We must strip everything past the first ":",
130 dnl and everything past the last "/".
131 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
132 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
133 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
134 <<am_indx=1
135 for am_file in <<$1>>; do
136   case " <<$>>CONFIG_HEADERS " in
137   *" <<$>>am_file "*<<)>>
138     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
139     ;;
140   esac
141   am_indx=`expr "<<$>>am_indx" + 1`
142 done<<>>dnl>>)
143 changequote([,]))])
144
145
146 dnl AM_PROG_LEX
147 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
148 AC_DEFUN(AM_PROG_LEX,
149 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
150 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
151 AC_PROG_LEX
152 AC_DECL_YYTEXT])
153
154 # This file is derived from `gettext.m4'.  The difference is that the
155 # included macros assume Cygnus-style source and build trees.
156
157 # Macro to add for using GNU gettext.
158 # Ulrich Drepper <drepper@cygnus.com>, 1995.
159 #
160 # This file file be copied and used freely without restrictions.  It can
161 # be used in projects which are not available under the GNU Public License
162 # but which still want to provide support for the GNU gettext functionality.
163 # Please note that the actual code is *not* freely available.
164
165 # serial 3
166
167 AC_DEFUN(CY_WITH_NLS,
168   [AC_MSG_CHECKING([whether NLS is requested])
169     dnl Default is enabled NLS
170     AC_ARG_ENABLE(nls,
171       [  --disable-nls           do not use Native Language Support],
172       USE_NLS=$enableval, USE_NLS=yes)
173     AC_MSG_RESULT($USE_NLS)
174     AC_SUBST(USE_NLS)
175
176     USE_INCLUDED_LIBINTL=no
177
178     dnl If we use NLS figure out what method
179     if test "$USE_NLS" = "yes"; then
180       AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
181       AC_MSG_CHECKING([whether included gettext is requested])
182       AC_ARG_WITH(included-gettext,
183         [  --with-included-gettext use the GNU gettext library included here],
184         nls_cv_force_use_gnu_gettext=$withval,
185         nls_cv_force_use_gnu_gettext=no)
186       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
187
188       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
189       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
190         dnl User does not insist on using GNU NLS library.  Figure out what
191         dnl to use.  If gettext or catgets are available (in this order) we
192         dnl use this.  Else we have to fall back to GNU NLS library.
193         dnl catgets is only used if permitted by option --with-catgets.
194         nls_cv_header_intl=
195         nls_cv_header_libgt=
196         CATOBJEXT=NONE
197
198         AC_CHECK_HEADER(libintl.h,
199           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
200             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
201                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
202
203            if test "$gt_cv_func_gettext_libc" != "yes"; then
204              AC_CHECK_LIB(intl, bindtextdomain,
205                [AC_CACHE_CHECK([for gettext in libintl],
206                  gt_cv_func_gettext_libintl,
207                  [AC_TRY_LINK([], [return (int) gettext ("")],
208                  gt_cv_func_gettext_libintl=yes,
209                  gt_cv_func_gettext_libintl=no)])])
210            fi
211
212            if test "$gt_cv_func_gettext_libc" = "yes" \
213               || test "$gt_cv_func_gettext_libintl" = "yes"; then
214               AC_DEFINE(HAVE_GETTEXT, 1,
215                         [Define as 1 if you have gettext and don't want to use GNU gettext.])
216               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
217                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
218               if test "$MSGFMT" != "no"; then
219                 AC_CHECK_FUNCS(dcgettext)
220                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
221                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
222                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
223                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
224                                return _nl_msg_cat_cntr],
225                   [CATOBJEXT=.gmo
226                    DATADIRNAME=share],
227                   [CATOBJEXT=.mo
228                    DATADIRNAME=lib])
229                 INSTOBJEXT=.mo
230               fi
231             fi
232         ])
233
234         dnl In the standard gettext, we would now check for catgets.
235         dnl However, we never want to use catgets for our releases.
236
237         if test "$CATOBJEXT" = "NONE"; then
238           dnl Neither gettext nor catgets in included in the C library.
239           dnl Fall back on GNU gettext library.
240           nls_cv_use_gnu_gettext=yes
241         fi
242       fi
243
244       if test "$nls_cv_use_gnu_gettext" = "yes"; then
245         dnl Mark actions used to generate GNU NLS library.
246         INTLOBJS="\$(GETTOBJS)"
247         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
248           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
249         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
250         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
251           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
252         AC_SUBST(MSGFMT)
253         USE_INCLUDED_LIBINTL=yes
254         CATOBJEXT=.gmo
255         INSTOBJEXT=.mo
256         DATADIRNAME=share
257         INTLDEPS='$(top_builddir)/../intl/libintl.a'
258         INTLLIBS=$INTLDEPS
259         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
260         nls_cv_header_intl=libintl.h
261         nls_cv_header_libgt=libgettext.h
262       fi
263
264       dnl Test whether we really found GNU xgettext.
265       if test "$XGETTEXT" != ":"; then
266         dnl If it is no GNU xgettext we define it as : so that the
267         dnl Makefiles still can work.
268         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
269           : ;
270         else
271           AC_MSG_RESULT(
272             [found xgettext programs is not GNU xgettext; ignore it])
273           XGETTEXT=":"
274         fi
275       fi
276
277       # We need to process the po/ directory.
278       POSUB=po
279     else
280       DATADIRNAME=share
281       nls_cv_header_intl=libintl.h
282       nls_cv_header_libgt=libgettext.h
283     fi
284
285     # If this is used in GNU gettext we have to set USE_NLS to `yes'
286     # because some of the sources are only built for this goal.
287     if test "$PACKAGE" = gettext; then
288       USE_NLS=yes
289       USE_INCLUDED_LIBINTL=yes
290     fi
291
292     dnl These rules are solely for the distribution goal.  While doing this
293     dnl we only have to keep exactly one list of the available catalogs
294     dnl in configure.in.
295     for lang in $ALL_LINGUAS; do
296       GMOFILES="$GMOFILES $lang.gmo"
297       POFILES="$POFILES $lang.po"
298     done
299
300     dnl Make all variables we use known to autoconf.
301     AC_SUBST(USE_INCLUDED_LIBINTL)
302     AC_SUBST(CATALOGS)
303     AC_SUBST(CATOBJEXT)
304     AC_SUBST(DATADIRNAME)
305     AC_SUBST(GMOFILES)
306     AC_SUBST(INSTOBJEXT)
307     AC_SUBST(INTLDEPS)
308     AC_SUBST(INTLLIBS)
309     AC_SUBST(INTLOBJS)
310     AC_SUBST(POFILES)
311     AC_SUBST(POSUB)
312   ])
313
314 AC_DEFUN(CY_GNU_GETTEXT,
315   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
316    AC_REQUIRE([AC_PROG_CC])dnl
317    AC_REQUIRE([AC_PROG_RANLIB])dnl
318    AC_REQUIRE([AC_ISC_POSIX])dnl
319    AC_REQUIRE([AC_HEADER_STDC])dnl
320    AC_REQUIRE([AC_C_CONST])dnl
321    AC_REQUIRE([AC_C_INLINE])dnl
322    AC_REQUIRE([AC_TYPE_OFF_T])dnl
323    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
324    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
325    AC_REQUIRE([AC_FUNC_MMAP])dnl
326
327    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
328 unistd.h values.h sys/param.h])
329    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
330 __argz_count __argz_stringify __argz_next])
331
332    if test "${ac_cv_func_stpcpy+set}" != "set"; then
333      AC_CHECK_FUNCS(stpcpy)
334    fi
335    if test "${ac_cv_func_stpcpy}" = "yes"; then
336      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
337    fi
338
339    AM_LC_MESSAGES
340    CY_WITH_NLS
341
342    if test "x$CATOBJEXT" != "x"; then
343      if test "x$ALL_LINGUAS" = "x"; then
344        LINGUAS=
345      else
346        AC_MSG_CHECKING(for catalogs to be installed)
347        NEW_LINGUAS=
348        for lang in ${LINGUAS=$ALL_LINGUAS}; do
349          case "$ALL_LINGUAS" in
350           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
351          esac
352        done
353        LINGUAS=$NEW_LINGUAS
354        AC_MSG_RESULT($LINGUAS)
355      fi
356
357      dnl Construct list of names of catalog files to be constructed.
358      if test -n "$LINGUAS"; then
359        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
360      fi
361    fi
362
363    dnl The reference to <locale.h> in the installed <libintl.h> file
364    dnl must be resolved because we cannot expect the users of this
365    dnl to define HAVE_LOCALE_H.
366    if test $ac_cv_header_locale_h = yes; then
367      INCLUDE_LOCALE_H="#include <locale.h>"
368    else
369      INCLUDE_LOCALE_H="\
370 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
371    fi
372    AC_SUBST(INCLUDE_LOCALE_H)
373
374    dnl Determine which catalog format we have (if any is needed)
375    dnl For now we know about two different formats:
376    dnl   Linux libc-5 and the normal X/Open format
377    if test -f $srcdir/po2tbl.sed.in; then
378       if test "$CATOBJEXT" = ".cat"; then
379          AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
380
381          dnl Transform the SED scripts while copying because some dumb SEDs
382          dnl cannot handle comments.
383          sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
384       fi
385       dnl po2tbl.sed is always needed.
386       sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
387          $srcdir/po2tbl.sed.in > po2tbl.sed
388    fi
389
390    dnl In the intl/Makefile.in we have a special dependency which makes
391    dnl only sense for gettext.  We comment this out for non-gettext
392    dnl packages.
393    if test "$PACKAGE" = "gettext"; then
394      GT_NO="#NO#"
395      GT_YES=
396    else
397      GT_NO=
398      GT_YES="#YES#"
399    fi
400    AC_SUBST(GT_NO)
401    AC_SUBST(GT_YES)
402
403    MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
404    AC_SUBST(MKINSTALLDIRS)
405
406    dnl *** For now the libtool support in intl/Makefile is not for real.
407    l=
408    AC_SUBST(l)
409
410    dnl Generate list of files to be processed by xgettext which will
411    dnl be included in po/Makefile.  But only do this if the po directory
412    dnl exists in srcdir.
413    if test -d $srcdir/po; then
414       test -d po || mkdir po
415       if test "x$srcdir" != "x."; then
416          if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
417             posrcprefix="$srcdir/"
418          else
419             posrcprefix="../$srcdir/"
420          fi
421       else
422          posrcprefix="../"
423       fi
424       rm -f po/POTFILES
425       sed -e "/^#/d" -e "/^\$/d" -e "s,.*,      $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
426          < $srcdir/po/POTFILES.in > po/POTFILES
427    fi
428   ])
429
430 # Search path for a program which passes the given test.
431 # Ulrich Drepper <drepper@cygnus.com>, 1996.
432 #
433 # This file file be copied and used freely without restrictions.  It can
434 # be used in projects which are not available under the GNU Public License
435 # but which still want to provide support for the GNU gettext functionality.
436 # Please note that the actual code is *not* freely available.
437
438 # serial 1
439
440 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
441 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
442 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
443 [# Extract the first word of "$2", so it can be a program name with args.
444 set dummy $2; ac_word=[$]2
445 AC_MSG_CHECKING([for $ac_word])
446 AC_CACHE_VAL(ac_cv_path_$1,
447 [case "[$]$1" in
448   /*)
449   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
450   ;;
451   *)
452   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
453   for ac_dir in ifelse([$5], , $PATH, [$5]); do
454     test -z "$ac_dir" && ac_dir=.
455     if test -f $ac_dir/$ac_word; then
456       if [$3]; then
457         ac_cv_path_$1="$ac_dir/$ac_word"
458         break
459       fi
460     fi
461   done
462   IFS="$ac_save_ifs"
463 dnl If no 4th arg is given, leave the cache variable unset,
464 dnl so AC_PATH_PROGS will keep looking.
465 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
466 ])dnl
467   ;;
468 esac])dnl
469 $1="$ac_cv_path_$1"
470 if test -n "[$]$1"; then
471   AC_MSG_RESULT([$]$1)
472 else
473   AC_MSG_RESULT(no)
474 fi
475 AC_SUBST($1)dnl
476 ])
477
478 # Check whether LC_MESSAGES is available in <locale.h>.
479 # Ulrich Drepper <drepper@cygnus.com>, 1995.
480 #
481 # This file file be copied and used freely without restrictions.  It can
482 # be used in projects which are not available under the GNU Public License
483 # but which still want to provide support for the GNU gettext functionality.
484 # Please note that the actual code is *not* freely available.
485
486 # serial 1
487
488 AC_DEFUN(AM_LC_MESSAGES,
489   [if test $ac_cv_header_locale_h = yes; then
490     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
491       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
492        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
493     if test $am_cv_val_LC_MESSAGES = yes; then
494       AC_DEFINE(HAVE_LC_MESSAGES, 1,
495                 [Define if your locale.h file contains LC_MESSAGES.])
496     fi
497   fi])
498
499 # Add --enable-maintainer-mode option to configure.
500 # From Jim Meyering
501
502 # serial 1
503
504 AC_DEFUN(AM_MAINTAINER_MODE,
505 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
506   dnl maintainer-mode is disabled by default
507   AC_ARG_ENABLE(maintainer-mode,
508 [  --enable-maintainer-mode enable make rules and dependencies not useful
509                           (and sometimes confusing) to the casual installer],
510       USE_MAINTAINER_MODE=$enableval,
511       USE_MAINTAINER_MODE=no)
512   AC_MSG_RESULT($USE_MAINTAINER_MODE)
513   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
514   MAINT=$MAINTAINER_MODE_TRUE
515   AC_SUBST(MAINT)dnl
516 ]
517 )
518
519 # Define a conditional.
520
521 AC_DEFUN(AM_CONDITIONAL,
522 [AC_SUBST($1_TRUE)
523 AC_SUBST($1_FALSE)
524 if $2; then
525   $1_TRUE=
526   $1_FALSE='#'
527 else
528   $1_TRUE='#'
529   $1_FALSE=
530 fi])
531