]> git.ipfire.org Git - thirdparty/glibc.git/blob - aclocal.m4
Fix .ctors/.dtors header configure test for bootstrapping.
[thirdparty/glibc.git] / aclocal.m4
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([AC_PROG_INSTALL])dnl
14 AC_PROVIDE([AC_PROG_CC])dnl
15 AC_PROVIDE([AC_PROG_CPP])dnl
16 AC_PROVIDE([_AS_PATH_SEPARATOR_PREPARE])dnl
17 AC_PROVIDE([_AS_TEST_PREPARE])dnl
18 define([AS_MESSAGE_LOG_FD],5)dnl
19 define([AS_MESSAGE_FD],6)dnl
20 dnl Ripped out of AS_INIT, which does more cruft we do not want.
21 m4_wrap([m4_divert_pop([BODY])[]])
22 m4_divert_push([BODY])[]dnl
23 dnl End of ripped out of AS_INIT.
24 # This file is generated from configure.in by Autoconf. DO NOT EDIT!
25 define([_AC_LANG], [C])dnl
26 ])dnl
27 dnl
28 dnl Check for a symbol
29 dnl
30 AC_DEFUN([AC_CHECK_SYMBOL], [dnl
31 AC_MSG_CHECKING(for $1)
32 AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
33 AC_TRY_LINK(,
34 changequote(,)dnl
35 extern char *$1[]; puts(*$1);,
36 changequote([,])dnl
37 ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
38 if test "$ac_cv_check_symbol_$1" = yes; then
39 changequote(,)dnl
40 ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
41 changequote([,])dnl
42 AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
43 fi
44 AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
45 dnl
46
47 dnl Locate a program and check that its version is acceptable.
48 dnl AC_PROG_CHECK_VER(var, namelist, version-switch,
49 dnl [version-extract-regexp], version-glob [, do-if-fail])
50 AC_DEFUN([AC_CHECK_PROG_VER],
51 [AC_CHECK_PROGS([$1], [$2])
52 if test -z "[$]$1"; then
53 ac_verc_fail=yes
54 else
55 # Found it, now check the version.
56 AC_MSG_CHECKING([version of [$]$1])
57 changequote(<<,>>)dnl
58 ac_prog_version=`<<$>>$1 $3 2>&1 ifelse(<<$4>>,,,
59 <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)`
60 case $ac_prog_version in
61 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
62 <<$5>>)
63 changequote([,])dnl
64 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
65 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
66
67 esac
68 AC_MSG_RESULT([$ac_prog_version])
69 fi
70 ifelse([$6],,,
71 [if test $ac_verc_fail = yes; then
72 $6
73 fi])
74 ])
75
76 dnl These modifications are to allow for an empty cross compiler tree.
77 define([_AC_COMPILER_EXEEXT], [EXEEXT=
78 ])
79
80 AC_DEFUN([LIBC_PROG_FOO_GNU],
81 [# Most GNU programs take a -v and spit out some text including
82 # the word 'GNU'. Some try to read stdin, so give them /dev/null.
83 if $1 -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
84 $2
85 else
86 $3
87 fi
88 rm -fr contest*])
89
90 AC_DEFUN([LIBC_PROG_BINUTILS],
91 [# Was a --with-binutils option given?
92 if test -n "$path_binutils"; then
93 # Make absolute; ensure a single trailing slash.
94 path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
95 CC="$CC -B$path_binutils"
96 fi
97 AS=`$CC -print-prog-name=as`
98 LD=`$CC -print-prog-name=ld`
99 AR=`$CC -print-prog-name=ar`
100 AC_SUBST(AR)
101 OBJDUMP=`$CC -print-prog-name=objdump`
102 AC_SUBST(OBJDUMP)
103 OBJCOPY=`$CC -print-prog-name=objcopy`
104 AC_SUBST(OBJCOPY)
105
106 # Determine whether we are using GNU binutils.
107 AC_CACHE_CHECK(whether $AS is GNU as, libc_cv_prog_as_gnu,
108 [LIBC_PROG_FOO_GNU($AS, libc_cv_prog_as_gnu=yes, libc_cv_prog_as_gnu=no)])
109 rm -f a.out
110 gnu_as=$libc_cv_prog_as_gnu
111
112 AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu,
113 [LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
114 gnu_ld=$libc_cv_prog_ld_gnu
115 ])
116
117 dnl Run a static link test with -nostdlib -nostartfiles.
118 dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
119 AC_DEFUN([LIBC_TRY_LINK_STATIC],
120 [cat > conftest.c <<EOF
121 int _start (void) { return 0; }
122 int __start (void) { return 0; }
123 $1
124 EOF
125 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
126 conftest.c -static -nostartfiles -nostdlib
127 1>&AS_MESSAGE_LOG_FD])],
128 [$2], [$3])
129 rm -f conftest*])