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