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