From: DJ Delorie Date: Sat, 10 Jan 2004 04:04:05 +0000 (+0000) Subject: merge from gcc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a79b0243381b7a562332b5f25f43d4d62d08791;p=binutils-gdb.git merge from gcc --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index ee71aa1d7c8..25f563af36a 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,11 @@ +2004-01-09 Kelley Cook + + * configure.in: Rename file to ... + * configure.ac: ... this. + * Makefile.in: Update a comment for above change. + * README: Likewise. + * config.in: Regenerate. + 2004-01-02 Ian Lance Taylor * cp-demangle.c (d_encoding): When DMGL_PARAMS is not set, strip diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index f3ff338fa2d..0e1c8f252d9 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -126,7 +126,7 @@ COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiber # NOTE: If you add new files to the library, add them to this list # (alphabetical), and add them to REQUIRED_OFILES, or -# CONFIGURED_OFILES and funcs in configure.in. +# CONFIGURED_OFILES and funcs in configure.ac. CFILES = alloca.c argv.c asprintf.c atexit.c \ basename.c bcmp.c bcopy.c bsearch.c bzero.c \ calloc.c choose-temp.c clock.c concat.c cp-demangle.c \ diff --git a/libiberty/README b/libiberty/README index e8e9b338350..886bd67bc9d 100644 --- a/libiberty/README +++ b/libiberty/README @@ -34,7 +34,7 @@ name of the function must be the same as the name of the file. * Add the source file name to CFILES. * Add the function to name to the funcs shell variable in - configure.in. + configure.ac. * Add the function to the AC_CHECK_FUNCS lists just after the setting of the funcs shell variable. These AC_CHECK_FUNCS calls diff --git a/libiberty/config.in b/libiberty/config.in index 50ed3266852..8e5071aec7b 100644 --- a/libiberty/config.in +++ b/libiberty/config.in @@ -1,339 +1,376 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define if you have . */ -#undef HAVE_VFORK_H - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Define to `int' if doesn't define. */ -#undef pid_t - -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS +/* config.in. Generated from configure.ac by autoheader. */ +/* Define to `unsigned long' if doesn't define. */ +#undef uintptr_t -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME -/* Define vfork as fork if vfork does not work. */ -#undef vfork +/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ +#undef BYTEORDER -/* Define to `unsigned long' if doesn't define. */ -#undef uintptr_t +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END -/* Define if you have the _doprnt function. */ -#undef HAVE__DOPRNT +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H -/* Define if you have the asprintf function. */ +/* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF -/* Define if you have the atexit function. */ +/* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT -/* Define if you have the basename function. */ +/* Define to 1 if you have the `basename' function. */ #undef HAVE_BASENAME -/* Define if you have the bcmp function. */ +/* Define to 1 if you have the `bcmp' function. */ #undef HAVE_BCMP -/* Define if you have the bcopy function. */ +/* Define to 1 if you have the `bcopy' function. */ #undef HAVE_BCOPY -/* Define if you have the bsearch function. */ +/* Define to 1 if you have the `bsearch' function. */ #undef HAVE_BSEARCH -/* Define if you have the bzero function. */ +/* Define to 1 if you have the `bzero' function. */ #undef HAVE_BZERO -/* Define if you have the calloc function. */ +/* Define to 1 if you have the `calloc' function. */ #undef HAVE_CALLOC -/* Define if you have the canonicalize_file_name function. */ +/* Define to 1 if you have the `canonicalize_file_name' function. */ #undef HAVE_CANONICALIZE_FILE_NAME -/* Define if you have the clock function. */ +/* Define to 1 if you have the `clock' function. */ #undef HAVE_CLOCK -/* Define if you have the ffs function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `ffs' function. */ #undef HAVE_FFS -/* Define if you have the getcwd function. */ +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD -/* Define if you have the getpagesize function. */ +/* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE -/* Define if you have the getrusage function. */ +/* Define to 1 if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE -/* Define if you have the getsysinfo function. */ +/* Define to 1 if you have the `getsysinfo' function. */ #undef HAVE_GETSYSINFO -/* Define if you have the gettimeofday function. */ +/* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define if you have the index function. */ +/* Define to 1 if you have the `index' function. */ #undef HAVE_INDEX -/* Define if you have the insque function. */ +/* Define to 1 if you have the `insque' function. */ #undef HAVE_INSQUE -/* Define if you have the memchr function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_HAL_SYSINFO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the `memchr' function. */ #undef HAVE_MEMCHR -/* Define if you have the memcmp function. */ +/* Define to 1 if you have the `memcmp' function. */ #undef HAVE_MEMCMP -/* Define if you have the memcpy function. */ +/* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY -/* Define if you have the memmove function. */ +/* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE -/* Define if you have the mempcpy function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY -/* Define if you have the memset function. */ +/* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET -/* Define if you have the mkstemps function. */ +/* Define to 1 if you have the `mkstemps' function. */ #undef HAVE_MKSTEMPS -/* Define if you have the on_exit function. */ +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `on_exit' function. */ #undef HAVE_ON_EXIT -/* Define if you have the psignal function. */ +/* Define to 1 if you have the `psignal' function. */ #undef HAVE_PSIGNAL -/* Define if you have the pstat_getdynamic function. */ +/* Define to 1 if you have the `pstat_getdynamic' function. */ #undef HAVE_PSTAT_GETDYNAMIC -/* Define if you have the pstat_getstatic function. */ +/* Define to 1 if you have the `pstat_getstatic' function. */ #undef HAVE_PSTAT_GETSTATIC -/* Define if you have the putenv function. */ +/* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV -/* Define if you have the random function. */ +/* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM -/* Define if you have the realpath function. */ +/* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH -/* Define if you have the rename function. */ +/* Define to 1 if you have the `rename' function. */ #undef HAVE_RENAME -/* Define if you have the rindex function. */ +/* Define to 1 if you have the `rindex' function. */ #undef HAVE_RINDEX -/* Define if you have the sbrk function. */ +/* Define to 1 if you have the `sbrk' function. */ #undef HAVE_SBRK -/* Define if you have the setenv function. */ +/* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV -/* Define if you have the sigsetmask function. */ +/* Define to 1 if you have the `sigsetmask' function. */ #undef HAVE_SIGSETMASK -/* Define if you have the snprintf function. */ +/* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF -/* Define if you have the stpcpy function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `stpcpy' function. */ #undef HAVE_STPCPY -/* Define if you have the stpncpy function. */ +/* Define to 1 if you have the `stpncpy' function. */ #undef HAVE_STPNCPY -/* Define if you have the strcasecmp function. */ +/* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP -/* Define if you have the strchr function. */ +/* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR -/* Define if you have the strdup function. */ +/* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP -/* Define if you have the strerror function. */ +/* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR -/* Define if you have the strncasecmp function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP -/* Define if you have the strrchr function. */ +/* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR -/* Define if you have the strsignal function. */ +/* Define to 1 if you have the `strsignal' function. */ #undef HAVE_STRSIGNAL -/* Define if you have the strstr function. */ +/* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR -/* Define if you have the strtod function. */ +/* Define to 1 if you have the `strtod' function. */ #undef HAVE_STRTOD -/* Define if you have the strtol function. */ +/* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL -/* Define if you have the strtoul function. */ +/* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL -/* Define if you have the sysconf function. */ +/* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF -/* Define if you have the sysctl function. */ +/* Define to 1 if you have the `sysctl' function. */ #undef HAVE_SYSCTL -/* Define if you have the sysmp function. */ +/* Define to 1 if you have the `sysmp' function. */ #undef HAVE_SYSMP -/* Define if you have the table function. */ -#undef HAVE_TABLE +/* Define if you have the sys_errlist variable. */ +#undef HAVE_SYS_ERRLIST -/* Define if you have the times function. */ -#undef HAVE_TIMES +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H -/* Define if you have the tmpnam function. */ -#undef HAVE_TMPNAM +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H -/* Define if you have the vasprintf function. */ -#undef HAVE_VASPRINTF +/* Define if you have the sys_nerr variable. */ +#undef HAVE_SYS_NERR -/* Define if you have the vfprintf function. */ -#undef HAVE_VFPRINTF +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PSTAT_H -/* Define if you have the vsnprintf function. */ -#undef HAVE_VSNPRINTF +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H -/* Define if you have the vsprintf function. */ -#undef HAVE_VSPRINTF +/* Define if you have the sys_siglist variable. */ +#undef HAVE_SYS_SIGLIST -/* Define if you have the waitpid function. */ -#undef HAVE_WAITPID +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H -/* Define if you have the header file. */ -#undef HAVE_ALLOCA_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSCTL_H -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSINFO_H -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMP_H -/* Define if you have the header file. */ -#undef HAVE_MACHINE_HAL_SYSINFO_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSTEMCFG_H -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TABLE_H -/* Define if you have the header file. */ -#undef HAVE_STRING_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H -/* Define if you have the header file. */ -#undef HAVE_SYS_FILE_H +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H -/* Define if you have the header file. */ -#undef HAVE_SYS_MMAN_H +/* Define to 1 if you have the `table' function. */ +#undef HAVE_TABLE -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H +/* Define to 1 if you have the `times' function. */ +#undef HAVE_TIMES -/* Define if you have the header file. */ -#undef HAVE_SYS_PSTAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H -/* Define if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H +/* Define to 1 if you have the `tmpnam' function. */ +#undef HAVE_TMPNAM -/* Define if you have the header file. */ -#undef HAVE_SYS_STAT_H +/* Define if you have the \`uintptr_t' type. */ +#undef HAVE_UINTPTR_T -/* Define if you have the header file. */ -#undef HAVE_SYS_SYSCTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H -/* Define if you have the header file. */ -#undef HAVE_SYS_SYSINFO_H +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF -/* Define if you have the header file. */ -#undef HAVE_SYS_SYSMP_H +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK -/* Define if you have the header file. */ -#undef HAVE_SYS_SYSTEMCFG_H +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H -/* Define if you have the header file. */ -#undef HAVE_SYS_TABLE_H +/* Define to 1 if you have the `vfprintf' function. */ +#undef HAVE_VFPRINTF -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF -/* Define if you have the header file. */ -#undef HAVE_TIME_H +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H +/* Define to 1 if you have the `vsprintf' function. */ +#undef HAVE_VSPRINTF -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H +/* Define to 1 if you have the `waitpid' function. */ +#undef HAVE_WAITPID -/* whether byteorder is bigendian */ -#undef WORDS_BIGENDIAN +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if you have the `_doprnt' function. */ +#undef HAVE__DOPRNT + +/* Define if you have the _system_configuration variable. */ +#undef HAVE__SYSTEM_CONFIGURATION /* Define if the host machine stores words of multi-word integers in big-endian order. */ #undef HOST_WORDS_BIG_ENDIAN -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#undef BYTEORDER +/* Define if canonicalize_file_name is not declared in system header files. */ +#undef NEED_DECLARATION_CANONICALIZE_FILE_NAME /* Define if errno must be declared even when is included. */ #undef NEED_DECLARATION_ERRNO -/* Define if you have the `uintptr_t' type. */ -#undef HAVE_UINTPTR_T +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O -/* Define if you have the sys_errlist variable. */ -#undef HAVE_SYS_ERRLIST +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT -/* Define if you have the sys_nerr variable. */ -#undef HAVE_SYS_NERR +/* Define to the full name of this package. */ +#undef PACKAGE_NAME -/* Define if you have the sys_siglist variable. */ -#undef HAVE_SYS_SIGLIST +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP - systems. This function is required for alloca.c support on those - systems. */ -#undef CRAY_STACKSEG_END +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION -/* Define if you know the direction of stack growth for your system; - otherwise it will be automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ +/* Define if you know the direction of stack growth for your system; otherwise + it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows + toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION -/* Define if you have the _system_configuration variable. */ -#undef HAVE__SYSTEM_CONFIGURATION +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS -/* Define if canonicalize_file_name is not declared in system header files. */ -#undef NEED_DECLARATION_CANONICALIZE_FILE_NAME +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* whether byteorder is bigendian */ +#undef WORDS_BIGENDIAN +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned long' if does not define. */ +#undef uintptr_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/libiberty/configure.ac b/libiberty/configure.ac new file mode 100644 index 00000000000..eb8a99daa08 --- /dev/null +++ b/libiberty/configure.ac @@ -0,0 +1,520 @@ +dnl Process this file with autoconf to produce a configure script + +AC_PREREQ(2.57) +AC_INIT(xmalloc.c) + +# This works around the fact that libtool configuration may change LD +# for this particular configuration, but some shells, instead of +# keeping the changes in LD private, export them just because LD is +# exported. We don't use libtool yet, but some day we might, so... +ORIGINAL_LD_FOR_MULTILIBS=$LD + +dnl We use these options to decide which functions to include. +AC_ARG_WITH(target-subdir, +[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target]) +AC_ARG_WITH(build-subdir, +[ --with-build-subdir=SUBDIR Configuring in a subdirectory for build]) +AC_ARG_WITH(cross-host, +[ --with-cross-host=HOST Configuring with a cross compiler]) +AC_ARG_WITH(newlib, +[ --with-newlib Configuring with newlib]) + +if test "${srcdir}" = "."; then + if test -n "${with_build_subdir}"; then + libiberty_topdir="${srcdir}/../.." + with_target_subdir= + elif test -z "${with_target_subdir}"; then + libiberty_topdir="${srcdir}/.." + else + if test "${with_target_subdir}" != "."; then + libiberty_topdir="${srcdir}/${with_multisrctop}../.." + else + libiberty_topdir="${srcdir}/${with_multisrctop}.." + fi + fi +else + libiberty_topdir="${srcdir}/.." +fi +AC_SUBST(libiberty_topdir) +AC_CONFIG_AUX_DIR($libiberty_topdir) + +dnl Very limited version of automake's enable-maintainer-mode + +AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + maintainer_mode=$enableval, + maintainer_mode=no) + +AC_MSG_RESULT($maintainer_mode) + +if test "$maintainer_mode" = "yes"; then + MAINT='' + NOTMAINT='#' +else + MAINT='#' + NOTMAINT='' +fi +AC_SUBST(MAINT)dnl +AC_SUBST(NOTMAINT)dnl + +# Do we have a single-tree copy of texinfo? Even if we do, we can't +# rely on it - libiberty is built before texinfo. +AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ) +if test "x$MAKEINFO" = "x"; then + MAKEINFO="@echo makeinfo missing; true" + BUILD_INFO= +else + BUILD_INFO=info + case "$MAKEINFO" in + */missing\ makeinfo*) + BUILD_INFO= + AC_MSG_WARN([ +*** Makeinfo is missing. Info documentation will not be built.]) + ;; + *) + case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in + x*\ [[1-3]].* ) + MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true" + BUILD_INFO= + AC_MSG_WARN([ +*** Makeinfo is too old. Info documentation will not be built.]) + ;; + esac + ;; + esac +fi +AC_SUBST(MAKEINFO) +AC_SUBST(BUILD_INFO) + +AC_CHECK_PROG(PERL, perl, perl, ) +if test x"$PERL" = x""; then + HAVE_PERL='#' +else + HAVE_PERL='' +fi +AC_SUBST(HAVE_PERL) + +AC_CANONICAL_HOST + +dnl When we start using automake: +dnl AM_INIT_AUTOMAKE(libiberty, 1.0) + +dnl These must be called before AM_PROG_LIBTOOL, because it may want +dnl to call AC_CHECK_PROG. +AC_CHECK_TOOL(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) + +GCC_NO_EXECUTABLES +AC_PROG_CC +AC_PROG_CPP_WERROR + +if test x$GCC = xyes; then + ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic' +fi +AC_SUBST(ac_libiberty_warn_cflags) + +AC_PROG_CC_C_O +# autoconf is lame and doesn't give us any substitution variable for this. +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then + NO_MINUS_C_MINUS_O=yes +else + OUTPUT_OPTION='-o $@' +fi +AC_SUBST(NO_MINUS_C_MINUS_O) +AC_SUBST(OUTPUT_OPTION) + +AC_C_CONST +AC_C_INLINE +AC_C_BIGENDIAN_CROSS + +dnl When we start using libtool: +dnl Default to a non shared library. This may be overridden by the +dnl configure option --enable-shared. +dnl AM_DISABLE_SHARED + +dnl When we start using libtool: +dnl AM_PROG_LIBTOOL + +dnl When we start using automake: +dnl AM_CONFIG_HEADER(config.h:config.in) +AC_CONFIG_HEADER(config.h:config.in) + +dnl When we start using automake: +dnl AM_MAINTAINER_MODE +dnl AC_EXEEXT + +dnl When we start using automake: +dnl AM_PROG_INSTALL +AC_PROG_INSTALL + +. ${srcdir}/config.table +host_makefile_frag=${frag} +AC_SUBST_FILE(host_makefile_frag) + +# It's OK to check for header files. Although the compiler may not be +# able to link anything, it had better be able to at least compile +# something. +AC_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) +AC_HEADER_SYS_WAIT +AC_HEADER_TIME + +libiberty_AC_DECLARE_ERRNO + +AC_CHECK_TYPE(uintptr_t, unsigned long) +# Given the above check, we always have uintptr_t or a fallback +# definition. So define HAVE_UINTPTR_T in case any imported code +# relies on it. +AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.]) + +AC_TYPE_PID_T + +# This is the list of functions which libiberty will provide if they +# are not available on the host. + +funcs="asprintf" +funcs="$funcs atexit" +funcs="$funcs basename" +funcs="$funcs bcmp" +funcs="$funcs bcopy" +funcs="$funcs bsearch" +funcs="$funcs bzero" +funcs="$funcs calloc" +funcs="$funcs clock" +funcs="$funcs ffs" +funcs="$funcs getcwd" +funcs="$funcs getpagesize" +funcs="$funcs index" +funcs="$funcs insque" +funcs="$funcs memchr" +funcs="$funcs memcmp" +funcs="$funcs memcpy" +funcs="$funcs memmove" +funcs="$funcs mempcpy" +funcs="$funcs memset" +funcs="$funcs mkstemps" +funcs="$funcs putenv" +funcs="$funcs random" +funcs="$funcs rename" +funcs="$funcs rindex" +funcs="$funcs setenv" +funcs="$funcs snprintf" +funcs="$funcs sigsetmask" +funcs="$funcs stpcpy" +funcs="$funcs stpncpy" +funcs="$funcs strcasecmp" +funcs="$funcs strchr" +funcs="$funcs strdup" +funcs="$funcs strncasecmp" +funcs="$funcs strrchr" +funcs="$funcs strstr" +funcs="$funcs strtod" +funcs="$funcs strtol" +funcs="$funcs strtoul" +funcs="$funcs tmpnam" +funcs="$funcs vasprintf" +funcs="$funcs vfprintf" +funcs="$funcs vprintf" +funcs="$funcs vsnprintf" +funcs="$funcs vsprintf" +funcs="$funcs waitpid" + +# Also in the old function.def file: alloca, vfork, getopt. + +vars="sys_errlist sys_nerr sys_siglist" + +checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" +checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" +checkfuncs="$checkfuncs getsysinfo table sysctl" + +# These are neither executed nor required, but they help keep +# autoheader happy without adding a bunch of text to acconfig.h. +if test "x" = "y"; then + AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock \ + getcwd getpagesize index insque mkstemps memchr memcmp memcpy \ + memmove mempcpy memset putenv random rename rindex sigsetmask \ + strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr \ + strtod strtol strtoul tmpnam vasprintf vfprintf vprintf \ + vsprintf waitpid getrusage on_exit psignal strerror strsignal \ + sysconf times sbrk gettimeofday ffs snprintf vsnprintf \ + pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl \ + realpath canonicalize_file_name) + AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) + AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) + AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) +fi + +# For each of these functions, if the host does not provide the +# function we want to put FN.o in LIBOBJS, and if the host does +# provide the function, we want to define HAVE_FN in config.h. + +setobjs= +CHECK= +target_header_dir= +if test -n "${with_target_subdir}"; then + + # We are being configured as a target library. AC_REPLACE_FUNCS + # may not work correctly, because the compiler may not be able to + # link executables. Note that we may still be being configured + # native. + + # If we are being configured for newlib, we know which functions + # newlib provide and which ones we will be expected to provide. + + if test "x${with_newlib}" = "xyes"; then + AC_LIBOBJ([asprintf]) + AC_LIBOBJ([basename]) + AC_LIBOBJ([insque]) + AC_LIBOBJ([random]) + AC_LIBOBJ([strdup]) + AC_LIBOBJ([vasprintf]) + + for f in $funcs; do + case "$f" in + asprintf | basename | insque | random | strdup | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + ;; + esac + done + + # newlib doesnt provide any of the variables in $vars, so we + # dont have to check them here. + + # Of the functions in $checkfuncs, newlib only has strerror. + AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) + + setobjs=yes + + fi + + # We may wish to install the target headers somewhere. + AC_ARG_ENABLE(install-libiberty, + [ --enable-install-libiberty Install headers for end users], + enable_install_libiberty=$enableval, + enable_install_libiberty=no)dnl + + # Option parsed, now set things appropriately. + case x"$enable_install_libiberty" in + xyes|x) + target_header_dir=libiberty + ;; + xno) + target_header_dir= + ;; + *) + # This could be sanity-checked in various ways... + target_header_dir="${enable_install_libiberty}" + ;; + esac + + +else + + # Not a target library, so we set things up to run the test suite. + CHECK=check-cplus-dem + +fi + +AC_SUBST(CHECK) +AC_SUBST(target_header_dir) + +case "${host}" in + *-*-cygwin* | *-*-mingw*) + AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST) + AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR) + ;; +esac + +if test -z "${setobjs}"; then + case "${host}" in + + *-*-vxworks*) + # Handle VxWorks configuration specially, since on VxWorks the + # libraries are actually on the target board, not in the file + # system. + AC_LIBOBJ([basename]) + AC_LIBOBJ([getpagesize]) + AC_LIBOBJ([insque]) + AC_LIBOBJ([random]) + AC_LIBOBJ([strcasecmp]) + AC_LIBOBJ([strncasecmp]) + AC_LIBOBJ([strdup]) + AC_LIBOBJ([vfork]) + AC_LIBOBJ([waitpid]) + AC_LIBOBJ([vasprintf]) + for f in $funcs; do + case "$f" in + basename | getpagesize | insque | random | strcasecmp) + ;; + strncasecmp | strdup | vfork | waitpid | vasprintf) + ;; + *) + n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + ;; + esac + done + + # VxWorks doesn't provide any of the variables in $vars, so we + # don't have to check them here. + + # Of the functions in $checkfuncs, VxWorks only has strerror. + AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) + + setobjs=yes + ;; + + esac +fi + +if test -z "${setobjs}"; then + + case "${host}" in + + *-*-cygwin*) + # The Cygwin library actually uses a couple of files from + # libiberty when it is built. If we are building a native + # Cygwin, and we run the tests, we will appear to have these + # files. However, when we go on to build winsup, we will wind up + # with a library which does not have the files, since they should + # have come from libiberty. + + # We handle this by removing the functions the winsup library + # provides from our shell variables, so that they appear to be + # missing. + + # DJ - only if we're *building* cygwin, not just building *with* cygwin + + if test -n "${with_target_subdir}" + then + funcs="`echo $funcs | sed -e 's/random//'`" + AC_LIBOBJ([random]) + vars="`echo $vars | sed -e 's/sys_siglist//'`" + checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" + fi + ;; + + *-*-mingw32*) + # Under mingw32, sys_nerr and sys_errlist exist, but they are + # macros, so the test below won't find them. + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes + ;; + + *-*-uwin*) + # Under some versions of uwin, vfork is notoriously buggy and the test + # can hang configure; on other versions, vfork exists just as a stub. + # FIXME: This should be removed once vfork in uwin's runtime is fixed. + ac_cv_func_vfork_works=no + # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are + # macros (actually, these are imported from a DLL, but the end effect + # is the same), so the test below won't find them. + libiberty_cv_var_sys_nerr=yes + libiberty_cv_var_sys_errlist=yes + ;; + + *-*-*vms*) + # Under VMS, vfork works very different than on Unix. The standard test + # won't work, and it isn't easily adaptable. It makes more sense to + # just force it. + ac_cv_func_vfork_works=yes + ;; + + esac + + # We haven't set the list of objects yet. Use the standard autoconf + # tests. This will only work if the compiler works. + AC_ISC_POSIX + AC_REPLACE_FUNCS($funcs) + libiberty_AC_FUNC_C_ALLOCA + AC_FUNC_VFORK + if test $ac_cv_func_vfork_works = no; then + AC_LIBOBJ([vfork]) + fi + # We only need _doprnt if we might use it to implement v*printf. + if test $ac_cv_func_vprintf != yes \ + || test $ac_cv_func_vfprintf != yes \ + || test $ac_cv_func_vsprintf != yes; then + AC_REPLACE_FUNCS(_doprnt) + else + AC_CHECK_FUNCS(_doprnt) + fi + + for v in $vars; do + AC_MSG_CHECKING([for $v]) + AC_CACHE_VAL(libiberty_cv_var_$v, + [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;], + [eval "libiberty_cv_var_$v=yes"], + [eval "libiberty_cv_var_$v=no"])]) + if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then + AC_MSG_RESULT(yes) + n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($n) + else + AC_MSG_RESULT(no) + fi + done + + # special check for _system_configuration because AIX <4.3.2 do not + # contain the `physmem' member. + AC_MSG_CHECKING([for external symbol _system_configuration]) + AC_TRY_COMPILE([#include ], + [double x = _system_configuration.physmem;], + [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, + [Define if you have the _system_configuration variable.])], + [AC_MSG_RESULT([no])]) + + AC_CHECK_FUNCS($checkfuncs) + libiberty_NEED_DECLARATION(canonicalize_file_name) +fi + +# Figure out which version of pexecute to use. +case "${host}" in + *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;; + *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;; + *-*-msdos*) pexecute=pex-msdos.o ;; + *-*-os2-emx*) pexecute=pex-os2.o ;; + *) pexecute=pex-unix.o ;; +esac +AC_SUBST(pexecute) + +libiberty_AC_FUNC_STRNCMP + +# Install a library built with a cross compiler in $(tooldir) rather +# than $(libdir). +if test -z "${with_cross_host}"; then + INSTALL_DEST=libdir +else + INSTALL_DEST=tooldir +fi +AC_SUBST(INSTALL_DEST) + +# We need multilib support, but only if configuring for the target. +AC_OUTPUT(Makefile testsuite/Makefile, +[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +if test -n "$CONFIG_FILES"; then + if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then + # FIXME: We shouldn't need to set ac_file + ac_file=Makefile + LD="${ORIGINAL_LD_FOR_MULTILIBS}" + . ${libiberty_topdir}/config-ml.in + fi +fi], +srcdir=${srcdir} +host=${host} +target=${target} +with_target_subdir=${with_target_subdir} +with_build_subdir=${with_build_subdir} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" +libiberty_topdir=${libiberty_topdir} +)