Fix changelog.
[deliverable/binutils-gdb.git] / libiberty / configure.in
CommitLineData
252b5132
RH
1dnl Process this file with autoconf to produce a configure script
2
0c0a36a4 3AC_PREREQ(2.13)
5a17353c 4AC_INIT(xmalloc.c)
252b5132 5
52d98c2d
DD
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
252b5132
RH
12dnl We use these options to decide which functions to include.
13AC_ARG_WITH(target-subdir,
cfed0715
DD
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])
252b5132
RH
17AC_ARG_WITH(cross-host,
18[ --with-cross-host=HOST Configuring with a cross compiler])
19AC_ARG_WITH(newlib,
20[ --with-newlib Configuring with newlib])
21
22if test "${srcdir}" = "."; then
cfed0715
DD
23 if test -n "${with_build_subdir}"; then
24 libiberty_topdir="${srcdir}/../.."
25 with_target_subdir=
26 elif test -z "${with_target_subdir}"; then
252b5132
RH
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
85b9a938 38AC_SUBST(libiberty_topdir)
252b5132
RH
39AC_CONFIG_AUX_DIR($libiberty_topdir)
40
39423523
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
fa9f0e33
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, )
1a78a35a
DD
67if test "x$MAKEINFO" = "x"; then
68 MAKEINFO="@echo makeinfo missing; true"
fa9f0e33 69 BUILD_INFO=
1a78a35a
DD
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([
fa9f0e33 77*** Makeinfo is too old. Info documentation will not be built.])
1a78a35a
DD
78 ;;
79 esac
80fi
fa9f0e33 81AC_SUBST(MAKEINFO)
39423523
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
252b5132
RH
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
252b5132
RH
102LIB_AC_PROG_CC
103
b39b76b8
DD
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
252b5132 114AC_ISC_POSIX
2ea7befd
DD
115AC_C_CONST
116AC_C_INLINE
252b5132
RH
117
118dnl When we start using libtool:
119dnl Default to a non shared library. This may be overridden by the
120dnl configure option --enable-shared.
121dnl AM_DISABLE_SHARED
122
123dnl When we start using libtool:
124dnl AM_PROG_LIBTOOL
125
126dnl When we start using automake:
127dnl AM_CONFIG_HEADER(config.h:config.in)
128AC_CONFIG_HEADER(config.h:config.in)
129
130dnl When we start using automake:
131dnl AM_MAINTAINER_MODE
132dnl AC_EXEEXT
133
134dnl When we start using automake:
135dnl AM_PROG_INSTALL
136AC_PROG_INSTALL
137
138. ${srcdir}/config.table
139host_makefile_frag=${frag}
140AC_SUBST_FILE(host_makefile_frag)
141
142# It's OK to check for header files. Although the compiler may not be
143# able to link anything, it had better be able to at least compile
144# something.
cc529274 145AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.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)
252b5132 146AC_HEADER_SYS_WAIT
62df2065 147AC_HEADER_TIME
252b5132 148
7d3ffcaf
JL
149libiberty_AC_DECLARE_ERRNO
150
15ae9e71 151AC_CHECK_TYPE(uintptr_t, unsigned long)
daf7c4ad
DD
152# Given the above check, we always have uintptr_t or a fallback
153# definition. So define HAVE_UINTPTR_T in case any imported code
154# relies on it.
155AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
dc579051 156
cafa3917
DD
157AC_TYPE_PID_T
158
252b5132
RH
159# This is the list of functions which libiberty will provide if they
160# are not available on the host.
161
162funcs="asprintf"
163funcs="$funcs atexit"
164funcs="$funcs basename"
165funcs="$funcs bcmp"
166funcs="$funcs bcopy"
c6da642e 167funcs="$funcs bsearch"
252b5132
RH
168funcs="$funcs bzero"
169funcs="$funcs calloc"
170funcs="$funcs clock"
7b78baae 171funcs="$funcs ffs"
252b5132
RH
172funcs="$funcs getcwd"
173funcs="$funcs getpagesize"
174funcs="$funcs index"
175funcs="$funcs insque"
176funcs="$funcs memchr"
177funcs="$funcs memcmp"
178funcs="$funcs memcpy"
179funcs="$funcs memmove"
180funcs="$funcs memset"
181funcs="$funcs mkstemps"
0c0a36a4 182funcs="$funcs putenv"
252b5132
RH
183funcs="$funcs random"
184funcs="$funcs rename"
185funcs="$funcs rindex"
0c0a36a4 186funcs="$funcs setenv"
252b5132
RH
187funcs="$funcs sigsetmask"
188funcs="$funcs strcasecmp"
189funcs="$funcs strchr"
190funcs="$funcs strdup"
191funcs="$funcs strncasecmp"
192funcs="$funcs strrchr"
193funcs="$funcs strstr"
194funcs="$funcs strtod"
195funcs="$funcs strtol"
196funcs="$funcs strtoul"
197funcs="$funcs tmpnam"
198funcs="$funcs vasprintf"
199funcs="$funcs vfprintf"
200funcs="$funcs vprintf"
201funcs="$funcs vsprintf"
202funcs="$funcs waitpid"
203
204# Also in the old function.def file: alloca, vfork, getopt.
205
cc529274 206vars="sys_errlist sys_nerr sys_siglist _system_configuration"
252b5132 207
0c0a36a4 208checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
192cbe66 209checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
cc529274 210checkfuncs="$checkfuncs getsysinfo table sysctl"
252b5132
RH
211
212# These are neither executed nor required, but they help keep
213# autoheader happy without adding a bunch of text to acconfig.h.
214if test "x" = "y"; then
c6da642e
DD
215 AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock)
216 AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy)
217 AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask)
218 AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr)
219 AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
220 AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
7b78baae 221 AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
cc529274 222 AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl)
ba61a412 223 AC_CHECK_FUNCS(realpath canonicalize_file_name)
2ea7befd
DD
224 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
225 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
226 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
cc529274 227 AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, [Define if you have the _system_configuration variable.])
252b5132
RH
228fi
229
230# For each of these functions, if the host does not provide the
231# function we want to put FN.o in LIBOBJS, and if the host does
30673bf5 232# provide the function, we want to define HAVE_FN in config.h.
252b5132
RH
233
234setobjs=
0c0a36a4 235CHECK=
50d4562d 236target_header_dir=
252b5132
RH
237if test -n "${with_target_subdir}"; then
238
239 # We are being configured as a target library. AC_REPLACE_FUNCS
240 # may not work correctly, because the compiler may not be able to
241 # link executables. Note that we may still be being configured
242 # native.
243
244 # If we are being configured for newlib, we know which functions
245 # newlib provide and which ones we will be expected to provide.
246
247 if test "x${with_newlib}" = "xyes"; then
252b5132
RH
248 LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
249
250 for f in $funcs; do
251 case "$f" in
252 asprintf | basename | insque | random | strdup | vasprintf)
253 ;;
254 *)
255 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
256 AC_DEFINE_UNQUOTED($n)
257 ;;
258 esac
259 done
260
261 # newlib doesnt provide any of the variables in $vars, so we
262 # dont have to check them here.
263
264 # Of the functions in $checkfuncs, newlib only has strerror.
2ea7befd 265 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
252b5132
RH
266
267 setobjs=yes
268
269 fi
0c0a36a4 270
50d4562d
DD
271 # We may wish to install the target headers somewhere.
272 AC_ARG_ENABLE(install-libiberty,
273 [ --enable-install-libiberty Install headers for end users],
274 enable_install_libiberty=$enableval,
275 enable_install_libiberty=no)dnl
276
277 # Option parsed, now set things appropriately.
278 case x"$enable_install_libiberty" in
279 xyes|x)
280 target_header_dir=libiberty
281 ;;
282 xno)
283 target_header_dir=
284 ;;
285 *)
286 # This could be sanity-checked in various ways...
287 target_header_dir="${enable_install_libiberty}"
288 ;;
289 esac
290
291
0c0a36a4
ILT
292else
293
294 # Not a target library, so we set things up to run the test suite.
295 CHECK=check-cplus-dem
296
252b5132
RH
297fi
298
0c0a36a4 299AC_SUBST(CHECK)
50d4562d 300AC_SUBST(target_header_dir)
0c0a36a4 301
f01b59ed 302case "${host}" in
bef8b55d 303 *-*-cygwin* | *-*-mingw*)
24acd898
DD
304 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
305 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
f01b59ed
DD
306 ;;
307esac
308
252b5132
RH
309if test -z "${setobjs}"; then
310 case "${host}" in
311
312 *-*-vxworks*)
313 # Handle VxWorks configuration specially, since on VxWorks the
314 # libraries are actually on the target board, not in the file
315 # system.
316 LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
317 LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
318 for f in $funcs; do
319 case "$f" in
320 basename | getpagesize | insque | random | strcasecmp)
321 ;;
322 strncasecmp | strdup | vfork | waitpid | vasprintf)
323 ;;
324 *)
325 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
326 AC_DEFINE_UNQUOTED($n)
327 ;;
328 esac
329 done
330
331 # VxWorks doesn't provide any of the variables in $vars, so we
332 # don't have to check them here.
333
334 # Of the functions in $checkfuncs, VxWorks only has strerror.
2ea7befd 335 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
252b5132
RH
336
337 setobjs=yes
338 ;;
339
340 esac
341fi
342
343if test -z "${setobjs}"; then
344
345 case "${host}" in
346
347 *-*-cygwin*)
348 # The Cygwin library actually uses a couple of files from
349 # libiberty when it is built. If we are building a native
350 # Cygwin, and we run the tests, we will appear to have these
351 # files. However, when we go on to build winsup, we will wind up
352 # with a library which does not have the files, since they should
353 # have come from libiberty.
354
355 # We handle this by removing the functions the winsup library
356 # provides from our shell variables, so that they appear to be
357 # missing.
358
64e3a659
DD
359 # DJ - only if we're *building* cygwin, not just building *with* cygwin
360
361 if test -n "${with_target_subdir}"
362 then
363 funcs="`echo $funcs | sed -e 's/random//'`"
364 LIBOBJS="$LIBOBJS random.o"
365 vars="`echo $vars | sed -e 's/sys_siglist//'`"
366 checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
367 fi
252b5132
RH
368 ;;
369
370 *-*-mingw32*)
371 # Under mingw32, sys_nerr and sys_errlist exist, but they are
372 # macros, so the test below won't find them.
2ea7befd
DD
373 libiberty_cv_var_sys_nerr=yes
374 libiberty_cv_var_sys_errlist=yes
252b5132
RH
375 ;;
376
377 *-*-uwin*)
378 # Under some versions of uwin, vfork is notoriously buggy and the test
379 # can hang configure; on other versions, vfork exists just as a stub.
380 # FIXME: This should be removed once vfork in uwin's runtime is fixed.
381 ac_cv_func_vfork_works=no
0c0a36a4
ILT
382 # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
383 # macros (actually, these are imported from a DLL, but the end effect
384 # is the same), so the test below won't find them.
2ea7befd
DD
385 libiberty_cv_var_sys_nerr=yes
386 libiberty_cv_var_sys_errlist=yes
252b5132
RH
387 ;;
388
c0eb281b
DD
389 *-*-*vms*)
390 # Under VMS, vfork works very different than on Unix. The standard test
391 # won't work, and it isn't easily adaptable. It makes more sense to
392 # just force it.
393 ac_cv_func_vfork_works=yes
394 ;;
395
252b5132
RH
396 esac
397
398 # We haven't set the list of objects yet. Use the standard autoconf
399 # tests. This will only work if the compiler works.
400 AC_PROG_CC_WORKS
401 AC_REPLACE_FUNCS($funcs)
30673bf5 402 libiberty_AC_FUNC_C_ALLOCA
252b5132
RH
403 AC_FUNC_VFORK
404 if test $ac_cv_func_vfork_works = no; then
405 LIBOBJS="$LIBOBJS vfork.o"
406 fi
24acd898
DD
407 # We only need _doprnt if we might use it to implement v*printf.
408 if test $ac_cv_func_vprintf != yes \
409 || test $ac_cv_func_vfprintf != yes \
410 || test $ac_cv_func_vsprintf != yes; then
411 AC_REPLACE_FUNCS(_doprnt)
cc096b71
DD
412 else
413 AC_CHECK_FUNCS(_doprnt)
24acd898
DD
414 fi
415
252b5132
RH
416 for v in $vars; do
417 AC_MSG_CHECKING([for $v])
418 AC_CACHE_VAL(libiberty_cv_var_$v,
18893690 419 [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;],
252b5132
RH
420 [eval "libiberty_cv_var_$v=yes"],
421 [eval "libiberty_cv_var_$v=no"])])
422 if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
423 AC_MSG_RESULT(yes)
424 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
425 AC_DEFINE_UNQUOTED($n)
426 else
427 AC_MSG_RESULT(no)
428 fi
429 done
430 AC_CHECK_FUNCS($checkfuncs)
ba61a412 431 libiberty_NEED_DECLARATION(canonicalize_file_name)
252b5132
RH
432fi
433
5a17353c
DD
434# Figure out which version of pexecute to use.
435case "${host}" in
5a17353c
DD
436 *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;;
437 *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;;
438 *-*-msdos*) pexecute=pex-msdos.o ;;
439 *-*-os2-emx*) pexecute=pex-os2.o ;;
440 *) pexecute=pex-unix.o ;;
441esac
442AC_SUBST(pexecute)
443
eb383413
L
444libiberty_AC_FUNC_STRNCMP
445
252b5132
RH
446# Install a library built with a cross compiler in $(tooldir) rather
447# than $(libdir).
448if test -z "${with_cross_host}"; then
449 INSTALL_DEST=libdir
450else
451 INSTALL_DEST=tooldir
452fi
453AC_SUBST(INSTALL_DEST)
454
455# We need multilib support, but only if configuring for the target.
0c0a36a4 456AC_OUTPUT(Makefile testsuite/Makefile,
252b5132
RH
457[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
458if test -n "$CONFIG_FILES"; then
cfed0715 459 if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
252b5132
RH
460 # FIXME: We shouldn't need to set ac_file
461 ac_file=Makefile
52d98c2d 462 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
252b5132
RH
463 . ${libiberty_topdir}/config-ml.in
464 fi
465fi],
466srcdir=${srcdir}
467host=${host}
468target=${target}
469with_target_subdir=${with_target_subdir}
cfed0715 470with_build_subdir=${with_build_subdir}
252b5132
RH
471with_multisubdir=${with_multisubdir}
472ac_configure_args="--enable-multilib ${ac_configure_args}"
473CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
8b90eef4 474ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
252b5132
RH
475libiberty_topdir=${libiberty_topdir}
476)
This page took 0.170323 seconds and 4 git commands to generate.