2002-04-24 Pierre Muller <ics.u-strasbg.fr>
[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)
252b5132
RH
4AC_INIT(pexecute.c)
5
6dnl We use these options to decide which functions to include.
7AC_ARG_WITH(target-subdir,
cfed0715
DD
8[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
9AC_ARG_WITH(build-subdir,
10[ --with-build-subdir=SUBDIR Configuring in a subdirectory for build])
252b5132
RH
11AC_ARG_WITH(cross-host,
12[ --with-cross-host=HOST Configuring with a cross compiler])
13AC_ARG_WITH(newlib,
14[ --with-newlib Configuring with newlib])
15
16if test "${srcdir}" = "."; then
cfed0715
DD
17 if test -n "${with_build_subdir}"; then
18 libiberty_topdir="${srcdir}/../.."
19 with_target_subdir=
20 elif test -z "${with_target_subdir}"; then
252b5132
RH
21 libiberty_topdir="${srcdir}/.."
22 else
23 if test "${with_target_subdir}" != "."; then
24 libiberty_topdir="${srcdir}/${with_multisrctop}../.."
25 else
26 libiberty_topdir="${srcdir}/${with_multisrctop}.."
27 fi
28 fi
29else
30 libiberty_topdir="${srcdir}/.."
31fi
32AC_CONFIG_AUX_DIR($libiberty_topdir)
33
39423523
DD
34dnl Very limited version of automake's enable-maintainer-mode
35
36AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
37 dnl maintainer-mode is disabled by default
38 AC_ARG_ENABLE(maintainer-mode,
39[ --enable-maintainer-mode
40 enable make rules and dependencies not useful
41 (and sometimes confusing) to the casual installer],
42 maintainer_mode=$enableval,
43 maintainer_mode=no)
44
45AC_MSG_RESULT($maintainer_mode)
46
47if test "$maintainer_mode" = "yes"; then
48 MAINT=''
49 NOTMAINT='#'
50else
51 MAINT='#'
52 NOTMAINT=''
53fi
54AC_SUBST(MAINT)dnl
55AC_SUBST(NOTMAINT)dnl
56
fa9f0e33
DD
57# Do we have a single-tree copy of texinfo? Even if we do, we can't
58# rely on it - libiberty is built before texinfo.
59AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
1a78a35a
DD
60if test "x$MAKEINFO" = "x"; then
61 MAKEINFO="@echo makeinfo missing; true"
fa9f0e33 62 BUILD_INFO=
1a78a35a
DD
63else
64 BUILD_INFO=info
65 case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
66 x*\ [[1-3]].* )
67 MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true"
68 BUILD_INFO=
69 AC_MSG_WARN([
fa9f0e33 70*** Makeinfo is too old. Info documentation will not be built.])
1a78a35a
DD
71 ;;
72 esac
73fi
fa9f0e33 74AC_SUBST(MAKEINFO)
39423523
DD
75AC_SUBST(BUILD_INFO)
76
77AC_CHECK_PROG(PERL, perl, perl, )
78if test x"$PERL" = x""; then
79 HAVE_PERL='#'
80else
81 HAVE_PERL=''
82fi
83AC_SUBST(HAVE_PERL)
84
252b5132
RH
85AC_CANONICAL_HOST
86
87dnl When we start using automake:
88dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
89
90dnl These must be called before AM_PROG_LIBTOOL, because it may want
91dnl to call AC_CHECK_PROG.
92AC_CHECK_TOOL(AR, ar)
93AC_CHECK_TOOL(RANLIB, ranlib, :)
94
252b5132
RH
95LIB_AC_PROG_CC
96
97AC_ISC_POSIX
2ea7befd
DD
98AC_C_CONST
99AC_C_INLINE
252b5132
RH
100
101dnl When we start using libtool:
102dnl Default to a non shared library. This may be overridden by the
103dnl configure option --enable-shared.
104dnl AM_DISABLE_SHARED
105
106dnl When we start using libtool:
107dnl AM_PROG_LIBTOOL
108
109dnl When we start using automake:
110dnl AM_CONFIG_HEADER(config.h:config.in)
111AC_CONFIG_HEADER(config.h:config.in)
112
113dnl When we start using automake:
114dnl AM_MAINTAINER_MODE
115dnl AC_EXEEXT
116
117dnl When we start using automake:
118dnl AM_PROG_INSTALL
119AC_PROG_INSTALL
120
121. ${srcdir}/config.table
122host_makefile_frag=${frag}
123AC_SUBST_FILE(host_makefile_frag)
124
125# It's OK to check for header files. Although the compiler may not be
126# able to link anything, it had better be able to at least compile
127# something.
5527febf 128AC_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)
252b5132 129AC_HEADER_SYS_WAIT
62df2065 130AC_HEADER_TIME
252b5132 131
7d3ffcaf
JL
132libiberty_AC_DECLARE_ERRNO
133
15ae9e71 134AC_CHECK_TYPE(uintptr_t, unsigned long)
dc579051 135
15ae9e71 136if test $ac_cv_type_uintptr_t = yes
dc579051 137then
24acd898 138 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
dc579051
DD
139fi
140
252b5132
RH
141# This is the list of functions which libiberty will provide if they
142# are not available on the host.
143
144funcs="asprintf"
145funcs="$funcs atexit"
146funcs="$funcs basename"
147funcs="$funcs bcmp"
148funcs="$funcs bcopy"
c6da642e 149funcs="$funcs bsearch"
252b5132
RH
150funcs="$funcs bzero"
151funcs="$funcs calloc"
152funcs="$funcs clock"
7b78baae 153funcs="$funcs ffs"
252b5132
RH
154funcs="$funcs getcwd"
155funcs="$funcs getpagesize"
156funcs="$funcs index"
157funcs="$funcs insque"
158funcs="$funcs memchr"
159funcs="$funcs memcmp"
160funcs="$funcs memcpy"
161funcs="$funcs memmove"
162funcs="$funcs memset"
163funcs="$funcs mkstemps"
0c0a36a4 164funcs="$funcs putenv"
252b5132
RH
165funcs="$funcs random"
166funcs="$funcs rename"
167funcs="$funcs rindex"
0c0a36a4 168funcs="$funcs setenv"
252b5132
RH
169funcs="$funcs sigsetmask"
170funcs="$funcs strcasecmp"
171funcs="$funcs strchr"
172funcs="$funcs strdup"
173funcs="$funcs strncasecmp"
174funcs="$funcs strrchr"
175funcs="$funcs strstr"
176funcs="$funcs strtod"
177funcs="$funcs strtol"
178funcs="$funcs strtoul"
179funcs="$funcs tmpnam"
180funcs="$funcs vasprintf"
181funcs="$funcs vfprintf"
182funcs="$funcs vprintf"
183funcs="$funcs vsprintf"
184funcs="$funcs waitpid"
185
186# Also in the old function.def file: alloca, vfork, getopt.
187
188vars="sys_errlist sys_nerr sys_siglist"
189
0c0a36a4 190checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
252b5132
RH
191
192# These are neither executed nor required, but they help keep
193# autoheader happy without adding a bunch of text to acconfig.h.
194if test "x" = "y"; then
c6da642e
DD
195 AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock)
196 AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy)
197 AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask)
198 AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr)
199 AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
200 AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
7b78baae 201 AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
2ea7befd
DD
202 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
203 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
204 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
252b5132
RH
205fi
206
207# For each of these functions, if the host does not provide the
208# function we want to put FN.o in LIBOBJS, and if the host does
30673bf5 209# provide the function, we want to define HAVE_FN in config.h.
252b5132
RH
210
211setobjs=
0c0a36a4 212CHECK=
50d4562d 213target_header_dir=
252b5132
RH
214if test -n "${with_target_subdir}"; then
215
216 # We are being configured as a target library. AC_REPLACE_FUNCS
217 # may not work correctly, because the compiler may not be able to
218 # link executables. Note that we may still be being configured
219 # native.
220
221 # If we are being configured for newlib, we know which functions
222 # newlib provide and which ones we will be expected to provide.
223
224 if test "x${with_newlib}" = "xyes"; then
252b5132
RH
225 LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
226
227 for f in $funcs; do
228 case "$f" in
229 asprintf | basename | insque | random | strdup | vasprintf)
230 ;;
231 *)
232 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
233 AC_DEFINE_UNQUOTED($n)
234 ;;
235 esac
236 done
237
238 # newlib doesnt provide any of the variables in $vars, so we
239 # dont have to check them here.
240
241 # Of the functions in $checkfuncs, newlib only has strerror.
2ea7befd 242 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
252b5132
RH
243
244 setobjs=yes
245
246 fi
0c0a36a4 247
50d4562d
DD
248 # We may wish to install the target headers somewhere.
249 AC_ARG_ENABLE(install-libiberty,
250 [ --enable-install-libiberty Install headers for end users],
251 enable_install_libiberty=$enableval,
252 enable_install_libiberty=no)dnl
253
254 # Option parsed, now set things appropriately.
255 case x"$enable_install_libiberty" in
256 xyes|x)
257 target_header_dir=libiberty
258 ;;
259 xno)
260 target_header_dir=
261 ;;
262 *)
263 # This could be sanity-checked in various ways...
264 target_header_dir="${enable_install_libiberty}"
265 ;;
266 esac
267
268
0c0a36a4
ILT
269else
270
271 # Not a target library, so we set things up to run the test suite.
272 CHECK=check-cplus-dem
273
252b5132
RH
274fi
275
0c0a36a4 276AC_SUBST(CHECK)
50d4562d 277AC_SUBST(target_header_dir)
0c0a36a4 278
f01b59ed 279case "${host}" in
bef8b55d 280 *-*-cygwin* | *-*-mingw*)
24acd898
DD
281 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
282 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
f01b59ed
DD
283 ;;
284esac
285
252b5132
RH
286if test -z "${setobjs}"; then
287 case "${host}" in
288
289 *-*-vxworks*)
290 # Handle VxWorks configuration specially, since on VxWorks the
291 # libraries are actually on the target board, not in the file
292 # system.
293 LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
294 LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
295 for f in $funcs; do
296 case "$f" in
297 basename | getpagesize | insque | random | strcasecmp)
298 ;;
299 strncasecmp | strdup | vfork | waitpid | vasprintf)
300 ;;
301 *)
302 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
303 AC_DEFINE_UNQUOTED($n)
304 ;;
305 esac
306 done
307
308 # VxWorks doesn't provide any of the variables in $vars, so we
309 # don't have to check them here.
310
311 # Of the functions in $checkfuncs, VxWorks only has strerror.
2ea7befd 312 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
252b5132
RH
313
314 setobjs=yes
315 ;;
316
317 esac
318fi
319
320if test -z "${setobjs}"; then
321
322 case "${host}" in
323
324 *-*-cygwin*)
325 # The Cygwin library actually uses a couple of files from
326 # libiberty when it is built. If we are building a native
327 # Cygwin, and we run the tests, we will appear to have these
328 # files. However, when we go on to build winsup, we will wind up
329 # with a library which does not have the files, since they should
330 # have come from libiberty.
331
332 # We handle this by removing the functions the winsup library
333 # provides from our shell variables, so that they appear to be
334 # missing.
335
64e3a659
DD
336 # DJ - only if we're *building* cygwin, not just building *with* cygwin
337
338 if test -n "${with_target_subdir}"
339 then
340 funcs="`echo $funcs | sed -e 's/random//'`"
341 LIBOBJS="$LIBOBJS random.o"
342 vars="`echo $vars | sed -e 's/sys_siglist//'`"
343 checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
344 fi
252b5132
RH
345 ;;
346
347 *-*-mingw32*)
348 # Under mingw32, sys_nerr and sys_errlist exist, but they are
349 # macros, so the test below won't find them.
2ea7befd
DD
350 libiberty_cv_var_sys_nerr=yes
351 libiberty_cv_var_sys_errlist=yes
252b5132
RH
352 ;;
353
354 *-*-uwin*)
355 # Under some versions of uwin, vfork is notoriously buggy and the test
356 # can hang configure; on other versions, vfork exists just as a stub.
357 # FIXME: This should be removed once vfork in uwin's runtime is fixed.
358 ac_cv_func_vfork_works=no
0c0a36a4
ILT
359 # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
360 # macros (actually, these are imported from a DLL, but the end effect
361 # is the same), so the test below won't find them.
2ea7befd
DD
362 libiberty_cv_var_sys_nerr=yes
363 libiberty_cv_var_sys_errlist=yes
252b5132
RH
364 ;;
365
c0eb281b
DD
366 *-*-*vms*)
367 # Under VMS, vfork works very different than on Unix. The standard test
368 # won't work, and it isn't easily adaptable. It makes more sense to
369 # just force it.
370 ac_cv_func_vfork_works=yes
371 ;;
372
252b5132
RH
373 esac
374
375 # We haven't set the list of objects yet. Use the standard autoconf
376 # tests. This will only work if the compiler works.
377 AC_PROG_CC_WORKS
378 AC_REPLACE_FUNCS($funcs)
30673bf5 379 libiberty_AC_FUNC_C_ALLOCA
252b5132
RH
380 AC_FUNC_VFORK
381 if test $ac_cv_func_vfork_works = no; then
382 LIBOBJS="$LIBOBJS vfork.o"
383 fi
24acd898
DD
384 # We only need _doprnt if we might use it to implement v*printf.
385 if test $ac_cv_func_vprintf != yes \
386 || test $ac_cv_func_vfprintf != yes \
387 || test $ac_cv_func_vsprintf != yes; then
388 AC_REPLACE_FUNCS(_doprnt)
cc096b71
DD
389 else
390 AC_CHECK_FUNCS(_doprnt)
24acd898
DD
391 fi
392
252b5132
RH
393 for v in $vars; do
394 AC_MSG_CHECKING([for $v])
395 AC_CACHE_VAL(libiberty_cv_var_$v,
58b1717a 396 [AC_TRY_LINK([int *p;], [extern int $v []; p = &$v;],
252b5132
RH
397 [eval "libiberty_cv_var_$v=yes"],
398 [eval "libiberty_cv_var_$v=no"])])
399 if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
400 AC_MSG_RESULT(yes)
401 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
402 AC_DEFINE_UNQUOTED($n)
403 else
404 AC_MSG_RESULT(no)
405 fi
406 done
407 AC_CHECK_FUNCS($checkfuncs)
408fi
409
eb383413
L
410libiberty_AC_FUNC_STRNCMP
411
252b5132
RH
412# Install a library built with a cross compiler in $(tooldir) rather
413# than $(libdir).
414if test -z "${with_cross_host}"; then
415 INSTALL_DEST=libdir
416else
417 INSTALL_DEST=tooldir
418fi
419AC_SUBST(INSTALL_DEST)
420
421# We need multilib support, but only if configuring for the target.
0c0a36a4 422AC_OUTPUT(Makefile testsuite/Makefile,
252b5132
RH
423[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
424if test -n "$CONFIG_FILES"; then
cfed0715 425 if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
252b5132
RH
426 # FIXME: We shouldn't need to set ac_file
427 ac_file=Makefile
428 . ${libiberty_topdir}/config-ml.in
429 fi
430fi],
431srcdir=${srcdir}
432host=${host}
433target=${target}
434with_target_subdir=${with_target_subdir}
cfed0715 435with_build_subdir=${with_build_subdir}
252b5132
RH
436with_multisubdir=${with_multisubdir}
437ac_configure_args="--enable-multilib ${ac_configure_args}"
438CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
439libiberty_topdir=${libiberty_topdir}
440)
This page took 0.127115 seconds and 4 git commands to generate.