]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/configure.in
demangle-expected: Minor changes to match output of new demangler...
[thirdparty/gcc.git] / libiberty / configure.in
CommitLineData
3affd5f0 1dnl Process this file with autoconf to produce a configure script
6599da04 2
238235ef 3AC_PREREQ(2.57)
55d0e5e0 4AC_INIT(xmalloc.c)
6599da04 5
6706f116
AO
6# This works around the fact that libtool configuration may change LD
7# for this particular configuration, but some shells, instead of
8# keeping the changes in LD private, export them just because LD is
9# exported. We don't use libtool yet, but some day we might, so...
10ORIGINAL_LD_FOR_MULTILIBS=$LD
11
3affd5f0
JL
12dnl We use these options to decide which functions to include.
13AC_ARG_WITH(target-subdir,
cd862df8
L
14[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
15AC_ARG_WITH(build-subdir,
16[ --with-build-subdir=SUBDIR Configuring in a subdirectory for build])
ca6b370d
JL
17AC_ARG_WITH(cross-host,
18[ --with-cross-host=HOST Configuring with a cross compiler])
3affd5f0
JL
19AC_ARG_WITH(newlib,
20[ --with-newlib Configuring with newlib])
6599da04 21
3affd5f0 22if test "${srcdir}" = "."; then
cd862df8
L
23 if test -n "${with_build_subdir}"; then
24 libiberty_topdir="${srcdir}/../.."
25 with_target_subdir=
26 elif test -z "${with_target_subdir}"; then
3affd5f0
JL
27 libiberty_topdir="${srcdir}/.."
28 else
29 if test "${with_target_subdir}" != "."; then
30 libiberty_topdir="${srcdir}/${with_multisrctop}../.."
31 else
32 libiberty_topdir="${srcdir}/${with_multisrctop}.."
33 fi
34 fi
35else
36 libiberty_topdir="${srcdir}/.."
37fi
d8c22ce7 38AC_SUBST(libiberty_topdir)
3affd5f0
JL
39AC_CONFIG_AUX_DIR($libiberty_topdir)
40
aaa5f039
DD
41dnl Very limited version of automake's enable-maintainer-mode
42
43AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
44 dnl maintainer-mode is disabled by default
45 AC_ARG_ENABLE(maintainer-mode,
46[ --enable-maintainer-mode
47 enable make rules and dependencies not useful
48 (and sometimes confusing) to the casual installer],
49 maintainer_mode=$enableval,
50 maintainer_mode=no)
51
52AC_MSG_RESULT($maintainer_mode)
53
54if test "$maintainer_mode" = "yes"; then
55 MAINT=''
56 NOTMAINT='#'
57else
58 MAINT='#'
59 NOTMAINT=''
60fi
61AC_SUBST(MAINT)dnl
62AC_SUBST(NOTMAINT)dnl
63
ae9092da
DD
64# Do we have a single-tree copy of texinfo? Even if we do, we can't
65# rely on it - libiberty is built before texinfo.
66AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
f749bd83
AM
67if test "x$MAKEINFO" = "x"; then
68 MAKEINFO="@echo makeinfo missing; true"
ae9092da 69 BUILD_INFO=
f749bd83
AM
70else
71 BUILD_INFO=info
c0590bfd
L
72 case "$MAKEINFO" in
73 */missing\ makeinfo*)
f749bd83
AM
74 BUILD_INFO=
75 AC_MSG_WARN([
c0590bfd
L
76*** Makeinfo is missing. Info documentation will not be built.])
77 ;;
78 *)
79 case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
80 x*\ [[1-3]].* )
81 MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
82 BUILD_INFO=
83 AC_MSG_WARN([
ae9092da 84*** Makeinfo is too old. Info documentation will not be built.])
c0590bfd
L
85 ;;
86 esac
f749bd83
AM
87 ;;
88 esac
89fi
ae9092da 90AC_SUBST(MAKEINFO)
aaa5f039
DD
91AC_SUBST(BUILD_INFO)
92
93AC_CHECK_PROG(PERL, perl, perl, )
94if test x"$PERL" = x""; then
95 HAVE_PERL='#'
96else
97 HAVE_PERL=''
98fi
99AC_SUBST(HAVE_PERL)
100
3affd5f0
JL
101AC_CANONICAL_HOST
102
103dnl When we start using automake:
104dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
105
106dnl These must be called before AM_PROG_LIBTOOL, because it may want
107dnl to call AC_CHECK_PROG.
108AC_CHECK_TOOL(AR, ar)
109AC_CHECK_TOOL(RANLIB, ranlib, :)
110
238235ef
DJ
111GCC_NO_EXECUTABLES
112AC_PROG_CC
b033df90 113AC_PROG_CPP_WERROR
238235ef
DJ
114
115if test x$GCC = xyes; then
116 ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic'
117fi
118AC_SUBST(ac_libiberty_warn_cflags)
3affd5f0 119
7fda878c
DR
120AC_PROG_CC_C_O
121# autoconf is lame and doesn't give us any substitution variable for this.
122if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
123 NO_MINUS_C_MINUS_O=yes
124else
125 OUTPUT_OPTION='-o $@'
126fi
127AC_SUBST(NO_MINUS_C_MINUS_O)
128AC_SUBST(OUTPUT_OPTION)
129
d1209685
ZW
130AC_C_CONST
131AC_C_INLINE
5cc5a0d0 132AC_C_BIGENDIAN_CROSS
3affd5f0
JL
133
134dnl When we start using libtool:
135dnl Default to a non shared library. This may be overridden by the
136dnl configure option --enable-shared.
137dnl AM_DISABLE_SHARED
138
139dnl When we start using libtool:
140dnl AM_PROG_LIBTOOL
141
142dnl When we start using automake:
143dnl AM_CONFIG_HEADER(config.h:config.in)
144AC_CONFIG_HEADER(config.h:config.in)
145
146dnl When we start using automake:
147dnl AM_MAINTAINER_MODE
dd8f3ed5 148dnl AC_EXEEXT
3affd5f0
JL
149
150dnl When we start using automake:
151dnl AM_PROG_INSTALL
152AC_PROG_INSTALL
6599da04
JM
153
154. ${srcdir}/config.table
155host_makefile_frag=${frag}
3affd5f0
JL
156AC_SUBST_FILE(host_makefile_frag)
157
158# It's OK to check for header files. Although the compiler may not be
159# able to link anything, it had better be able to at least compile
160# something.
cf8e4b78 161AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
a6458d1d 162AC_HEADER_SYS_WAIT
c6451ce1 163AC_HEADER_TIME
6599da04 164
3b58c099
MS
165libiberty_AC_DECLARE_ERRNO
166
fdfc290b 167AC_CHECK_TYPE(uintptr_t, unsigned long)
39e8d049
KG
168# Given the above check, we always have uintptr_t or a fallback
169# definition. So define HAVE_UINTPTR_T in case any imported code
170# relies on it.
171AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
d3982b71 172
deae2ed9
MM
173AC_TYPE_PID_T
174
3affd5f0
JL
175# This is the list of functions which libiberty will provide if they
176# are not available on the host.
177
178funcs="asprintf"
179funcs="$funcs atexit"
180funcs="$funcs basename"
181funcs="$funcs bcmp"
182funcs="$funcs bcopy"
dac45916 183funcs="$funcs bsearch"
3affd5f0 184funcs="$funcs bzero"
a9acf741 185funcs="$funcs calloc"
3affd5f0 186funcs="$funcs clock"
29650b2b 187funcs="$funcs ffs"
3affd5f0
JL
188funcs="$funcs getcwd"
189funcs="$funcs getpagesize"
190funcs="$funcs index"
191funcs="$funcs insque"
192funcs="$funcs memchr"
193funcs="$funcs memcmp"
194funcs="$funcs memcpy"
195funcs="$funcs memmove"
029bcc09 196funcs="$funcs mempcpy"
3affd5f0 197funcs="$funcs memset"
687361c8 198funcs="$funcs mkstemps"
9eb4080f 199funcs="$funcs putenv"
3affd5f0
JL
200funcs="$funcs random"
201funcs="$funcs rename"
202funcs="$funcs rindex"
9eb4080f 203funcs="$funcs setenv"
bd3fbc6b 204funcs="$funcs snprintf"
3affd5f0 205funcs="$funcs sigsetmask"
029bcc09
KG
206funcs="$funcs stpcpy"
207funcs="$funcs stpncpy"
3affd5f0
JL
208funcs="$funcs strcasecmp"
209funcs="$funcs strchr"
210funcs="$funcs strdup"
211funcs="$funcs strncasecmp"
212funcs="$funcs strrchr"
213funcs="$funcs strstr"
214funcs="$funcs strtod"
215funcs="$funcs strtol"
216funcs="$funcs strtoul"
217funcs="$funcs tmpnam"
218funcs="$funcs vasprintf"
219funcs="$funcs vfprintf"
220funcs="$funcs vprintf"
bd3fbc6b 221funcs="$funcs vsnprintf"
3affd5f0
JL
222funcs="$funcs vsprintf"
223funcs="$funcs waitpid"
224
225# Also in the old function.def file: alloca, vfork, getopt.
226
aa9dc53d 227vars="sys_errlist sys_nerr sys_siglist"
3affd5f0 228
90e72e20 229checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
64c7e556 230checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
170230b7 231checkfuncs="$checkfuncs getsysinfo table sysctl"
3affd5f0
JL
232
233# These are neither executed nor required, but they help keep
234# autoheader happy without adding a bunch of text to acconfig.h.
235if test "x" = "y"; then
05c30f22
KG
236 AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock \
237 getcwd getpagesize index insque mkstemps memchr memcmp memcpy \
238 memmove mempcpy memset putenv random rename rindex sigsetmask \
239 strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr \
240 strtod strtol strtoul tmpnam vasprintf vfprintf vprintf \
241 vsprintf waitpid getrusage on_exit psignal strerror strsignal \
242 sysconf times sbrk gettimeofday ffs snprintf vsnprintf \
243 pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl \
244 realpath canonicalize_file_name)
d1209685
ZW
245 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
246 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
247 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
6599da04
JM
248fi
249
3affd5f0
JL
250# For each of these functions, if the host does not provide the
251# function we want to put FN.o in LIBOBJS, and if the host does
b548dffb 252# provide the function, we want to define HAVE_FN in config.h.
3affd5f0
JL
253
254setobjs=
7c72138a 255CHECK=
48d7db63 256target_header_dir=
3affd5f0
JL
257if test -n "${with_target_subdir}"; then
258
ca6b370d 259 # We are being configured as a target library. AC_REPLACE_FUNCS
3affd5f0 260 # may not work correctly, because the compiler may not be able to
ca6b370d
JL
261 # link executables. Note that we may still be being configured
262 # native.
3affd5f0
JL
263
264 # If we are being configured for newlib, we know which functions
265 # newlib provide and which ones we will be expected to provide.
266
267 if test "x${with_newlib}" = "xyes"; then
238235ef
DJ
268 AC_LIBOBJ([asprintf])
269 AC_LIBOBJ([basename])
270 AC_LIBOBJ([insque])
271 AC_LIBOBJ([random])
272 AC_LIBOBJ([strdup])
273 AC_LIBOBJ([vasprintf])
3affd5f0
JL
274
275 for f in $funcs; do
276 case "$f" in
ca6b370d 277 asprintf | basename | insque | random | strdup | vasprintf)
3affd5f0
JL
278 ;;
279 *)
280 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
281 AC_DEFINE_UNQUOTED($n)
282 ;;
283 esac
284 done
285
286 # newlib doesnt provide any of the variables in $vars, so we
287 # dont have to check them here.
288
ca6b370d 289 # Of the functions in $checkfuncs, newlib only has strerror.
d1209685 290 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
3affd5f0
JL
291
292 setobjs=yes
293
294 fi
7c72138a 295
48d7db63
PE
296 # We may wish to install the target headers somewhere.
297 AC_ARG_ENABLE(install-libiberty,
298 [ --enable-install-libiberty Install headers for end users],
299 enable_install_libiberty=$enableval,
300 enable_install_libiberty=no)dnl
301
302 # Option parsed, now set things appropriately.
303 case x"$enable_install_libiberty" in
304 xyes|x)
305 target_header_dir=libiberty
306 ;;
307 xno)
308 target_header_dir=
309 ;;
310 *)
311 # This could be sanity-checked in various ways...
312 target_header_dir="${enable_install_libiberty}"
313 ;;
314 esac
315
316
7c72138a
TT
317else
318
319 # Not a target library, so we set things up to run the test suite.
320 CHECK=check-cplus-dem
321
3affd5f0
JL
322fi
323
7c72138a 324AC_SUBST(CHECK)
48d7db63 325AC_SUBST(target_header_dir)
7c72138a 326
b1c45ae4 327case "${host}" in
46af757b 328 *-*-cygwin* | *-*-mingw*)
e490616e
ZW
329 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
330 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
b1c45ae4
CF
331 ;;
332esac
333
3affd5f0
JL
334if test -z "${setobjs}"; then
335 case "${host}" in
336
337 *-*-vxworks*)
338 # Handle VxWorks configuration specially, since on VxWorks the
339 # libraries are actually on the target board, not in the file
340 # system.
238235ef
DJ
341 AC_LIBOBJ([basename])
342 AC_LIBOBJ([getpagesize])
343 AC_LIBOBJ([insque])
344 AC_LIBOBJ([random])
345 AC_LIBOBJ([strcasecmp])
346 AC_LIBOBJ([strncasecmp])
347 AC_LIBOBJ([strdup])
348 AC_LIBOBJ([vfork])
349 AC_LIBOBJ([waitpid])
350 AC_LIBOBJ([vasprintf])
3affd5f0
JL
351 for f in $funcs; do
352 case "$f" in
353 basename | getpagesize | insque | random | strcasecmp)
354 ;;
355 strncasecmp | strdup | vfork | waitpid | vasprintf)
356 ;;
357 *)
358 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
359 AC_DEFINE_UNQUOTED($n)
360 ;;
361 esac
362 done
363
364 # VxWorks doesn't provide any of the variables in $vars, so we
365 # don't have to check them here.
366
367 # Of the functions in $checkfuncs, VxWorks only has strerror.
d1209685 368 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
3affd5f0
JL
369
370 setobjs=yes
371 ;;
372
373 esac
374fi
375
376if test -z "${setobjs}"; then
377
378 case "${host}" in
379
dd8f3ed5
GN
380 *-*-cygwin*)
381 # The Cygwin library actually uses a couple of files from
3affd5f0 382 # libiberty when it is built. If we are building a native
dd8f3ed5 383 # Cygwin, and we run the tests, we will appear to have these
3affd5f0
JL
384 # files. However, when we go on to build winsup, we will wind up
385 # with a library which does not have the files, since they should
386 # have come from libiberty.
387
388 # We handle this by removing the functions the winsup library
389 # provides from our shell variables, so that they appear to be
390 # missing.
391
2f31ed7e
DD
392 # DJ - only if we're *building* cygwin, not just building *with* cygwin
393
394 if test -n "${with_target_subdir}"
395 then
396 funcs="`echo $funcs | sed -e 's/random//'`"
238235ef 397 AC_LIBOBJ([random])
2f31ed7e
DD
398 vars="`echo $vars | sed -e 's/sys_siglist//'`"
399 checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
400 fi
3affd5f0
JL
401 ;;
402
403 *-*-mingw32*)
404 # Under mingw32, sys_nerr and sys_errlist exist, but they are
405 # macros, so the test below won't find them.
d1209685
ZW
406 libiberty_cv_var_sys_nerr=yes
407 libiberty_cv_var_sys_errlist=yes
3affd5f0
JL
408 ;;
409
89f602a7
MK
410 *-*-uwin*)
411 # Under some versions of uwin, vfork is notoriously buggy and the test
412 # can hang configure; on other versions, vfork exists just as a stub.
413 # FIXME: This should be removed once vfork in uwin's runtime is fixed.
414 ac_cv_func_vfork_works=no
62133b5e
MK
415 # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
416 # macros (actually, these are imported from a DLL, but the end effect
417 # is the same), so the test below won't find them.
d1209685
ZW
418 libiberty_cv_var_sys_nerr=yes
419 libiberty_cv_var_sys_errlist=yes
89f602a7
MK
420 ;;
421
ee262b6f
DR
422 *-*-*vms*)
423 # Under VMS, vfork works very different than on Unix. The standard test
424 # won't work, and it isn't easily adaptable. It makes more sense to
425 # just force it.
426 ac_cv_func_vfork_works=yes
427 ;;
428
3affd5f0
JL
429 esac
430
431 # We haven't set the list of objects yet. Use the standard autoconf
432 # tests. This will only work if the compiler works.
238235ef 433 AC_ISC_POSIX
3affd5f0 434 AC_REPLACE_FUNCS($funcs)
b548dffb 435 libiberty_AC_FUNC_C_ALLOCA
3affd5f0
JL
436 AC_FUNC_VFORK
437 if test $ac_cv_func_vfork_works = no; then
238235ef 438 AC_LIBOBJ([vfork])
3affd5f0 439 fi
e490616e
ZW
440 # We only need _doprnt if we might use it to implement v*printf.
441 if test $ac_cv_func_vprintf != yes \
442 || test $ac_cv_func_vfprintf != yes \
443 || test $ac_cv_func_vsprintf != yes; then
444 AC_REPLACE_FUNCS(_doprnt)
9ce3f7e5
DD
445 else
446 AC_CHECK_FUNCS(_doprnt)
e490616e
ZW
447 fi
448
3affd5f0
JL
449 for v in $vars; do
450 AC_MSG_CHECKING([for $v])
451 AC_CACHE_VAL(libiberty_cv_var_$v,
9f3dbd92 452 [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;],
3affd5f0
JL
453 [eval "libiberty_cv_var_$v=yes"],
454 [eval "libiberty_cv_var_$v=no"])])
455 if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
456 AC_MSG_RESULT(yes)
457 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
458 AC_DEFINE_UNQUOTED($n)
6599da04 459 else
3affd5f0 460 AC_MSG_RESULT(no)
6599da04 461 fi
3affd5f0 462 done
aa9dc53d
ACY
463
464 # special check for _system_configuration because AIX <4.3.2 do not
465 # contain the `physmem' member.
466 AC_MSG_CHECKING([for external symbol _system_configuration])
467 AC_TRY_COMPILE([#include <sys/systemcfg.h>],
468 [double x = _system_configuration.physmem;],
469 [AC_MSG_RESULT([yes])
470 AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1,
471 [Define if you have the _system_configuration variable.])],
472 [AC_MSG_RESULT([no])])
473
3affd5f0 474 AC_CHECK_FUNCS($checkfuncs)
4876b2b4 475 libiberty_NEED_DECLARATION(canonicalize_file_name)
3affd5f0
JL
476fi
477
55d0e5e0
ZW
478# Figure out which version of pexecute to use.
479case "${host}" in
55d0e5e0
ZW
480 *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;;
481 *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;;
482 *-*-msdos*) pexecute=pex-msdos.o ;;
483 *-*-os2-emx*) pexecute=pex-os2.o ;;
484 *) pexecute=pex-unix.o ;;
485esac
486AC_SUBST(pexecute)
487
a9266bfa
KG
488libiberty_AC_FUNC_STRNCMP
489
3affd5f0
JL
490# Install a library built with a cross compiler in $(tooldir) rather
491# than $(libdir).
ca6b370d 492if test -z "${with_cross_host}"; then
3affd5f0
JL
493 INSTALL_DEST=libdir
494else
495 INSTALL_DEST=tooldir
6599da04 496fi
3affd5f0
JL
497AC_SUBST(INSTALL_DEST)
498
499# We need multilib support, but only if configuring for the target.
7c72138a 500AC_OUTPUT(Makefile testsuite/Makefile,
3affd5f0
JL
501[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
502if test -n "$CONFIG_FILES"; then
cd862df8 503 if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
3affd5f0
JL
504 # FIXME: We shouldn't need to set ac_file
505 ac_file=Makefile
6706f116 506 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
3affd5f0
JL
507 . ${libiberty_topdir}/config-ml.in
508 fi
509fi],
510srcdir=${srcdir}
511host=${host}
512target=${target}
513with_target_subdir=${with_target_subdir}
cd862df8 514with_build_subdir=${with_build_subdir}
3affd5f0
JL
515with_multisubdir=${with_multisubdir}
516ac_configure_args="--enable-multilib ${ac_configure_args}"
517CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
3343fdd2 518ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
3affd5f0
JL
519libiberty_topdir=${libiberty_topdir}
520)