source: trunk/src/binutils/libiberty/configure.in@ 1036

Last change on this file since 1036 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

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