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