]> git.ipfire.org Git - thirdparty/glibc.git/blob - aclocal.m4
* manual/signal.texi: Document MTASC-safety properties.
[thirdparty/glibc.git] / aclocal.m4
1 dnl We require that everyone use exactly the same Autoconf version so that
2 dnl the internal functions defined and used by the main configure script
3 dnl match those expected by the fragments.
4 m4_define([GLIBC_AUTOCONF_VERSION], [2.68])
5 m4_if(m4_defn([AC_AUTOCONF_VERSION]), GLIBC_AUTOCONF_VERSION, [],
6 [m4_fatal(m4_flatten(
7 Exactly version GLIBC_AUTOCONF_VERSION of Autoconf is required but you have
8 m4_defn([AC_AUTOCONF_VERSION])
9 ), [63])])dnl
10 dnl
11 dnl We define the macro GLIBC_PROVIDES to do an AC_PROVIDE for each macro
12 dnl which appears in configure.ac before the sysdep configure scripts are run.
13 dnl Each sysdep configure.ac does GLIBC_PROVIDES first, to avoid any
14 dnl AC_REQUIREs or AC_BEFOREs duplicating their code.
15 dnl
16 define([GLIBC_PROVIDES], [dnl
17 AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
18 AC_PROVIDE([AC_CONFIG_SUBDIRS])dnl
19 AC_PROVIDE([_AS_ECHO_N_PREPARE])dnl
20 AC_PROVIDE([_AS_ECHO_PREPARE])dnl
21 AC_PROVIDE([_AS_CR_PREPARE])dnl
22 AC_PROVIDE([_AS_TR_SH_PREPARE])dnl
23 AC_PROVIDE([_AS_VAR_ARITH_PREPARE])dnl
24 AC_PROVIDE([AC_PROG_INSTALL])dnl
25 AC_PROVIDE([AC_PROG_CC])dnl
26 AC_PROVIDE([AC_PROG_CPP])dnl
27 AC_PROVIDE([_AS_PATH_SEPARATOR_PREPARE])dnl
28 AC_PROVIDE([_AS_TEST_PREPARE])dnl
29 AC_PROVIDE([_AS_BASENAME_PREPARE])dnl
30 AC_PROVIDE([_AS_ME_PREPARE])dnl
31 AC_PROVIDE([_AS_LINENO_PREPARE])dnl
32 AC_PROVIDE([AS_SHELL_FN_as_fn_set_status])dnl
33 AC_PROVIDE([AS_SHELL_FN_as_fn_exit])dnl
34 AC_PROVIDE([AS_SHELL_FN_as_fn_arith])dnl
35 AC_PROVIDE([AS_SHELL_FN_ac_fn_c_try_compile])dnl
36 define([AS_MESSAGE_LOG_FD],5)dnl
37 define([AS_MESSAGE_FD],6)dnl
38 dnl Ripped out of AS_INIT, which does more cruft we do not want.
39 m4_wrap([m4_divert_pop([BODY])[]])
40 m4_divert_push([BODY])[]dnl
41 dnl End of ripped out of AS_INIT.
42 # This file is generated from configure.ac by Autoconf. DO NOT EDIT!
43 define([_AC_LANG], [C])dnl
44 ])dnl
45 dnl
46 dnl Check for a symbol
47 dnl
48 AC_DEFUN([AC_CHECK_SYMBOL], [dnl
49 AC_MSG_CHECKING(for $1)
50 AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
51 AC_TRY_LINK(,
52 changequote(,)dnl
53 extern char *$1[]; puts(*$1);,
54 changequote([,])dnl
55 ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
56 if test "$ac_cv_check_symbol_$1" = yes; then
57 changequote(,)dnl
58 ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
59 changequote([,])dnl
60 AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
61 fi
62 AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
63 dnl
64
65 dnl Locate a program and check that its version is acceptable.
66 dnl AC_PROG_CHECK_VER(var, namelist, version-switch,
67 dnl [version-extract-regexp], version-glob [, do-if-fail])
68 AC_DEFUN([AC_CHECK_PROG_VER],
69 [AC_CHECK_PROGS([$1], [$2])
70 if test -z "[$]$1"; then
71 ac_verc_fail=yes
72 else
73 # Found it, now check the version.
74 AC_MSG_CHECKING([version of [$]$1])
75 changequote(<<,>>)dnl
76 ac_prog_version=`<<$>>$1 $3 2>&1 ifelse(<<$4>>,,,
77 <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)`
78 case $ac_prog_version in
79 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
80 <<$5>>)
81 changequote([,])dnl
82 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
83 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
84
85 esac
86 AC_MSG_RESULT([$ac_prog_version])
87 fi
88 ifelse([$6],,,
89 [if test $ac_verc_fail = yes; then
90 $6
91 fi])
92 ])
93
94 dnl These modifications are to allow for an empty cross compiler tree.
95 define([_AC_COMPILER_EXEEXT], [EXEEXT=
96 ])
97
98 AC_DEFUN([LIBC_PROG_FOO_GNU],
99 [# Most GNU programs take a -v and spit out some text including
100 # the word 'GNU'. Some try to read stdin, so give them /dev/null.
101 if $1 -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
102 $2
103 else
104 $3
105 fi
106 rm -fr contest*])
107
108 AC_DEFUN([LIBC_PROG_BINUTILS],
109 [# Was a --with-binutils option given?
110 if test -n "$path_binutils"; then
111 # Make absolute; ensure a single trailing slash.
112 path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
113 CC="$CC -B$path_binutils"
114 fi
115 AS=`$CC -print-prog-name=as`
116 LD=`$CC -print-prog-name=ld`
117 AR=`$CC -print-prog-name=ar`
118 AC_SUBST(AR)
119 OBJDUMP=`$CC -print-prog-name=objdump`
120 AC_SUBST(OBJDUMP)
121 OBJCOPY=`$CC -print-prog-name=objcopy`
122 AC_SUBST(OBJCOPY)
123
124 # Determine whether we are using GNU binutils.
125 AC_CACHE_CHECK(whether $AS is GNU as, libc_cv_prog_as_gnu,
126 [LIBC_PROG_FOO_GNU($AS, libc_cv_prog_as_gnu=yes, libc_cv_prog_as_gnu=no)])
127 rm -f a.out
128 gnu_as=$libc_cv_prog_as_gnu
129
130 AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu,
131 [LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
132 gnu_ld=$libc_cv_prog_ld_gnu
133 ])
134
135 dnl Run a static link test with -nostdlib -nostartfiles.
136 dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
137 AC_DEFUN([LIBC_TRY_LINK_STATIC],
138 [cat > conftest.c <<EOF
139 int _start (void) { return 0; }
140 int __start (void) { return 0; }
141 $1
142 EOF
143 AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest
144 conftest.c -static -nostartfiles -nostdlib
145 1>&AS_MESSAGE_LOG_FD])],
146 [$2], [$3])
147 rm -f conftest*])
148
149 dnl Test a compiler option or options with an empty input file.
150 dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
151 AC_DEFUN([LIBC_TRY_CC_OPTION],
152 [AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])],
153 [$2], [$3])])
154
155 dnl Find and source sysdeps/*/preconfigure.
156 dnl LIBC_PRECONFIGURE([$srcdir], [for])
157 AC_DEFUN([LIBC_PRECONFIGURE], [dnl
158 if frags=`ls -d $1/sysdeps/*/preconfigure 2> /dev/null`
159 then
160 AC_MSG_CHECKING($2 preconfigure fragments)
161 for frag in $frags; do
162 name=`echo "$frag" | sed 's@/[[^/]]*[$]@@;s@^.*/@@'`
163 echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
164 . "$frag"
165 done
166 AC_MSG_RESULT()
167 fi])
168
169 # These two macros are taken from GCC's config/acx.m4.
170 dnl Support the --with-pkgversion configure option.
171 dnl ACX_PKGVERSION(default-pkgversion)
172 AC_DEFUN([ACX_PKGVERSION],[
173 AC_ARG_WITH(pkgversion,
174 AS_HELP_STRING([--with-pkgversion=PKG],
175 [Use PKG in the version string in place of "$1"]),
176 [case "$withval" in
177 yes) AC_MSG_ERROR([package version not specified]) ;;
178 no) PKGVERSION= ;;
179 *) PKGVERSION="($withval) " ;;
180 esac],
181 PKGVERSION="($1) "
182 )
183 PKGVERSION_TEXI=`echo "$PKGVERSION" | sed 's/@/@@/g'`
184 AC_SUBST(PKGVERSION)
185 AC_SUBST(PKGVERSION_TEXI)
186 ])
187
188 dnl Support the --with-bugurl configure option.
189 dnl ACX_BUGURL(default-bugurl)
190 AC_DEFUN([ACX_BUGURL],[
191 AC_ARG_WITH(bugurl,
192 AS_HELP_STRING([--with-bugurl=URL],
193 [Direct users to URL to report a bug]),
194 [case "$withval" in
195 yes) AC_MSG_ERROR([bug URL not specified]) ;;
196 no) BUGURL=
197 ;;
198 *) BUGURL="$withval"
199 ;;
200 esac],
201 BUGURL="$1"
202 )
203 case ${BUGURL} in
204 "")
205 REPORT_BUGS_TO=
206 REPORT_BUGS_TEXI=
207 ;;
208 *)
209 REPORT_BUGS_TO="<$BUGURL>"
210 REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
211 ;;
212 esac;
213 AC_SUBST(REPORT_BUGS_TO)
214 AC_SUBST(REPORT_BUGS_TEXI)
215 ])
216
217 dnl Check linker option support.
218 dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
219 AC_DEFUN([LIBC_LINKER_FEATURE],
220 [AC_MSG_CHECKING([for linker that supports $1])
221 libc_linker_feature=no
222 if test x"$gnu_ld" = x"yes"; then
223 libc_linker_check=`$LD -v --help 2>/dev/null | grep "\$1"`
224 if test -n "$libc_linker_check"; then
225 cat > conftest.c <<EOF
226 int _start (void) { return 42; }
227 EOF
228 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
229 $2 -nostdlib -nostartfiles
230 -fPIC -shared -o conftest.so conftest.c
231 1>&AS_MESSAGE_LOG_FD])
232 then
233 libc_linker_feature=yes
234 fi
235 rm -f conftest*
236 fi
237 fi
238 if test $libc_linker_feature = yes; then
239 $3
240 else
241 $4
242 fi
243 AC_MSG_RESULT($libc_linker_feature)])
244
245 dnl Add a makefile variable, with value set from a shell string
246 dnl (expanded by the shell inside double quotes), to config.make.
247 dnl LIBC_CONFIG_VAR(make-variable, shell-value)
248 AC_DEFUN([LIBC_CONFIG_VAR],
249 [config_vars="$config_vars
250 $1 = $2"])
251
252 dnl Check that function FUNC was inlined as a builtin. The code fragment
253 dnl CODE is compiled with additional options CC_OPTION. If FUNC is
254 dnl not found in the assembly then it is assumed the compiler has support
255 dnl for this builtin and has inlined the call. If the compiler has the
256 dnl feature then ACTION-IF-TRUE is called, otherwise ACTION-IF-FALSE.
257 dnl It is up to the caller to provide a CC_OPTION that ensures the
258 dnl builtin is inlined if present.
259 dnl Warning: This may not work for some machines. For example on ARM the
260 dnl ABI dictates that some functions should not be inlined and instead
261 dnl should be provided by a compiler helper library e.g. __aeabi_memcpy.
262 dnl This is done to reduce code size.
263 dnl LIBC_COMPILER_BUILTIN([func], [code], [cc_option], [action-if-true], [action-if-false])
264 AC_DEFUN([LIBC_COMPILER_BUILTIN_INLINED],
265 [AC_MSG_CHECKING([for compiler support of inlined builtin function $1])
266 libc_compiler_builtin_inlined=no
267 cat > conftest.c <<EOF
268 int _start (void) { $2 return 0; }
269 EOF
270 if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
271 $3 -nostdlib -nostartfiles
272 -S conftest.c -o - | fgrep "$1"
273 1>&AS_MESSAGE_LOG_FD])
274 then
275 libc_compiler_builtin_inlined=yes
276 fi
277 rm -f conftest*
278 if test $libc_compiler_builtin_inlined = yes; then
279 $4
280 else
281 $5
282 fi
283 AC_MSG_RESULT($libc_compiler_builtin_inlined)])