1169695Skandnl Process this file with autoconf to produce a configure script 2169695Skan 3169695SkanAC_PREREQ(2.59) 4169695SkanAC_INIT 5169695SkanAC_CONFIG_SRCDIR([xmalloc.c]) 6169695Skan 7169695Skan# This works around the fact that libtool configuration may change LD 8169695Skan# for this particular configuration, but some shells, instead of 9169695Skan# keeping the changes in LD private, export them just because LD is 10169695Skan# exported. We don't use libtool yet, but some day we might, so... 11169695SkanORIGINAL_LD_FOR_MULTILIBS=$LD 12169695Skan 13169695Skandnl We use these options to decide which functions to include. 14169695SkanAC_ARG_WITH(target-subdir, 15169695Skan[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target]) 16169695SkanAC_ARG_WITH(build-subdir, 17169695Skan[ --with-build-subdir=SUBDIR Configuring in a subdirectory for build]) 18169695SkanAC_ARG_WITH(cross-host, 19169695Skan[ --with-cross-host=HOST Configuring with a cross compiler]) 20169695SkanAC_ARG_WITH(newlib, 21169695Skan[ --with-newlib Configuring with newlib]) 22169695Skan 23169695Skanif test "${srcdir}" = "."; then 24169695Skan if test -n "${with_build_subdir}"; then 25169695Skan libiberty_topdir="${srcdir}/../.." 26169695Skan with_target_subdir= 27169695Skan elif test -z "${with_target_subdir}"; then 28169695Skan libiberty_topdir="${srcdir}/.." 29169695Skan else 30169695Skan if test "${with_target_subdir}" != "."; then 31169695Skan libiberty_topdir="${srcdir}/${with_multisrctop}../.." 32169695Skan else 33169695Skan libiberty_topdir="${srcdir}/${with_multisrctop}.." 34169695Skan fi 35169695Skan fi 36169695Skanelse 37169695Skan libiberty_topdir="${srcdir}/.." 38169695Skanfi 39169695SkanAC_SUBST(libiberty_topdir) 40169695SkanAC_CONFIG_AUX_DIR($libiberty_topdir) 41169695Skan 42169695Skandnl Very limited version of automake's enable-maintainer-mode 43169695Skan 44169695SkanAC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) 45169695Skan dnl maintainer-mode is disabled by default 46169695Skan AC_ARG_ENABLE(maintainer-mode, 47169695Skan[ --enable-maintainer-mode 48169695Skan enable make rules and dependencies not useful 49169695Skan (and sometimes confusing) to the casual installer], 50169695Skan maintainer_mode=$enableval, 51169695Skan maintainer_mode=no) 52169695Skan 53169695SkanAC_MSG_RESULT($maintainer_mode) 54169695Skan 55169695Skanif test "$maintainer_mode" = "yes"; then 56169695Skan MAINT='' 57169695Skan NOTMAINT='#' 58169695Skanelse 59169695Skan MAINT='#' 60169695Skan NOTMAINT='' 61169695Skanfi 62169695SkanAC_SUBST(MAINT)dnl 63169695SkanAC_SUBST(NOTMAINT)dnl 64169695Skan 65169695Skan# Do we have a single-tree copy of texinfo? Even if we do, we can't 66169695Skan# rely on it - libiberty is built before texinfo. 67169695SkanAC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ) 68169695Skanif test "x$MAKEINFO" = "x"; then 69169695Skan MAKEINFO="@echo makeinfo missing; true" 70169695Skan BUILD_INFO= 71169695Skanelse 72169695Skan BUILD_INFO=info 73169695Skan case "$MAKEINFO" in 74169695Skan */missing\ makeinfo*) 75169695Skan BUILD_INFO= 76169695Skan AC_MSG_WARN([ 77169695Skan*** Makeinfo is missing. Info documentation will not be built.]) 78169695Skan ;; 79169695Skan *) 80169695Skan case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in 81169695Skan x*\ [[1-3]].* ) 82169695Skan MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true" 83169695Skan BUILD_INFO= 84169695Skan AC_MSG_WARN([ 85169695Skan*** Makeinfo is too old. Info documentation will not be built.]) 86169695Skan ;; 87169695Skan esac 88169695Skan ;; 89169695Skan esac 90169695Skanfi 91169695SkanAC_SUBST(MAKEINFO) 92169695SkanAC_SUBST(BUILD_INFO) 93169695Skan 94169695SkanAC_CHECK_PROG(PERL, perl, perl, ) 95169695Skanif test x"$PERL" = x""; then 96169695Skan HAVE_PERL='#' 97169695Skanelse 98169695Skan HAVE_PERL='' 99169695Skanfi 100169695SkanAC_SUBST(HAVE_PERL) 101169695Skan 102169695SkanAC_CANONICAL_HOST 103169695Skan 104169695Skandnl When we start using automake: 105169695Skandnl AM_INIT_AUTOMAKE(libiberty, 1.0) 106169695Skan 107169695Skandnl These must be called before AM_PROG_LIBTOOL, because it may want 108169695Skandnl to call AC_CHECK_PROG. 109169695SkanAC_CHECK_TOOL(AR, ar) 110169695SkanAC_CHECK_TOOL(RANLIB, ranlib, :) 111169695Skan 112169695SkanGCC_NO_EXECUTABLES 113169695SkanAC_PROG_CC 114169695SkanAC_PROG_CPP_WERROR 115169695Skan 116169695Skan# Warn C++ incompatibilities if supported. 117169695SkanAC_CACHE_CHECK( 118169695Skan [whether ${CC} accepts -Wc++-compat], 119169695Skan [ac_cv_prog_cc_w_cxx_compat], 120169695Skan [save_CFLAGS="$CFLAGS" 121169695Skan CFLAGS="-Wc++-compat" 122169695Skan AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], 123169695Skan [ac_cv_prog_cc_w_cxx_compat=yes], 124169695Skan [ac_cv_prog_cc_w_cxx_compat=no]) 125169695Skan CFLAGS="$save_CFLAGS" 126169695Skan ]) 127169695Skan 128169695Skan 129169695Skanif test x$GCC = xyes; then 130169695Skan ac_libiberty_warn_cflags='-W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes' 131169695Skanfi 132169695Skanif test $ac_cv_prog_cc_w_cxx_compat = yes ; then 133169695Skan ac_libiberty_warn_cflags="${ac_libiberty_warn_cflags} -Wc++-compat" 134169695Skanfi 135169695SkanAC_SUBST(ac_libiberty_warn_cflags) 136169695Skan 137169695SkanAC_PROG_CC_C_O 138169695Skan# autoconf is lame and doesn't give us any substitution variable for this. 139169695Skanif eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then 140169695Skan NO_MINUS_C_MINUS_O=yes 141169695Skanelse 142169695Skan OUTPUT_OPTION='-o $@' 143169695Skanfi 144169695SkanAC_SUBST(NO_MINUS_C_MINUS_O) 145169695SkanAC_SUBST(OUTPUT_OPTION) 146169695Skan 147169695SkanAC_C_CONST 148169695SkanAC_C_INLINE 149169695SkanAC_C_BIGENDIAN 150169695Skan 151169695Skandnl When we start using libtool: 152169695Skandnl Default to a non shared library. This may be overridden by the 153169695Skandnl configure option --enable-shared. 154169695Skandnl AM_DISABLE_SHARED 155169695Skan 156169695Skandnl When we start using libtool: 157169695Skandnl AM_PROG_LIBTOOL 158169695Skan 159169695Skandnl When we start using automake: 160169695Skandnl AM_CONFIG_HEADER(config.h:config.in) 161169695SkanAC_CONFIG_HEADER(config.h:config.in) 162169695Skan 163169695Skandnl When we start using automake: 164169695Skandnl AM_MAINTAINER_MODE 165169695Skandnl AC_EXEEXT 166169695Skan 167169695Skandnl When we start using automake: 168169695Skandnl AM_PROG_INSTALL 169169695SkanAC_PROG_INSTALL 170169695Skan 171169695Skan# Don't build the shared library for build. 172169695Skanif [[ -n "${with_build_subdir}" ]]; then 173169695Skan enable_shared=no 174169695Skanfi 175169695Skan 176169695Skanfrag= 177169695Skancase "${host}" in 178169695Skan rs6000-ibm-aix3.1 | rs6000-ibm-aix) 179169695Skan frag=mh-aix ;; 180169695Skan *-*-cxux7*) frag=mh-cxux7 ;; 181169695Skan *-*-freebsd2.1.*) frag=mh-fbsd21 ;; 182169695Skan *-*-freebsd2.2.[[012]]) frag=mh-fbsd21 ;; 183169695Skan i370-*-opened*) frag=mh-openedition ;; 184169695Skan i[[34567]]86-*-windows*) frag=mh-windows ;; 185169695Skanesac 186169695Skan 187169695Skanif [[ -n "${frag}" ]]; then 188169695Skan frags=${libiberty_topdir}/libiberty/config/$frag 189169695Skanelse 190169695Skan frags= 191169695Skanfi 192169695Skan 193169695Skan# If they didn't specify --enable-shared, don't generate shared libs. 194169695Skancase "${enable_shared}" in 195169695Skan yes) shared=yes ;; 196169695Skan no) shared=no ;; 197169695Skan "") shared=no ;; 198169695Skan *) shared=yes ;; 199169695Skanesac 200169695Skanif [[ "${shared}" = "yes" ]]; then 201169695Skan frag= 202169695Skan case "${host}" in 203169695Skan *-*-cygwin*) ;; 204169695Skan alpha*-*-linux*) frag=mh-elfalphapic ;; 205169695Skan arm*-*-*) frag=mh-armpic ;; 206169695Skan hppa*-*-*) frag=mh-papic ;; 207169695Skan i[[34567]]86-*-* | x86_64-*-*) 208169695Skan frag=mh-x86pic ;; 209169695Skan powerpc*-*-aix*) ;; 210169695Skan powerpc*-*-*) frag=mh-ppcpic ;; 211169695Skan sparc*-*-*) frag=mh-sparcpic ;; 212169695Skan s390*-*-*) frag=mh-s390pic ;; 213169695Skan *) frag=mh-${host_cpu}pic ;; 214169695Skan esac 215169695Skan if [[ -n "${frag}" ]]; then 216169695Skan frags="${frags} ${libiberty_topdir}/config/${frag}" 217169695Skan fi 218169695Skanfi 219169695Skan 220169695Skanecho "# Warning: this fragment is automatically generated" > temp-frag 221169695Skan 222169695Skanfor frag in ${frags}; do 223169695Skan if [[ -f ${frag} ]]; then 224169695Skan echo "Appending ${frag} to xhost-mkfrag" 225169695Skan echo "# Following fragment copied from ${frag}" >> temp-frag 226169695Skan cat ${frag} >> temp-frag 227169695Skan fi 228169695Skandone 229169695Skan 230169695Skan# record if we want to build shared libs. 231169695Skanif [[ "${shared}" = "yes" ]]; then 232169695Skan echo enable_shared = yes >> temp-frag 233169695Skanelse 234169695Skan echo enable_shared = no >> temp-frag 235169695Skanfi 236169695Skan 237169695Skanfrag=xhost-mkfrag 238169695Skan${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag 239169695Skan 240169695Skanhost_makefile_frag=${frag} 241169695SkanAC_SUBST_FILE(host_makefile_frag) 242169695Skan 243169695Skan# It's OK to check for header files. Although the compiler may not be 244169695Skan# able to link anything, it had better be able to at least compile 245169695Skan# something. 246169695SkanAC_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 stdint.h stdio_ext.h) 247169695SkanAC_HEADER_SYS_WAIT 248169695SkanAC_HEADER_TIME 249169695Skan 250169695Skanlibiberty_AC_DECLARE_ERRNO 251169695Skan 252169695Skan# Determine the size of an int for struct fibnode. 253169695SkanAC_CHECK_SIZEOF([int]) 254169695Skan 255169695SkanAC_CHECK_TYPE(uintptr_t, unsigned long) 256169695Skan 257169695Skan# Look for a 64-bit type. 258169695SkanAC_MSG_CHECKING([for a 64-bit type]) 259169695SkanAC_CACHE_VAL(liberty_cv_uint64, 260169695Skan[AC_TRY_COMPILE( 261169695Skan[#ifdef HAVE_STDINT_H 262169695Skan#include <stdint.h> 263169695Skan#endif], 264169695Skan[extern uint64_t foo;], 265169695Skanliberty_cv_uint64=uint64_t, 266169695Skan[AC_TRY_COMPILE( 267169695Skan[#ifdef HAVE_LIMITS_H 268169695Skan#include <limits.h> 269169695Skan#endif 270169695Skan#ifndef CHAR_BIT 271169695Skan#define CHAR_BIT 8 272169695Skan#endif], 273169695Skan[extern char foo[sizeof(long) * CHAR_BIT >= 64 ? 1 : -1];], 274169695Skanliberty_cv_uint64="unsigned long", 275169695Skan[AC_TRY_COMPILE( 276169695Skan[#ifdef HAVE_LIMITS_H 277169695Skan#include <limits.h> 278169695Skan#endif 279169695Skan#ifndef CHAR_BIT 280169695Skan#define CHAR_BIT 8 281169695Skan#endif], 282169695Skan[extern char foo[sizeof(long long) * CHAR_BIT >= 64 ? 1 : -1];], 283169695Skanliberty_cv_uint64="unsigned long long", liberty_cv_uint64=none)])])]) 284169695SkanAC_MSG_RESULT($liberty_cv_uint64) 285169695Skanif test "$liberty_cv_uint64" != none; then 286169695Skan AC_DEFINE_UNQUOTED(UNSIGNED_64BIT_TYPE, $liberty_cv_uint64, 287169695Skan [Define to an unsigned 64-bit type available in the compiler.]) 288169695Skanfi 289169695Skan 290169695Skan# Given the above check, we always have uintptr_t or a fallback 291169695Skan# definition. So define HAVE_UINTPTR_T in case any imported code 292169695Skan# relies on it. 293169695SkanAC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.]) 294169695Skan 295169695SkanAC_TYPE_PID_T 296169695Skan 297169695Skan# This is the list of functions which libiberty will provide if they 298169695Skan# are not available on the host. 299169695Skan 300169695Skanfuncs="asprintf" 301169695Skanfuncs="$funcs atexit" 302169695Skanfuncs="$funcs basename" 303169695Skanfuncs="$funcs bcmp" 304169695Skanfuncs="$funcs bcopy" 305169695Skanfuncs="$funcs bsearch" 306169695Skanfuncs="$funcs bzero" 307169695Skanfuncs="$funcs calloc" 308169695Skanfuncs="$funcs clock" 309169695Skanfuncs="$funcs ffs" 310169695Skanfuncs="$funcs getcwd" 311169695Skanfuncs="$funcs getpagesize" 312169695Skanfuncs="$funcs gettimeofday" 313169695Skanfuncs="$funcs index" 314169695Skanfuncs="$funcs insque" 315169695Skanfuncs="$funcs memchr" 316169695Skanfuncs="$funcs memcmp" 317169695Skanfuncs="$funcs memcpy" 318169695Skanfuncs="$funcs memmove" 319169695Skanfuncs="$funcs mempcpy" 320169695Skanfuncs="$funcs memset" 321169695Skanfuncs="$funcs mkstemps" 322169695Skanfuncs="$funcs putenv" 323169695Skanfuncs="$funcs random" 324169695Skanfuncs="$funcs rename" 325169695Skanfuncs="$funcs rindex" 326169695Skanfuncs="$funcs setenv" 327169695Skanfuncs="$funcs snprintf" 328169695Skanfuncs="$funcs sigsetmask" 329169695Skanfuncs="$funcs stpcpy" 330169695Skanfuncs="$funcs stpncpy" 331169695Skanfuncs="$funcs strcasecmp" 332169695Skanfuncs="$funcs strchr" 333169695Skanfuncs="$funcs strdup" 334169695Skanfuncs="$funcs strncasecmp" 335169695Skanfuncs="$funcs strndup" 336169695Skanfuncs="$funcs strrchr" 337169695Skanfuncs="$funcs strstr" 338169695Skanfuncs="$funcs strtod" 339169695Skanfuncs="$funcs strtol" 340169695Skanfuncs="$funcs strtoul" 341169695Skanfuncs="$funcs strverscmp" 342169695Skanfuncs="$funcs tmpnam" 343169695Skanfuncs="$funcs vasprintf" 344169695Skanfuncs="$funcs vfprintf" 345169695Skanfuncs="$funcs vprintf" 346169695Skanfuncs="$funcs vsnprintf" 347169695Skanfuncs="$funcs vsprintf" 348169695Skanfuncs="$funcs waitpid" 349169695Skan 350169695Skan# Also in the old function.def file: alloca, vfork, getopt. 351169695Skan 352169695Skanvars="sys_errlist sys_nerr sys_siglist" 353169695Skan 354169695Skancheckfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" 355169695Skancheckfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" 356169695Skancheckfuncs="$checkfuncs getsysinfo table sysctl wait3 wait4 __fsetlocking" 357169695Skan 358169695Skan# These are neither executed nor required, but they help keep 359169695Skan# autoheader happy without adding a bunch of text to acconfig.h. 360169695Skanif test "x" = "y"; then 361169695Skan AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock \ 362169695Skan getcwd getpagesize gettimeofday index insque mkstemps memchr memcmp memcpy \ 363169695Skan memmove mempcpy memset putenv random rename rindex sigsetmask \ 364169695Skan strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strndup strrchr strstr \ 365169695Skan strtod strtol strtoul strverscmp tmpnam vasprintf vfprintf vprintf \ 366169695Skan vsprintf waitpid getrusage on_exit psignal strerror strsignal \ 367169695Skan sysconf times sbrk gettimeofday ffs snprintf vsnprintf \ 368169695Skan pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl wait3 wait4 \ 369169695Skan realpath canonicalize_file_name __fsetlocking) 370169695Skan AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf]) 371169695Skan AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) 372169695Skan AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) 373169695Skan AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) 374169695Skanfi 375169695Skan 376169695Skan# For each of these functions, if the host does not provide the 377169695Skan# function we want to put FN.o in LIBOBJS, and if the host does 378169695Skan# provide the function, we want to define HAVE_FN in config.h. 379169695Skan 380169695Skansetobjs= 381169695SkanCHECK= 382169695Skantarget_header_dir= 383169695Skanif test -n "${with_target_subdir}"; then 384169695Skan 385169695Skan # We are being configured as a target library. AC_REPLACE_FUNCS 386169695Skan # may not work correctly, because the compiler may not be able to 387169695Skan # link executables. Note that we may still be being configured 388169695Skan # native. 389169695Skan 390169695Skan # If we are being configured for newlib, we know which functions 391169695Skan # newlib provide and which ones we will be expected to provide. 392169695Skan 393169695Skan if test "x${with_newlib}" = "xyes"; then 394169695Skan AC_LIBOBJ([asprintf]) 395169695Skan AC_LIBOBJ([basename]) 396169695Skan AC_LIBOBJ([insque]) 397169695Skan AC_LIBOBJ([random]) 398169695Skan AC_LIBOBJ([strdup]) 399169695Skan AC_LIBOBJ([vasprintf]) 400169695Skan 401169695Skan for f in $funcs; do 402169695Skan case "$f" in 403169695Skan asprintf | basename | insque | random | strdup | vasprintf) 404169695Skan ;; 405169695Skan *) 406169695Skan n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 407169695Skan AC_DEFINE_UNQUOTED($n) 408169695Skan ;; 409169695Skan esac 410169695Skan done 411169695Skan 412169695Skan # newlib doesnt provide any of the variables in $vars, so we 413169695Skan # dont have to check them here. 414169695Skan 415169695Skan # Of the functions in $checkfuncs, newlib only has strerror. 416169695Skan AC_DEFINE(HAVE_STRERROR) 417169695Skan 418169695Skan setobjs=yes 419169695Skan 420169695Skan fi 421169695Skan 422169695Skan # If we are being configured for Mingw, we know which functions 423169695Skan # Mingw provides and which ones we will be expected to provide. 424169695Skan 425169695Skan case "${host}" in 426169695Skan *-*-mingw*) 427169695Skan AC_LIBOBJ([asprintf]) 428169695Skan AC_LIBOBJ([basename]) 429169695Skan AC_LIBOBJ([bcmp]) 430169695Skan AC_LIBOBJ([bcopy]) 431169695Skan AC_LIBOBJ([bzero]) 432169695Skan AC_LIBOBJ([clock]) 433169695Skan AC_LIBOBJ([ffs]) 434169695Skan AC_LIBOBJ([getpagesize]) 435169695Skan AC_LIBOBJ([index]) 436169695Skan AC_LIBOBJ([insque]) 437169695Skan AC_LIBOBJ([mempcpy]) 438169695Skan AC_LIBOBJ([mkstemps]) 439169695Skan AC_LIBOBJ([random]) 440169695Skan AC_LIBOBJ([rindex]) 441169695Skan AC_LIBOBJ([sigsetmask]) 442169695Skan AC_LIBOBJ([stpcpy]) 443169695Skan AC_LIBOBJ([stpncpy]) 444169695Skan AC_LIBOBJ([strndup]) 445169695Skan AC_LIBOBJ([strverscmp]) 446169695Skan AC_LIBOBJ([vasprintf]) 447169695Skan AC_LIBOBJ([waitpid]) 448169695Skan 449169695Skan for f in $funcs; do 450169695Skan case "$f" in 451169695Skan asprintf | basename | bcmp | bcopy | bzero | clock | ffs | getpagesize | index | insque | mempcpy | mkstemps | random | rindex | sigsetmask | stpcpy | stpncpy | strdup | strndup | strverscmp | vasprintf | waitpid) 452169695Skan ;; 453169695Skan *) 454169695Skan n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 455169695Skan AC_DEFINE_UNQUOTED($n) 456169695Skan ;; 457169695Skan esac 458169695Skan done 459169695Skan 460169695Skan # Mingw doesnt provide any of the variables in $vars, so we 461169695Skan # dont have to check them here. 462169695Skan 463169695Skan # Of the functions in $checkfuncs, Mingw only has strerror. 464169695Skan AC_DEFINE(HAVE_STRERROR) 465169695Skan 466169695Skan setobjs=yes 467169695Skan ;; 468169695Skan 469169695Skan esac 470169695Skan 471169695Skan # We may wish to install the target headers somewhere. 472169695Skan AC_ARG_ENABLE(install-libiberty, 473169695Skan [ --enable-install-libiberty Install headers for end users], 474169695Skan enable_install_libiberty=$enableval, 475169695Skan enable_install_libiberty=no)dnl 476169695Skan 477169695Skan # Option parsed, now set things appropriately. 478169695Skan case x"$enable_install_libiberty" in 479169695Skan xyes|x) 480169695Skan target_header_dir=libiberty 481169695Skan ;; 482169695Skan xno) 483169695Skan target_header_dir= 484169695Skan ;; 485169695Skan *) 486169695Skan # This could be sanity-checked in various ways... 487169695Skan target_header_dir="${enable_install_libiberty}" 488169695Skan ;; 489169695Skan esac 490169695Skan 491169695Skan 492169695Skanelse 493169695Skan 494169695Skan # Not a target library, so we set things up to run the test suite. 495169695Skan CHECK=really-check 496169695Skan 497169695Skanfi 498169695Skan 499169695SkanAC_SUBST(CHECK) 500169695SkanAC_SUBST(target_header_dir) 501169695Skan 502169695Skancase "${host}" in 503169695Skan *-*-cygwin* | *-*-mingw*) 504169695Skan AC_DEFINE(HAVE_SYS_ERRLIST) 505169695Skan AC_DEFINE(HAVE_SYS_NERR) 506169695Skan ;; 507169695Skanesac 508169695Skan 509169695Skanif test -z "${setobjs}"; then 510169695Skan case "${host}" in 511169695Skan 512169695Skan *-*-vxworks*) 513169695Skan # Handle VxWorks configuration specially, since on VxWorks the 514169695Skan # libraries are actually on the target board, not in the file 515169695Skan # system. 516169695Skan AC_LIBOBJ([basename]) 517169695Skan AC_LIBOBJ([getpagesize]) 518169695Skan AC_LIBOBJ([insque]) 519169695Skan AC_LIBOBJ([random]) 520169695Skan AC_LIBOBJ([strcasecmp]) 521169695Skan AC_LIBOBJ([strncasecmp]) 522169695Skan AC_LIBOBJ([strdup]) 523169695Skan AC_LIBOBJ([vfork]) 524169695Skan AC_LIBOBJ([waitpid]) 525169695Skan AC_LIBOBJ([vasprintf]) 526169695Skan for f in $funcs; do 527169695Skan case "$f" in 528169695Skan basename | getpagesize | insque | random | strcasecmp) 529169695Skan ;; 530169695Skan strncasecmp | strdup | vfork | waitpid | vasprintf) 531169695Skan ;; 532169695Skan *) 533169695Skan n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 534169695Skan AC_DEFINE_UNQUOTED($n) 535169695Skan ;; 536169695Skan esac 537169695Skan done 538169695Skan 539169695Skan # VxWorks doesn't provide any of the variables in $vars, so we 540169695Skan # don't have to check them here. 541169695Skan 542169695Skan # Of the functions in $checkfuncs, VxWorks only has strerror. 543169695Skan AC_DEFINE(HAVE_STRERROR) 544169695Skan 545169695Skan setobjs=yes 546169695Skan ;; 547169695Skan 548169695Skan esac 549169695Skanfi 550169695Skan 551169695Skanif test -z "${setobjs}"; then 552169695Skan 553169695Skan case "${host}" in 554169695Skan 555169695Skan *-*-cygwin*) 556169695Skan # The Cygwin library actually uses a couple of files from 557169695Skan # libiberty when it is built. If we are building a native 558169695Skan # Cygwin, and we run the tests, we will appear to have these 559169695Skan # files. However, when we go on to build winsup, we will wind up 560169695Skan # with a library which does not have the files, since they should 561169695Skan # have come from libiberty. 562169695Skan 563169695Skan # We handle this by removing the functions the winsup library 564169695Skan # provides from our shell variables, so that they appear to be 565169695Skan # missing. 566169695Skan 567169695Skan # DJ - only if we're *building* cygwin, not just building *with* cygwin 568169695Skan 569169695Skan if test -n "${with_target_subdir}" 570169695Skan then 571169695Skan funcs="`echo $funcs | sed -e 's/random//'`" 572169695Skan AC_LIBOBJ([random]) 573169695Skan vars="`echo $vars | sed -e 's/sys_siglist//'`" 574169695Skan checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" 575169695Skan fi 576169695Skan ;; 577169695Skan 578169695Skan *-*-mingw32*) 579169695Skan # Under mingw32, sys_nerr and sys_errlist exist, but they are 580169695Skan # macros, so the test below won't find them. 581169695Skan libiberty_cv_var_sys_nerr=yes 582169695Skan libiberty_cv_var_sys_errlist=yes 583169695Skan ;; 584169695Skan 585169695Skan *-*-msdosdjgpp*) 586169695Skan # vfork and fork are stubs. 587169695Skan ac_cv_func_vfork_works=no 588169695Skan ;; 589169695Skan 590169695Skan *-*-uwin*) 591169695Skan # Under some versions of uwin, vfork is notoriously buggy and the test 592169695Skan # can hang configure; on other versions, vfork exists just as a stub. 593169695Skan # FIXME: This should be removed once vfork in uwin's runtime is fixed. 594169695Skan ac_cv_func_vfork_works=no 595169695Skan # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are 596169695Skan # macros (actually, these are imported from a DLL, but the end effect 597169695Skan # is the same), so the test below won't find them. 598169695Skan libiberty_cv_var_sys_nerr=yes 599169695Skan libiberty_cv_var_sys_errlist=yes 600169695Skan ;; 601169695Skan 602169695Skan *-*-*vms*) 603169695Skan # Under VMS, vfork works very different than on Unix. The standard test 604169695Skan # won't work, and it isn't easily adaptable. It makes more sense to 605169695Skan # just force it. 606169695Skan ac_cv_func_vfork_works=yes 607169695Skan ;; 608169695Skan 609169695Skan esac 610169695Skan 611169695Skan # We haven't set the list of objects yet. Use the standard autoconf 612169695Skan # tests. This will only work if the compiler works. 613169695Skan AC_ISC_POSIX 614169695Skan AC_REPLACE_FUNCS($funcs) 615169695Skan libiberty_AC_FUNC_C_ALLOCA 616169695Skan AC_FUNC_FORK 617169695Skan if test $ac_cv_func_vfork_works = no; then 618169695Skan AC_LIBOBJ([vfork]) 619169695Skan fi 620169695Skan # We only need _doprnt if we might use it to implement v*printf. 621169695Skan if test $ac_cv_func_vprintf != yes \ 622169695Skan || test $ac_cv_func_vfprintf != yes \ 623169695Skan || test $ac_cv_func_vsprintf != yes; then 624169695Skan AC_REPLACE_FUNCS(_doprnt) 625169695Skan else 626169695Skan AC_CHECK_FUNCS(_doprnt) 627169695Skan fi 628169695Skan 629169695Skan for v in $vars; do 630169695Skan AC_MSG_CHECKING([for $v]) 631169695Skan AC_CACHE_VAL(libiberty_cv_var_$v, 632169695Skan [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], 633169695Skan [eval "libiberty_cv_var_$v=yes"], 634169695Skan [eval "libiberty_cv_var_$v=no"])]) 635169695Skan if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then 636169695Skan AC_MSG_RESULT(yes) 637169695Skan n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 638169695Skan AC_DEFINE_UNQUOTED($n) 639169695Skan else 640169695Skan AC_MSG_RESULT(no) 641169695Skan fi 642169695Skan done 643169695Skan 644169695Skan # special check for _system_configuration because AIX <4.3.2 do not 645169695Skan # contain the `physmem' member. 646169695Skan AC_MSG_CHECKING([for external symbol _system_configuration]) 647169695Skan AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/systemcfg.h>]], 648169695Skan [[double x = _system_configuration.physmem;]])], 649169695Skan [AC_MSG_RESULT([yes]) 650169695Skan AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, 651169695Skan [Define if you have the _system_configuration variable.])], 652169695Skan [AC_MSG_RESULT([no])]) 653169695Skan 654169695Skan AC_CHECK_FUNCS($checkfuncs) 655169695Skan AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf]) 656169695Skan AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk]) 657169695Skan AC_CHECK_DECLS([strverscmp]) 658169695Skan libiberty_NEED_DECLARATION(canonicalize_file_name) 659169695Skanfi 660169695Skan 661169695Skan# Figure out which version of pexecute to use. 662169695Skancase "${host}" in 663169695Skan *-*-mingw* | *-*-winnt*) pexecute=./pex-win32.o ;; 664169695Skan *-*-msdosdjgpp*) pexecute=./pex-djgpp.o ;; 665169695Skan *-*-msdos*) pexecute=./pex-msdos.o ;; 666169695Skan *) pexecute=./pex-unix.o ;; 667169695Skanesac 668169695SkanAC_SUBST(pexecute) 669169695Skan 670169695Skanlibiberty_AC_FUNC_STRNCMP 671169695Skan 672169695Skan# Install a library built with a cross compiler in $(tooldir) rather 673169695Skan# than $(libdir). 674169695Skanif test -z "${with_cross_host}"; then 675169695Skan INSTALL_DEST=libdir 676169695Skanelse 677169695Skan INSTALL_DEST=tooldir 678169695Skanfi 679169695SkanAC_SUBST(INSTALL_DEST) 680169695Skan 681169695Skanm4_pattern_allow(LIBOBJS) 682169695SkanL="" 683169695Skanfor l in x $LIBOBJS; do 684169695Skan case $l in 685169695Skan x) ;; 686169695Skan *) L="$L ./$l" ;; 687169695Skan esac 688169695Skandone 689169695SkanLIBOBJS="$L" 690169695Skan 691169695Skandnl Required by html and install-html 692169695SkanAC_SUBST(datarootdir) 693169695SkanAC_SUBST(docdir) 694169695SkanAC_SUBST(htmldir) 695169695Skan 696169695Skan# We need multilib support, but only if configuring for the target. 697169695SkanAC_CONFIG_FILES([Makefile testsuite/Makefile]) 698169695SkanAC_CONFIG_COMMANDS([default], 699169695Skan [[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h 700169695Skanif test -n "$CONFIG_FILES"; then 701169695Skan if test -n "${with_target_subdir}"; then 702169695Skan # FIXME: We shouldn't need to set ac_file 703169695Skan ac_file=Makefile 704169695Skan LD="${ORIGINAL_LD_FOR_MULTILIBS}" 705169695Skan . ${libiberty_topdir}/config-ml.in 706169695Skan fi 707169695Skanfi]], 708169695Skan[[srcdir=${srcdir} 709169695Skanhost=${host} 710169695Skantarget=${target} 711169695Skanwith_target_subdir=${with_target_subdir} 712169695Skanwith_multisubdir=${with_multisubdir} 713169695Skanac_configure_args="--enable-multilib ${ac_configure_args}" 714169695SkanCONFIG_SHELL=${CONFIG_SHELL-/bin/sh} 715169695SkanORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" 716169695Skanlibiberty_topdir=${libiberty_topdir} 717169695Skan]]) 718169695SkanAC_OUTPUT 719