Increase minor version number (to 2.10.91) to help tools detect the new
[external/binutils.git] / ld / 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 # This file is derived from `gettext.m4'.  The difference is that the
146 # included macros assume Cygnus-style source and build trees.
147
148 # Macro to add for using GNU gettext.
149 # Ulrich Drepper <drepper@cygnus.com>, 1995.
150 #
151 # This file file be copied and used freely without restrictions.  It can
152 # be used in projects which are not available under the GNU Public License
153 # but which still want to provide support for the GNU gettext functionality.
154 # Please note that the actual code is *not* freely available.
155
156 # serial 3
157
158 AC_DEFUN(CY_WITH_NLS,
159   [AC_MSG_CHECKING([whether NLS is requested])
160     dnl Default is enabled NLS
161     AC_ARG_ENABLE(nls,
162       [  --disable-nls           do not use Native Language Support],
163       USE_NLS=$enableval, USE_NLS=yes)
164     AC_MSG_RESULT($USE_NLS)
165     AC_SUBST(USE_NLS)
166
167     USE_INCLUDED_LIBINTL=no
168
169     dnl If we use NLS figure out what method
170     if test "$USE_NLS" = "yes"; then
171       AC_DEFINE(ENABLE_NLS, 1, [Define to 1 if NLS is requested])
172       AC_MSG_CHECKING([whether included gettext is requested])
173       AC_ARG_WITH(included-gettext,
174         [  --with-included-gettext use the GNU gettext library included here],
175         nls_cv_force_use_gnu_gettext=$withval,
176         nls_cv_force_use_gnu_gettext=no)
177       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
178
179       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
180       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
181         dnl User does not insist on using GNU NLS library.  Figure out what
182         dnl to use.  If gettext or catgets are available (in this order) we
183         dnl use this.  Else we have to fall back to GNU NLS library.
184         dnl catgets is only used if permitted by option --with-catgets.
185         nls_cv_header_intl=
186         nls_cv_header_libgt=
187         CATOBJEXT=NONE
188
189         AC_CHECK_HEADER(libintl.h,
190           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
191             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
192                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
193
194            if test "$gt_cv_func_gettext_libc" != "yes"; then
195              AC_CHECK_LIB(intl, bindtextdomain,
196                [AC_CACHE_CHECK([for gettext in libintl],
197                  gt_cv_func_gettext_libintl,
198                  [AC_TRY_LINK([], [return (int) gettext ("")],
199                  gt_cv_func_gettext_libintl=yes,
200                  gt_cv_func_gettext_libintl=no)])])
201            fi
202
203            if test "$gt_cv_func_gettext_libc" = "yes" \
204               || test "$gt_cv_func_gettext_libintl" = "yes"; then
205               AC_DEFINE(HAVE_GETTEXT, 1,
206                         [Define as 1 if you have gettext and don't want to use GNU gettext.])
207               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
208                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
209               if test "$MSGFMT" != "no"; then
210                 AC_CHECK_FUNCS(dcgettext)
211                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
212                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
213                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
214                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
215                                return _nl_msg_cat_cntr],
216                   [CATOBJEXT=.gmo
217                    DATADIRNAME=share],
218                   [CATOBJEXT=.mo
219                    DATADIRNAME=lib])
220                 INSTOBJEXT=.mo
221               fi
222             fi
223         ])
224
225         dnl In the standard gettext, we would now check for catgets.
226         dnl However, we never want to use catgets for our releases.
227
228         if test "$CATOBJEXT" = "NONE"; then
229           dnl Neither gettext nor catgets in included in the C library.
230           dnl Fall back on GNU gettext library.
231           nls_cv_use_gnu_gettext=yes
232         fi
233       fi
234
235       if test "$nls_cv_use_gnu_gettext" = "yes"; then
236         dnl Mark actions used to generate GNU NLS library.
237         INTLOBJS="\$(GETTOBJS)"
238         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
239           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
240         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
241         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
242           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
243         AC_SUBST(MSGFMT)
244         USE_INCLUDED_LIBINTL=yes
245         CATOBJEXT=.gmo
246         INSTOBJEXT=.mo
247         DATADIRNAME=share
248         INTLDEPS='$(top_builddir)/../intl/libintl.a'
249         INTLLIBS=$INTLDEPS
250         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
251         nls_cv_header_intl=libintl.h
252         nls_cv_header_libgt=libgettext.h
253       fi
254
255       dnl Test whether we really found GNU xgettext.
256       if test "$XGETTEXT" != ":"; then
257         dnl If it is no GNU xgettext we define it as : so that the
258         dnl Makefiles still can work.
259         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
260           : ;
261         else
262           AC_MSG_RESULT(
263             [found xgettext programs is not GNU xgettext; ignore it])
264           XGETTEXT=":"
265         fi
266       fi
267
268       # We need to process the po/ directory.
269       POSUB=po
270     else
271       DATADIRNAME=share
272       nls_cv_header_intl=libintl.h
273       nls_cv_header_libgt=libgettext.h
274     fi
275
276     # If this is used in GNU gettext we have to set USE_NLS to `yes'
277     # because some of the sources are only built for this goal.
278     if test "$PACKAGE" = gettext; then
279       USE_NLS=yes
280       USE_INCLUDED_LIBINTL=yes
281     fi
282
283     dnl These rules are solely for the distribution goal.  While doing this
284     dnl we only have to keep exactly one list of the available catalogs
285     dnl in configure.in.
286     for lang in $ALL_LINGUAS; do
287       GMOFILES="$GMOFILES $lang.gmo"
288       POFILES="$POFILES $lang.po"
289     done
290
291     dnl Make all variables we use known to autoconf.
292     AC_SUBST(USE_INCLUDED_LIBINTL)
293     AC_SUBST(CATALOGS)
294     AC_SUBST(CATOBJEXT)
295     AC_SUBST(DATADIRNAME)
296     AC_SUBST(GMOFILES)
297     AC_SUBST(INSTOBJEXT)
298     AC_SUBST(INTLDEPS)
299     AC_SUBST(INTLLIBS)
300     AC_SUBST(INTLOBJS)
301     AC_SUBST(POFILES)
302     AC_SUBST(POSUB)
303   ])
304
305 AC_DEFUN(CY_GNU_GETTEXT,
306   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
307    AC_REQUIRE([AC_PROG_CC])dnl
308    AC_REQUIRE([AC_PROG_RANLIB])dnl
309    AC_REQUIRE([AC_ISC_POSIX])dnl
310    AC_REQUIRE([AC_HEADER_STDC])dnl
311    AC_REQUIRE([AC_C_CONST])dnl
312    AC_REQUIRE([AC_C_INLINE])dnl
313    AC_REQUIRE([AC_TYPE_OFF_T])dnl
314    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
315    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
316    AC_REQUIRE([AC_FUNC_MMAP])dnl
317
318    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
319 unistd.h values.h sys/param.h])
320    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
321 __argz_count __argz_stringify __argz_next])
322
323    if test "${ac_cv_func_stpcpy+set}" != "set"; then
324      AC_CHECK_FUNCS(stpcpy)
325    fi
326    if test "${ac_cv_func_stpcpy}" = "yes"; then
327      AC_DEFINE(HAVE_STPCPY, 1, [Define if you have the stpcpy function])
328    fi
329
330    AM_LC_MESSAGES
331    CY_WITH_NLS
332
333    if test "x$CATOBJEXT" != "x"; then
334      if test "x$ALL_LINGUAS" = "x"; then
335        LINGUAS=
336      else
337        AC_MSG_CHECKING(for catalogs to be installed)
338        NEW_LINGUAS=
339        for lang in ${LINGUAS=$ALL_LINGUAS}; do
340          case "$ALL_LINGUAS" in
341           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
342          esac
343        done
344        LINGUAS=$NEW_LINGUAS
345        AC_MSG_RESULT($LINGUAS)
346      fi
347
348      dnl Construct list of names of catalog files to be constructed.
349      if test -n "$LINGUAS"; then
350        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
351      fi
352    fi
353
354    dnl The reference to <locale.h> in the installed <libintl.h> file
355    dnl must be resolved because we cannot expect the users of this
356    dnl to define HAVE_LOCALE_H.
357    if test $ac_cv_header_locale_h = yes; then
358      INCLUDE_LOCALE_H="#include <locale.h>"
359    else
360      INCLUDE_LOCALE_H="\
361 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
362    fi
363    AC_SUBST(INCLUDE_LOCALE_H)
364
365    dnl Determine which catalog format we have (if any is needed)
366    dnl For now we know about two different formats:
367    dnl   Linux libc-5 and the normal X/Open format
368    if test -f $srcdir/po2tbl.sed.in; then
369       if test "$CATOBJEXT" = ".cat"; then
370          AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
371
372          dnl Transform the SED scripts while copying because some dumb SEDs
373          dnl cannot handle comments.
374          sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
375       fi
376       dnl po2tbl.sed is always needed.
377       sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
378          $srcdir/po2tbl.sed.in > po2tbl.sed
379    fi
380
381    dnl In the intl/Makefile.in we have a special dependency which makes
382    dnl only sense for gettext.  We comment this out for non-gettext
383    dnl packages.
384    if test "$PACKAGE" = "gettext"; then
385      GT_NO="#NO#"
386      GT_YES=
387    else
388      GT_NO=
389      GT_YES="#YES#"
390    fi
391    AC_SUBST(GT_NO)
392    AC_SUBST(GT_YES)
393
394    MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
395    AC_SUBST(MKINSTALLDIRS)
396
397    dnl *** For now the libtool support in intl/Makefile is not for real.
398    l=
399    AC_SUBST(l)
400
401    dnl Generate list of files to be processed by xgettext which will
402    dnl be included in po/Makefile.  But only do this if the po directory
403    dnl exists in srcdir.
404    if test -d $srcdir/po; then
405       test -d po || mkdir po
406       if test "x$srcdir" != "x."; then
407          if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
408             posrcprefix="$srcdir/"
409          else
410             posrcprefix="../$srcdir/"
411          fi
412       else
413          posrcprefix="../"
414       fi
415       rm -f po/POTFILES
416       sed -e "/^#/d" -e "/^\$/d" -e "s,.*,      $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
417          < $srcdir/po/POTFILES.in > po/POTFILES
418    fi
419   ])
420
421 # Search path for a program which passes the given test.
422 # Ulrich Drepper <drepper@cygnus.com>, 1996.
423 #
424 # This file file be copied and used freely without restrictions.  It can
425 # be used in projects which are not available under the GNU Public License
426 # but which still want to provide support for the GNU gettext functionality.
427 # Please note that the actual code is *not* freely available.
428
429 # serial 1
430
431 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
432 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
433 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
434 [# Extract the first word of "$2", so it can be a program name with args.
435 set dummy $2; ac_word=[$]2
436 AC_MSG_CHECKING([for $ac_word])
437 AC_CACHE_VAL(ac_cv_path_$1,
438 [case "[$]$1" in
439   /*)
440   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
441   ;;
442   *)
443   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
444   for ac_dir in ifelse([$5], , $PATH, [$5]); do
445     test -z "$ac_dir" && ac_dir=.
446     if test -f $ac_dir/$ac_word; then
447       if [$3]; then
448         ac_cv_path_$1="$ac_dir/$ac_word"
449         break
450       fi
451     fi
452   done
453   IFS="$ac_save_ifs"
454 dnl If no 4th arg is given, leave the cache variable unset,
455 dnl so AC_PATH_PROGS will keep looking.
456 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
457 ])dnl
458   ;;
459 esac])dnl
460 $1="$ac_cv_path_$1"
461 if test -n "[$]$1"; then
462   AC_MSG_RESULT([$]$1)
463 else
464   AC_MSG_RESULT(no)
465 fi
466 AC_SUBST($1)dnl
467 ])
468
469 # Check whether LC_MESSAGES is available in <locale.h>.
470 # Ulrich Drepper <drepper@cygnus.com>, 1995.
471 #
472 # This file file be copied and used freely without restrictions.  It can
473 # be used in projects which are not available under the GNU Public License
474 # but which still want to provide support for the GNU gettext functionality.
475 # Please note that the actual code is *not* freely available.
476
477 # serial 1
478
479 AC_DEFUN(AM_LC_MESSAGES,
480   [if test $ac_cv_header_locale_h = yes; then
481     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
482       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
483        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
484     if test $am_cv_val_LC_MESSAGES = yes; then
485       AC_DEFINE(HAVE_LC_MESSAGES, 1,
486                 [Define if your locale.h file contains LC_MESSAGES.])
487     fi
488   fi])
489
490
491 dnl AM_PROG_LEX
492 dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
493 AC_DEFUN(AM_PROG_LEX,
494 [missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
495 AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
496 AC_PROG_LEX
497 AC_DECL_YYTEXT])
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