configure.ac 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. dnl Process this file with autoconf to produce a configure script
  2. AC_PREREQ(2.64)
  3. AC_INIT
  4. AC_CONFIG_SRCDIR([xmalloc.c])
  5. # This works around the fact that libtool configuration may change LD
  6. # for this particular configuration, but some shells, instead of
  7. # keeping the changes in LD private, export them just because LD is
  8. # exported. We don't use libtool yet, but some day we might, so...
  9. ORIGINAL_LD_FOR_MULTILIBS=$LD
  10. dnl We use these options to decide which functions to include.
  11. AC_ARG_WITH(target-subdir,
  12. [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
  13. AC_ARG_WITH(build-subdir,
  14. [ --with-build-subdir=SUBDIR Configuring in a subdirectory for build])
  15. AC_ARG_WITH(cross-host,
  16. [ --with-cross-host=HOST Configuring with a cross compiler])
  17. AC_ARG_WITH(newlib,
  18. [ --with-newlib Configuring with newlib])
  19. if test "${srcdir}" = "."; then
  20. if test -n "${with_build_subdir}"; then
  21. libiberty_topdir="${srcdir}/../.."
  22. with_target_subdir=
  23. elif test -z "${with_target_subdir}"; then
  24. libiberty_topdir="${srcdir}/.."
  25. else
  26. if test "${with_target_subdir}" != "."; then
  27. libiberty_topdir="${srcdir}/${with_multisrctop}../.."
  28. else
  29. libiberty_topdir="${srcdir}/${with_multisrctop}.."
  30. fi
  31. fi
  32. else
  33. libiberty_topdir="${srcdir}/.."
  34. fi
  35. AC_SUBST(libiberty_topdir)
  36. AC_CONFIG_AUX_DIR($libiberty_topdir)
  37. dnl Very limited version of automake's enable-maintainer-mode
  38. AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
  39. dnl maintainer-mode is disabled by default
  40. AC_ARG_ENABLE(maintainer-mode,
  41. [ --enable-maintainer-mode
  42. enable make rules and dependencies not useful
  43. (and sometimes confusing) to the casual installer],
  44. maintainer_mode=$enableval,
  45. maintainer_mode=no)
  46. AC_MSG_RESULT($maintainer_mode)
  47. if test "$maintainer_mode" = "yes"; then
  48. MAINT=''
  49. NOTMAINT='#'
  50. else
  51. MAINT='#'
  52. NOTMAINT=''
  53. fi
  54. AC_SUBST(MAINT)dnl
  55. AC_SUBST(NOTMAINT)dnl
  56. # Do we have a single-tree copy of texinfo? Even if we do, we can't
  57. # rely on it - libiberty is built before texinfo.
  58. AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
  59. if test "x$MAKEINFO" = "x"; then
  60. MAKEINFO="@echo makeinfo missing; true"
  61. BUILD_INFO=
  62. else
  63. BUILD_INFO=info
  64. case "$MAKEINFO" in
  65. */missing\ makeinfo*)
  66. BUILD_INFO=
  67. AC_MSG_WARN([
  68. *** Makeinfo is missing. Info documentation will not be built.])
  69. ;;
  70. *)
  71. case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
  72. x*\ [[1-3]].* )
  73. MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
  74. BUILD_INFO=
  75. AC_MSG_WARN([
  76. *** Makeinfo is too old. Info documentation will not be built.])
  77. ;;
  78. esac
  79. ;;
  80. esac
  81. fi
  82. AC_SUBST(MAKEINFO)
  83. AC_SUBST(BUILD_INFO)
  84. AC_CHECK_PROG(PERL, perl, perl, )
  85. if test x"$PERL" = x""; then
  86. HAVE_PERL='#'
  87. else
  88. HAVE_PERL=''
  89. fi
  90. AC_SUBST(HAVE_PERL)
  91. AC_CANONICAL_HOST
  92. dnl When we start using automake:
  93. dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
  94. dnl These must be called before AM_PROG_LIBTOOL, because it may want
  95. dnl to call AC_CHECK_PROG.
  96. AC_CHECK_TOOL(AR, ar)
  97. AC_CHECK_TOOL(RANLIB, ranlib, :)
  98. dnl When switching to automake, replace the following with AM_ENABLE_MULTILIB.
  99. # Add --enable-multilib to configure.
  100. # Default to --enable-multilib
  101. AC_ARG_ENABLE(multilib,
  102. [ --enable-multilib build many library versions (default)],
  103. [case "$enableval" in
  104. yes) multilib=yes ;;
  105. no) multilib=no ;;
  106. *) AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
  107. esac],
  108. [multilib=yes])
  109. # Even if the default multilib is not a cross compilation,
  110. # it may be that some of the other multilibs are.
  111. if test $cross_compiling = no && test $multilib = yes \
  112. && test "x${with_multisubdir}" != x ; then
  113. cross_compiling=maybe
  114. fi
  115. # We may wish to install the target headers somewhere.
  116. AC_MSG_CHECKING([whether to install libiberty headers and static library])
  117. dnl install-libiberty is disabled by default
  118. AC_ARG_ENABLE(install-libiberty,
  119. [ --enable-install-libiberty Install headers and library for end users],
  120. enable_install_libiberty=$enableval,
  121. enable_install_libiberty=no)dnl
  122. # Option parsed, now set things appropriately.
  123. case x"$enable_install_libiberty" in
  124. xyes|x)
  125. target_header_dir=libiberty
  126. ;;
  127. xno)
  128. target_header_dir=
  129. ;;
  130. *)
  131. # This could be sanity-checked in various ways...
  132. target_header_dir="${enable_install_libiberty}"
  133. ;;
  134. esac
  135. AC_MSG_RESULT($enable_install_libiberty)
  136. AC_MSG_NOTICE([target_header_dir = $target_header_dir])
  137. GCC_NO_EXECUTABLES
  138. AC_PROG_CC
  139. AC_SYS_LARGEFILE
  140. AC_PROG_CPP_WERROR
  141. ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wc++-compat \
  142. -Wstrict-prototypes], [ac_libiberty_warn_cflags])
  143. ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([], [ac_libiberty_warn_cflags])
  144. AC_PROG_CC_C_O
  145. # autoconf is lame and doesn't give us any substitution variable for this.
  146. if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
  147. NO_MINUS_C_MINUS_O=yes
  148. else
  149. OUTPUT_OPTION='-o $@'
  150. fi
  151. AC_SUBST(NO_MINUS_C_MINUS_O)
  152. AC_SUBST(OUTPUT_OPTION)
  153. AC_C_CONST
  154. AC_C_INLINE
  155. AC_C_BIGENDIAN
  156. dnl When we start using libtool:
  157. dnl Default to a non shared library. This may be overridden by the
  158. dnl configure option --enable-shared.
  159. dnl AM_DISABLE_SHARED
  160. dnl When we start using libtool:
  161. dnl AM_PROG_LIBTOOL
  162. dnl When we start using automake:
  163. dnl AM_CONFIG_HEADER(config.h:config.in)
  164. AC_CONFIG_HEADER(config.h:config.in)
  165. dnl When we start using automake:
  166. dnl AM_MAINTAINER_MODE
  167. dnl AC_EXEEXT
  168. dnl When we start using automake:
  169. dnl AM_PROG_INSTALL
  170. AC_PROG_INSTALL
  171. # Don't build the shared library for build.
  172. if [[ -n "${with_build_subdir}" ]]; then
  173. enable_shared=no
  174. fi
  175. frag=
  176. case "${host}" in
  177. rs6000-ibm-aix3.1 | rs6000-ibm-aix)
  178. frag=mh-aix ;;
  179. *-*-cxux7*) frag=mh-cxux7 ;;
  180. *-*-freebsd2.1.*) frag=mh-fbsd21 ;;
  181. *-*-freebsd2.2.[[012]]) frag=mh-fbsd21 ;;
  182. i370-*-opened*) frag=mh-openedition ;;
  183. i[[34567]]86-*-windows*) frag=mh-windows ;;
  184. esac
  185. if [[ -n "${frag}" ]]; then
  186. frag=${libiberty_topdir}/libiberty/config/$frag
  187. fi
  188. GCC_PICFLAG
  189. # If they didn't specify --enable-shared, don't generate shared libs.
  190. case "${enable_shared}" in
  191. yes) shared=yes ;;
  192. no) shared=no ;;
  193. "") shared=no ;;
  194. *) shared=yes ;;
  195. esac
  196. # ...unless --enable-host-shared was passed from top-level config:
  197. if [[ "${enable_host_shared}" = "yes" ]]; then
  198. shared=yes
  199. fi
  200. if [[ "${shared}" != "yes" ]]; then
  201. PICFLAG=
  202. fi
  203. AC_SUBST(PICFLAG)
  204. NOASANFLAG=
  205. case " ${CFLAGS} " in
  206. *\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;;
  207. esac
  208. AC_SUBST(NOASANFLAG)
  209. echo "# Warning: this fragment is automatically generated" > temp-frag
  210. if [[ -n "${frag}" ]] && [[ -f "${frag}" ]]; then
  211. echo "Appending ${frag} to xhost-mkfrag"
  212. echo "# Following fragment copied from ${frag}" >> temp-frag
  213. cat ${frag} >> temp-frag
  214. fi
  215. # record if we want to build shared libs.
  216. if [[ "${shared}" = "yes" ]]; then
  217. echo enable_shared = yes >> temp-frag
  218. else
  219. echo enable_shared = no >> temp-frag
  220. fi
  221. frag=xhost-mkfrag
  222. ${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag
  223. host_makefile_frag=${frag}
  224. AC_SUBST_FILE(host_makefile_frag)
  225. # It's OK to check for header files. Although the compiler may not be
  226. # able to link anything, it had better be able to at least compile
  227. # something.
  228. 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 stdint.h stdio_ext.h process.h sys/prctl.h)
  229. AC_HEADER_SYS_WAIT
  230. AC_HEADER_TIME
  231. libiberty_AC_DECLARE_ERRNO
  232. # Determine sizes of some types.
  233. AC_CHECK_SIZEOF([int])
  234. AC_CHECK_SIZEOF([long])
  235. # Check for presense of long long
  236. AC_CHECK_TYPE([long long],
  237. [AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the `long long' type.]) AC_CHECK_SIZEOF([long long])],
  238. [])
  239. # Look for a 64-bit type.
  240. AC_MSG_CHECKING([for a 64-bit type])
  241. AC_CACHE_VAL(liberty_cv_uint64,
  242. [AC_TRY_COMPILE(
  243. [#ifdef HAVE_STDINT_H
  244. #include <stdint.h>
  245. #endif],
  246. [extern uint64_t foo;],
  247. liberty_cv_uint64=uint64_t,
  248. [AC_TRY_COMPILE(
  249. [#ifdef HAVE_LIMITS_H
  250. #include <limits.h>
  251. #endif
  252. #ifndef CHAR_BIT
  253. #define CHAR_BIT 8
  254. #endif],
  255. [extern char foo[sizeof(long) * CHAR_BIT >= 64 ? 1 : -1];],
  256. liberty_cv_uint64="unsigned long",
  257. [AC_TRY_COMPILE(
  258. [#ifdef HAVE_LIMITS_H
  259. #include <limits.h>
  260. #endif
  261. #ifndef CHAR_BIT
  262. #define CHAR_BIT 8
  263. #endif],
  264. [extern char foo[sizeof(long long) * CHAR_BIT >= 64 ? 1 : -1];],
  265. liberty_cv_uint64="unsigned long long", liberty_cv_uint64=none)])])])
  266. AC_MSG_RESULT($liberty_cv_uint64)
  267. if test "$liberty_cv_uint64" != none; then
  268. AC_DEFINE_UNQUOTED(UNSIGNED_64BIT_TYPE, $liberty_cv_uint64,
  269. [Define to an unsigned 64-bit type available in the compiler.])
  270. fi
  271. AC_TYPE_INTPTR_T
  272. AC_TYPE_UINTPTR_T
  273. AC_TYPE_SSIZE_T
  274. # Given the above check, we always have uintptr_t or a fallback
  275. # definition. So define HAVE_UINTPTR_T in case any imported code
  276. # relies on it.
  277. AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
  278. AC_TYPE_PID_T
  279. # This is the list of functions which libiberty will provide if they
  280. # are not available on the host.
  281. funcs="asprintf"
  282. funcs="$funcs atexit"
  283. funcs="$funcs basename"
  284. funcs="$funcs bcmp"
  285. funcs="$funcs bcopy"
  286. funcs="$funcs bsearch"
  287. funcs="$funcs bzero"
  288. funcs="$funcs calloc"
  289. funcs="$funcs clock"
  290. funcs="$funcs ffs"
  291. funcs="$funcs getcwd"
  292. funcs="$funcs getpagesize"
  293. funcs="$funcs gettimeofday"
  294. funcs="$funcs index"
  295. funcs="$funcs insque"
  296. funcs="$funcs memchr"
  297. funcs="$funcs memcmp"
  298. funcs="$funcs memcpy"
  299. funcs="$funcs memmem"
  300. funcs="$funcs memmove"
  301. funcs="$funcs mempcpy"
  302. funcs="$funcs memset"
  303. funcs="$funcs mkstemps"
  304. funcs="$funcs putenv"
  305. funcs="$funcs random"
  306. funcs="$funcs rename"
  307. funcs="$funcs rindex"
  308. funcs="$funcs setenv"
  309. funcs="$funcs snprintf"
  310. funcs="$funcs sigsetmask"
  311. funcs="$funcs stpcpy"
  312. funcs="$funcs stpncpy"
  313. funcs="$funcs strcasecmp"
  314. funcs="$funcs strchr"
  315. funcs="$funcs strdup"
  316. funcs="$funcs strncasecmp"
  317. funcs="$funcs strndup"
  318. funcs="$funcs strnlen"
  319. funcs="$funcs strrchr"
  320. funcs="$funcs strstr"
  321. funcs="$funcs strtod"
  322. funcs="$funcs strtol"
  323. funcs="$funcs strtoul"
  324. funcs="$funcs strtoll"
  325. funcs="$funcs strtoull"
  326. funcs="$funcs strverscmp"
  327. funcs="$funcs tmpnam"
  328. funcs="$funcs vasprintf"
  329. funcs="$funcs vfprintf"
  330. funcs="$funcs vprintf"
  331. funcs="$funcs vsnprintf"
  332. funcs="$funcs vsprintf"
  333. funcs="$funcs waitpid"
  334. funcs="$funcs setproctitle"
  335. # Also in the old function.def file: alloca, vfork, getopt.
  336. vars="sys_errlist sys_nerr sys_siglist"
  337. checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \
  338. getsysinfo gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic \
  339. realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \
  340. sysmp table times wait3 wait4"
  341. # These are neither executed nor required, but they help keep
  342. # autoheader happy without adding a bunch of text to acconfig.h.
  343. if test "x" = "y"; then
  344. AC_CHECK_FUNCS(asprintf atexit \
  345. basename bcmp bcopy bsearch bzero \
  346. calloc canonicalize_file_name clock \
  347. dup3 \
  348. ffs __fsetlocking \
  349. getcwd getpagesize getrlimit getrusage getsysinfo gettimeofday \
  350. index insque \
  351. memchr memcmp memcpy memmem memmove memset mkstemps \
  352. on_exit \
  353. psignal pstat_getdynamic pstat_getstatic putenv \
  354. random realpath rename rindex \
  355. sbrk setenv setproctitle setrlimit sigsetmask snprintf spawnve spawnvpe \
  356. stpcpy stpncpy strcasecmp strchr strdup \
  357. strerror strncasecmp strndup strnlen strrchr strsignal strstr strtod \
  358. strtol strtoul strtoll strtoull strverscmp sysconf sysctl sysmp \
  359. table times tmpnam \
  360. vasprintf vfprintf vprintf vsprintf \
  361. wait3 wait4 waitpid)
  362. AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf, strtol, strtoul, strtoll, strtoull])
  363. AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
  364. AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
  365. AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
  366. fi
  367. # For each of these functions, if the host does not provide the
  368. # function we want to put FN.o in LIBOBJS, and if the host does
  369. # provide the function, we want to define HAVE_FN in config.h.
  370. setobjs=
  371. CHECK=
  372. if test -n "${with_target_subdir}"; then
  373. # We are being configured as a target library. AC_REPLACE_FUNCS
  374. # may not work correctly, because the compiler may not be able to
  375. # link executables. Note that we may still be being configured
  376. # native.
  377. # If we are being configured for newlib, we know which functions
  378. # newlib provide and which ones we will be expected to provide.
  379. if test "x${with_newlib}" = "xyes"; then
  380. AC_LIBOBJ([asprintf])
  381. AC_LIBOBJ([basename])
  382. AC_LIBOBJ([insque])
  383. AC_LIBOBJ([random])
  384. AC_LIBOBJ([strdup])
  385. AC_LIBOBJ([vasprintf])
  386. for f in $funcs; do
  387. case "$f" in
  388. asprintf | basename | insque | random | strdup | vasprintf)
  389. ;;
  390. *)
  391. n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  392. AC_DEFINE_UNQUOTED($n)
  393. ;;
  394. esac
  395. done
  396. # newlib doesnt provide any of the variables in $vars, so we
  397. # dont have to check them here.
  398. # Of the functions in $checkfuncs, newlib only has strerror.
  399. AC_DEFINE(HAVE_STRERROR)
  400. setobjs=yes
  401. fi
  402. # If we are being configured for Mingw, we know which functions
  403. # Mingw provides and which ones we will be expected to provide.
  404. case "${host}" in
  405. *-*-mingw*)
  406. AC_LIBOBJ([asprintf])
  407. AC_LIBOBJ([basename])
  408. AC_LIBOBJ([bcmp])
  409. AC_LIBOBJ([bcopy])
  410. AC_LIBOBJ([bzero])
  411. AC_LIBOBJ([clock])
  412. AC_LIBOBJ([ffs])
  413. AC_LIBOBJ([getpagesize])
  414. AC_LIBOBJ([index])
  415. AC_LIBOBJ([insque])
  416. AC_LIBOBJ([mempcpy])
  417. AC_LIBOBJ([mkstemps])
  418. AC_LIBOBJ([random])
  419. AC_LIBOBJ([rindex])
  420. AC_LIBOBJ([sigsetmask])
  421. AC_LIBOBJ([stpcpy])
  422. AC_LIBOBJ([stpncpy])
  423. AC_LIBOBJ([strndup])
  424. AC_LIBOBJ([strnlen])
  425. AC_LIBOBJ([strverscmp])
  426. AC_LIBOBJ([vasprintf])
  427. AC_LIBOBJ([waitpid])
  428. for f in $funcs; do
  429. case "$f" in
  430. asprintf | basename | bcmp | bcopy | bzero | clock | ffs | getpagesize | index | insque | mempcpy | mkstemps | random | rindex | sigsetmask | stpcpy | stpncpy | strdup | strndup | strnlen | strverscmp | vasprintf | waitpid)
  431. ;;
  432. *)
  433. n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  434. AC_DEFINE_UNQUOTED($n)
  435. ;;
  436. esac
  437. done
  438. # Mingw doesnt provide any of the variables in $vars, so we
  439. # dont have to check them here.
  440. # Of the functions in $checkfuncs, Mingw only has strerror.
  441. AC_DEFINE(HAVE_STRERROR)
  442. setobjs=yes
  443. ;;
  444. *-*-msdosdjgpp)
  445. AC_LIBOBJ([vasprintf])
  446. AC_LIBOBJ([vsnprintf])
  447. AC_LIBOBJ([snprintf])
  448. AC_LIBOBJ([asprintf])
  449. for f in atexit basename bcmp bcopy bsearch bzero calloc clock ffs \
  450. getcwd getpagesize getrusage gettimeofday \
  451. index insque memchr memcmp memcpy memmove memset psignal \
  452. putenv random rename rindex sbrk setenv stpcpy strcasecmp \
  453. strchr strdup strerror strncasecmp strrchr strstr strtod \
  454. strtol strtoul sysconf times tmpnam vfprintf vprintf \
  455. vsprintf waitpid
  456. do
  457. n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  458. AC_DEFINE_UNQUOTED($n)
  459. done
  460. setobjs=yes
  461. ;;
  462. esac
  463. else
  464. # Not a target library, so we set things up to run the test suite.
  465. CHECK=really-check
  466. fi
  467. AC_SUBST(CHECK)
  468. AC_SUBST(target_header_dir)
  469. case "${host}" in
  470. *-*-cygwin* | *-*-mingw*)
  471. AC_DEFINE(HAVE_SYS_ERRLIST)
  472. AC_DEFINE(HAVE_SYS_NERR)
  473. ;;
  474. esac
  475. if test -z "${setobjs}"; then
  476. case "${host}" in
  477. *-*-vxworks*)
  478. # Handle VxWorks configuration specially, since on VxWorks the
  479. # libraries are actually on the target board, not in the file
  480. # system.
  481. AC_LIBOBJ([basename])
  482. AC_LIBOBJ([getpagesize])
  483. AC_LIBOBJ([insque])
  484. AC_LIBOBJ([random])
  485. AC_LIBOBJ([strcasecmp])
  486. AC_LIBOBJ([strncasecmp])
  487. AC_LIBOBJ([strdup])
  488. AC_LIBOBJ([vfork])
  489. AC_LIBOBJ([waitpid])
  490. AC_LIBOBJ([vasprintf])
  491. for f in $funcs; do
  492. case "$f" in
  493. basename | getpagesize | insque | random | strcasecmp)
  494. ;;
  495. strncasecmp | strdup | vfork | waitpid | vasprintf)
  496. ;;
  497. *)
  498. n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  499. AC_DEFINE_UNQUOTED($n)
  500. ;;
  501. esac
  502. done
  503. # VxWorks doesn't provide any of the variables in $vars, so we
  504. # don't have to check them here.
  505. # Of the functions in $checkfuncs, VxWorks only has strerror.
  506. AC_DEFINE(HAVE_STRERROR)
  507. setobjs=yes
  508. ;;
  509. esac
  510. fi
  511. if test -z "${setobjs}"; then
  512. case "${host}" in
  513. *-*-mingw32*)
  514. # Under mingw32, sys_nerr and sys_errlist exist, but they are
  515. # macros, so the test below won't find them.
  516. libiberty_cv_var_sys_nerr=yes
  517. libiberty_cv_var_sys_errlist=yes
  518. ;;
  519. *-*-msdosdjgpp*)
  520. # vfork and fork are stubs.
  521. ac_cv_func_vfork_works=no
  522. ;;
  523. *-*-uwin*)
  524. # Under some versions of uwin, vfork is notoriously buggy and the test
  525. # can hang configure; on other versions, vfork exists just as a stub.
  526. # FIXME: This should be removed once vfork in uwin's runtime is fixed.
  527. ac_cv_func_vfork_works=no
  528. # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
  529. # macros (actually, these are imported from a DLL, but the end effect
  530. # is the same), so the test below won't find them.
  531. libiberty_cv_var_sys_nerr=yes
  532. libiberty_cv_var_sys_errlist=yes
  533. ;;
  534. *-*-*vms*)
  535. # Under VMS, vfork works very different than on Unix. The standard test
  536. # won't work, and it isn't easily adaptable. It makes more sense to
  537. # just force it.
  538. ac_cv_func_vfork_works=yes
  539. ;;
  540. esac
  541. # We haven't set the list of objects yet. Use the standard autoconf
  542. # tests. This will only work if the compiler works.
  543. AC_ISC_POSIX
  544. AC_REPLACE_FUNCS($funcs)
  545. libiberty_AC_FUNC_C_ALLOCA
  546. AC_FUNC_FORK
  547. if test $ac_cv_func_vfork_works = no; then
  548. AC_LIBOBJ([vfork])
  549. fi
  550. # We only need _doprnt if we might use it to implement v*printf.
  551. if test $ac_cv_func_vprintf != yes \
  552. || test $ac_cv_func_vfprintf != yes \
  553. || test $ac_cv_func_vsprintf != yes; then
  554. AC_REPLACE_FUNCS(_doprnt)
  555. else
  556. AC_CHECK_FUNCS(_doprnt)
  557. fi
  558. for v in $vars; do
  559. AC_MSG_CHECKING([for $v])
  560. AC_CACHE_VAL(libiberty_cv_var_$v,
  561. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])],
  562. [eval "libiberty_cv_var_$v=yes"],
  563. [eval "libiberty_cv_var_$v=no"])])
  564. if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
  565. AC_MSG_RESULT(yes)
  566. n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  567. AC_DEFINE_UNQUOTED($n)
  568. else
  569. AC_MSG_RESULT(no)
  570. fi
  571. done
  572. # special check for _system_configuration because AIX <4.3.2 do not
  573. # contain the `physmem' member.
  574. AC_MSG_CHECKING([for external symbol _system_configuration])
  575. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/systemcfg.h>]],
  576. [[double x = _system_configuration.physmem;]])],
  577. [AC_MSG_RESULT([yes])
  578. AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1,
  579. [Define if you have the _system_configuration variable.])],
  580. [AC_MSG_RESULT([no])])
  581. AC_CHECK_FUNCS($checkfuncs)
  582. AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
  583. AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk])
  584. AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
  585. AC_CHECK_DECLS([strverscmp])
  586. libiberty_NEED_DECLARATION(canonicalize_file_name)
  587. fi
  588. # Figure out which version of pexecute to use.
  589. case "${host}" in
  590. *-*-mingw* | *-*-winnt*) pexecute=pex-win32 ;;
  591. *-*-msdosdjgpp*) pexecute=pex-djgpp ;;
  592. *-*-msdos*) pexecute=pex-msdos ;;
  593. *) pexecute=pex-unix ;;
  594. esac
  595. AC_SUBST(pexecute)
  596. libiberty_AC_FUNC_STRNCMP
  597. # Install a library built with a cross compiler in $(tooldir) rather
  598. # than $(libdir).
  599. if test -z "${with_cross_host}"; then
  600. INSTALL_DEST=libdir
  601. else
  602. INSTALL_DEST=tooldir
  603. fi
  604. AC_SUBST(INSTALL_DEST)
  605. m4_pattern_allow(LIBOBJS)
  606. L=""
  607. for l in x $LIBOBJS; do
  608. case $l in
  609. x) ;;
  610. *) L="$L ./$l" ;;
  611. esac
  612. done
  613. LIBOBJS="$L"
  614. dnl Required by html and install-html
  615. AC_SUBST(datarootdir)
  616. AC_SUBST(docdir)
  617. AC_SUBST(htmldir)
  618. # We need multilib support, but only if configuring for the target.
  619. AC_CONFIG_FILES([Makefile testsuite/Makefile])
  620. AC_CONFIG_COMMANDS([default],
  621. [[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
  622. if test -n "$CONFIG_FILES"; then
  623. if test -n "${with_target_subdir}"; then
  624. # FIXME: We shouldn't need to set ac_file
  625. ac_file=Makefile
  626. LD="${ORIGINAL_LD_FOR_MULTILIBS}"
  627. . ${libiberty_topdir}/config-ml.in
  628. fi
  629. fi]],
  630. [[srcdir=${srcdir}
  631. host=${host}
  632. target=${target}
  633. with_target_subdir=${with_target_subdir}
  634. with_multisubdir=${with_multisubdir}
  635. ac_configure_args="--enable-multilib ${ac_configure_args}"
  636. CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
  637. ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
  638. libiberty_topdir=${libiberty_topdir}
  639. ]])
  640. AC_OUTPUT