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