]> git.ipfire.org Git - thirdparty/glibc.git/blame - aclocal.m4
powerpc: Change atomic_write_barrier to have release semantics.
[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
3dnl match those expected by the fragments.
f4a58f0d 4m4_define([GLIBC_AUTOCONF_VERSION], [2.69])
f7934be8
RM
5m4_if(m4_defn([AC_AUTOCONF_VERSION]), GLIBC_AUTOCONF_VERSION, [],
6 [m4_fatal(m4_flatten(
7Exactly version GLIBC_AUTOCONF_VERSION of Autoconf is required but you have
8m4_defn([AC_AUTOCONF_VERSION])
9), [63])])dnl
10dnl
28f540f4 11dnl We define the macro GLIBC_PROVIDES to do an AC_PROVIDE for each macro
cb8a6dbd
MF
12dnl which appears in configure.ac before the sysdep configure scripts are run.
13dnl Each sysdep configure.ac does GLIBC_PROVIDES first, to avoid any
28f540f4
RM
14dnl AC_REQUIREs or AC_BEFOREs duplicating their code.
15dnl
3a12e572 16define([GLIBC_PROVIDES], [dnl
9632aaee 17AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
7967983f 18AC_PROVIDE([AC_CONFIG_SUBDIRS])dnl
b9cb349f 19AC_PROVIDE([_AS_ECHO_N_PREPARE])dnl
7967983f 20AC_PROVIDE([_AS_ECHO_PREPARE])dnl
2d37ce0f
RM
21AC_PROVIDE([_AS_CR_PREPARE])dnl
22AC_PROVIDE([_AS_TR_SH_PREPARE])dnl
b8493de0 23AC_PROVIDE([_AS_VAR_ARITH_PREPARE])dnl
28f540f4 24AC_PROVIDE([AC_PROG_INSTALL])dnl
28f540f4
RM
25AC_PROVIDE([AC_PROG_CC])dnl
26AC_PROVIDE([AC_PROG_CPP])dnl
45fba3df
RM
27AC_PROVIDE([_AS_PATH_SEPARATOR_PREPARE])dnl
28AC_PROVIDE([_AS_TEST_PREPARE])dnl
b8493de0
RM
29AC_PROVIDE([_AS_BASENAME_PREPARE])dnl
30AC_PROVIDE([_AS_ME_PREPARE])dnl
31AC_PROVIDE([_AS_LINENO_PREPARE])dnl
32AC_PROVIDE([AS_SHELL_FN_as_fn_set_status])dnl
33AC_PROVIDE([AS_SHELL_FN_as_fn_exit])dnl
34AC_PROVIDE([AS_SHELL_FN_as_fn_arith])dnl
35AC_PROVIDE([AS_SHELL_FN_ac_fn_c_try_compile])dnl
3a12e572
UD
36define([AS_MESSAGE_LOG_FD],5)dnl
37define([AS_MESSAGE_FD],6)dnl
52a0d149
RM
38dnl Ripped out of AS_INIT, which does more cruft we do not want.
39m4_wrap([m4_divert_pop([BODY])[]])
40m4_divert_push([BODY])[]dnl
41dnl End of ripped out of AS_INIT.
cb8a6dbd 42# This file is generated from configure.ac by Autoconf. DO NOT EDIT!
b9cb349f 43define([_AC_LANG], [C])dnl
28f540f4
RM
44])dnl
45dnl
46dnl Check for a symbol
47dnl
3a12e572 48AC_DEFUN([AC_CHECK_SYMBOL], [dnl
28f540f4
RM
49AC_MSG_CHECKING(for $1)
50AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
7cfb2d8b 51AC_TRY_LINK(,
28f540f4
RM
52changequote(,)dnl
53extern char *$1[]; puts(*$1);,
54changequote([,])dnl
55 ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
56if test "$ac_cv_check_symbol_$1" = yes; then
57changequote(,)dnl
58 ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
59changequote([,])dnl
60 AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
61fi
62AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
63dnl
ebbad4cc 64
63bda0c1
UD
65dnl Locate a program and check that its version is acceptable.
66dnl AC_PROG_CHECK_VER(var, namelist, version-switch,
4bca4c17 67dnl [version-extract-regexp], version-glob [, do-if-fail])
3a12e572 68AC_DEFUN([AC_CHECK_PROG_VER],
4bca4c17
UD
69[AC_CHECK_PROGS([$1], [$2])
70if test -z "[$]$1"; then
71 ac_verc_fail=yes
63bda0c1 72else
4bca4c17
UD
73 # Found it, now check the version.
74 AC_MSG_CHECKING([version of [$]$1])
63bda0c1 75changequote(<<,>>)dnl
4bca4c17 76 ac_prog_version=`<<$>>$1 $3 2>&1 ifelse(<<$4>>,,,
e9433893 77 <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)`
4bca4c17
UD
78 case $ac_prog_version in
79 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
80 <<$5>>)
63bda0c1 81changequote([,])dnl
4bca4c17
UD
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
63bda0c1 85 esac
4bca4c17 86 AC_MSG_RESULT([$ac_prog_version])
63bda0c1 87fi
4bca4c17
UD
88ifelse([$6],,,
89[if test $ac_verc_fail = yes; then
90 $6
91fi])
63bda0c1
UD
92])
93
ebbad4cc 94dnl These modifications are to allow for an empty cross compiler tree.
3a12e572 95define([_AC_COMPILER_EXEEXT], [EXEEXT=
ebbad4cc 96])
650425ce 97
3a12e572 98AC_DEFUN([LIBC_PROG_FOO_GNU],
650425ce
UD
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.
256705f4 101if $1 -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
650425ce
UD
102 $2
103else
104 $3
256705f4
UD
105fi
106rm -fr contest*])
650425ce 107
3a12e572 108AC_DEFUN([LIBC_PROG_BINUTILS],
650425ce
UD
109[# Was a --with-binutils option given?
110if test -n "$path_binutils"; then
111 # Make absolute; ensure a single trailing slash.
112 path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
63bda0c1 113 CC="$CC -B$path_binutils"
650425ce 114fi
6916c5e1
UD
115AS=`$CC -print-prog-name=as`
116LD=`$CC -print-prog-name=ld`
5edb9387
UD
117AR=`$CC -print-prog-name=ar`
118AC_SUBST(AR)
6e3d59bc
RM
119OBJDUMP=`$CC -print-prog-name=objdump`
120AC_SUBST(OBJDUMP)
1b74661a
RM
121OBJCOPY=`$CC -print-prog-name=objcopy`
122AC_SUBST(OBJCOPY)
5edb9387 123
650425ce
UD
124# Determine whether we are using GNU binutils.
125AC_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)])
a5a0310d 127rm -f a.out
650425ce
UD
128gnu_as=$libc_cv_prog_as_gnu
129
130AC_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)])
63bda0c1
UD
132gnu_ld=$libc_cv_prog_ld_gnu
133])
07037eeb
JM
134
135dnl Run a static link test with -nostdlib -nostartfiles.
136dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
137AC_DEFUN([LIBC_TRY_LINK_STATIC],
138[cat > conftest.c <<EOF
139int _start (void) { return 0; }
140int __start (void) { return 0; }
141$1
142EOF
143AS_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])
147rm -f conftest*])
10a803e0 148
40b601fb
JM
149dnl Test a compiler option or options with an empty input file.
150dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
151AC_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
10a803e0
RM
155dnl Find and source sysdeps/*/preconfigure.
156dnl LIBC_PRECONFIGURE([$srcdir], [for])
157AC_DEFUN([LIBC_PRECONFIGURE], [dnl
158if frags=`ls -d $1/sysdeps/*/preconfigure 2> /dev/null`
159then
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()
167fi])
8b748aed
JM
168
169# These two macros are taken from GCC's config/acx.m4.
170dnl Support the --with-pkgversion configure option.
171dnl ACX_PKGVERSION(default-pkgversion)
172AC_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
188dnl Support the --with-bugurl configure option.
189dnl ACX_BUGURL(default-bugurl)
190AC_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])
6bfea974
L
216
217dnl Check linker option support.
218dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
219AC_DEFUN([LIBC_LINKER_FEATURE],
220[AC_MSG_CHECKING([for linker that supports $1])
221libc_linker_feature=no
222if 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
226int _start (void) { return 42; }
227EOF
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
237fi
238if test $libc_linker_feature = yes; then
239 $3
240else
241 $4
242fi
243AC_MSG_RESULT($libc_linker_feature)])
bef0b507
JM
244
245dnl Add a makefile variable, with value set from a shell string
246dnl (expanded by the shell inside double quotes), to config.make.
247dnl LIBC_CONFIG_VAR(make-variable, shell-value)
248AC_DEFUN([LIBC_CONFIG_VAR],
249[config_vars="$config_vars
250$1 = $2"])
a01f19c8
CD
251
252dnl Check that function FUNC was inlined as a builtin. The code fragment
253dnl CODE is compiled with additional options CC_OPTION. If FUNC is
254dnl not found in the assembly then it is assumed the compiler has support
255dnl for this builtin and has inlined the call. If the compiler has the
256dnl feature then ACTION-IF-TRUE is called, otherwise ACTION-IF-FALSE.
257dnl It is up to the caller to provide a CC_OPTION that ensures the
258dnl builtin is inlined if present.
259dnl Warning: This may not work for some machines. For example on ARM the
260dnl ABI dictates that some functions should not be inlined and instead
261dnl should be provided by a compiler helper library e.g. __aeabi_memcpy.
262dnl This is done to reduce code size.
263dnl LIBC_COMPILER_BUILTIN([func], [code], [cc_option], [action-if-true], [action-if-false])
264AC_DEFUN([LIBC_COMPILER_BUILTIN_INLINED],
265[AC_MSG_CHECKING([for compiler support of inlined builtin function $1])
266libc_compiler_builtin_inlined=no
267cat > conftest.c <<EOF
268int _start (void) { $2 return 0; }
269EOF
270if ! 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])
274then
275 libc_compiler_builtin_inlined=yes
276fi
277rm -f conftest*
278if test $libc_compiler_builtin_inlined = yes; then
279 $4
280else
281 $5
282fi
283AC_MSG_RESULT($libc_compiler_builtin_inlined)])
d95ffd4c
JM
284
285dnl Default to slibdir named SLIBDIR instead of "lib", and rtlddir
286dnl named RTLDDIR instead of "lib". This is used to put 64-bit
287dnl libraries in /lib64.
288dnl LIBC_SLIBDIR_RTLDDIR([slibdir], [rtlddir])
289AC_DEFUN([LIBC_SLIBDIR_RTLDDIR],
290[test -n "$libc_cv_slibdir" ||
291case "$prefix" in
292/usr | /usr/)
293 libc_cv_slibdir=/$1
294 libc_cv_rtlddir=/$2
295 if test "$libdir" = '${exec_prefix}/lib'; then
296 libdir='${exec_prefix}/$1';
297 # Locale data can be shared between 32-bit and 64-bit libraries.
298 libc_cv_localedir='${exec_prefix}/lib/locale'
299 fi
300 ;;
301esac])