Update test-gencat.sh and tst-langinfo.sh
[glibc.git] / aclocal.m4
blob60a5fea2791f476e177a21173448bdeb6f3d3911
1 dnl We define the macro GLIBC_PROVIDES to do an AC_PROVIDE for each macro
2 dnl which appears in configure.in before the sysdep configure scripts are run.
3 dnl Each sysdep configure.in does GLIBC_PROVIDES first, to avoid any
4 dnl AC_REQUIREs or AC_BEFOREs duplicating their code.
5 dnl
6 define([GLIBC_PROVIDES], [dnl
7 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
8 AC_PROVIDE([AC_CONFIG_SUBDIRS])dnl
9 AC_PROVIDE([_AS_ECHO_N_PREPARE])dnl
10 AC_PROVIDE([_AS_ECHO_PREPARE])dnl
11 AC_PROVIDE([_AS_CR_PREPARE])dnl
12 AC_PROVIDE([_AS_TR_SH_PREPARE])dnl
13 AC_PROVIDE([_AS_VAR_ARITH_PREPARE])dnl
14 AC_PROVIDE([AC_PROG_INSTALL])dnl
15 AC_PROVIDE([AC_PROG_CC])dnl
16 AC_PROVIDE([AC_PROG_CPP])dnl
17 AC_PROVIDE([_AS_PATH_SEPARATOR_PREPARE])dnl
18 AC_PROVIDE([_AS_TEST_PREPARE])dnl
19 AC_PROVIDE([_AS_BASENAME_PREPARE])dnl
20 AC_PROVIDE([_AS_ME_PREPARE])dnl
21 AC_PROVIDE([_AS_LINENO_PREPARE])dnl
22 AC_PROVIDE([AS_SHELL_FN_as_fn_set_status])dnl
23 AC_PROVIDE([AS_SHELL_FN_as_fn_exit])dnl
24 AC_PROVIDE([AS_SHELL_FN_as_fn_arith])dnl
25 AC_PROVIDE([AS_SHELL_FN_ac_fn_c_try_compile])dnl
26 define([AS_MESSAGE_LOG_FD],5)dnl
27 define([AS_MESSAGE_FD],6)dnl
28 dnl Ripped out of AS_INIT, which does more cruft we do not want.
29 m4_wrap([m4_divert_pop([BODY])[]])
30 m4_divert_push([BODY])[]dnl
31 dnl End of ripped out of AS_INIT.
32 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
33 define([_AC_LANG], [C])dnl
34 ])dnl
35 dnl
36 dnl Check for a symbol
37 dnl
38 AC_DEFUN([AC_CHECK_SYMBOL], [dnl
39 AC_MSG_CHECKING(for $1)
40 AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
41 AC_TRY_LINK(,
42 changequote(,)dnl
43 extern char *$1[]; puts(*$1);,
44 changequote([,])dnl
45             ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
46 if test "$ac_cv_check_symbol_$1" = yes; then
47 changequote(,)dnl
48   ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
49 changequote([,])dnl
50   AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
52 AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
53 dnl
55 dnl Locate a program and check that its version is acceptable.
56 dnl AC_PROG_CHECK_VER(var, namelist, version-switch,
57 dnl                   [version-extract-regexp], version-glob [, do-if-fail])
58 AC_DEFUN([AC_CHECK_PROG_VER],
59 [AC_CHECK_PROGS([$1], [$2])
60 if test -z "[$]$1"; then
61   ac_verc_fail=yes
62 else
63   # Found it, now check the version.
64   AC_MSG_CHECKING([version of [$]$1])
65 changequote(<<,>>)dnl
66   ac_prog_version=`<<$>>$1 $3 2>&1 ifelse(<<$4>>,,,
67                    <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)`
68   case $ac_prog_version in
69     '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
70     <<$5>>)
71 changequote([,])dnl
72        ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
73     *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
75   esac
76   AC_MSG_RESULT([$ac_prog_version])
78 ifelse([$6],,,
79 [if test $ac_verc_fail = yes; then
80   $6
81 fi])
84 dnl These modifications are to allow for an empty cross compiler tree.
85 define([_AC_COMPILER_EXEEXT], [EXEEXT=
88 AC_DEFUN([LIBC_PROG_FOO_GNU],
89 [# Most GNU programs take a -v and spit out some text including
90 # the word 'GNU'.  Some try to read stdin, so give them /dev/null.
91 if $1 -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
92   $2
93 else
94   $3
96 rm -fr contest*])
98 AC_DEFUN([LIBC_PROG_BINUTILS],
99 [# Was a --with-binutils option given?
100 if test -n "$path_binutils"; then
101     # Make absolute; ensure a single trailing slash.
102     path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
103     CC="$CC -B$path_binutils"
105 AS=`$CC -print-prog-name=as`
106 LD=`$CC -print-prog-name=ld`
107 AR=`$CC -print-prog-name=ar`
108 AC_SUBST(AR)
109 OBJDUMP=`$CC -print-prog-name=objdump`
110 AC_SUBST(OBJDUMP)
111 OBJCOPY=`$CC -print-prog-name=objcopy`
112 AC_SUBST(OBJCOPY)
114 # Determine whether we are using GNU binutils.
115 AC_CACHE_CHECK(whether $AS is GNU as, libc_cv_prog_as_gnu,
116 [LIBC_PROG_FOO_GNU($AS, libc_cv_prog_as_gnu=yes, libc_cv_prog_as_gnu=no)])
117 rm -f a.out
118 gnu_as=$libc_cv_prog_as_gnu
120 AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu,
121 [LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
122 gnu_ld=$libc_cv_prog_ld_gnu
125 dnl Run a static link test with -nostdlib -nostartfiles.
126 dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
127 AC_DEFUN([LIBC_TRY_LINK_STATIC],
128 [cat > conftest.c <<EOF
129 int _start (void) { return 0; }
130 int __start (void) { return 0; }
133 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
134                        conftest.c -static -nostartfiles -nostdlib
135                        1>&AS_MESSAGE_LOG_FD])],
136       [$2], [$3])
137 rm -f conftest*])
139 dnl Test a compiler option or options with an empty input file.
140 dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
141 AC_DEFUN([LIBC_TRY_CC_OPTION],
142 [AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])],
143         [$2], [$3])])
145 dnl Find and source sysdeps/*/preconfigure.
146 dnl LIBC_PRECONFIGURE([$srcdir], [for])
147 AC_DEFUN([LIBC_PRECONFIGURE], [dnl
148 if frags=`ls -d $1/sysdeps/*/preconfigure 2> /dev/null`
149 then
150   AC_MSG_CHECKING($2 preconfigure fragments)
151   for frag in $frags; do
152     name=`echo "$frag" | sed 's@/[[^/]]*[$]@@;s@^.*/@@'`
153     echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
154     . "$frag"
155   done
156   AC_MSG_RESULT()
157 fi])