]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/configure.in
defineclass.cc (handleMethodsEnd): Precompute code for static method.
[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
7fda878c
DR
103AC_PROG_CC_C_O
104# autoconf is lame and doesn't give us any substitution variable for this.
105if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
106 NO_MINUS_C_MINUS_O=yes
107else
108 OUTPUT_OPTION='-o $@'
109fi
110AC_SUBST(NO_MINUS_C_MINUS_O)
111AC_SUBST(OUTPUT_OPTION)
112
3affd5f0 113AC_ISC_POSIX
d1209685
ZW
114AC_C_CONST
115AC_C_INLINE
3affd5f0
JL
116
117dnl When we start using libtool:
118dnl Default to a non shared library. This may be overridden by the
119dnl configure option --enable-shared.
120dnl AM_DISABLE_SHARED
121
122dnl When we start using libtool:
123dnl AM_PROG_LIBTOOL
124
125dnl When we start using automake:
126dnl AM_CONFIG_HEADER(config.h:config.in)
127AC_CONFIG_HEADER(config.h:config.in)
128
129dnl When we start using automake:
130dnl AM_MAINTAINER_MODE
dd8f3ed5 131dnl AC_EXEEXT
3affd5f0
JL
132
133dnl When we start using automake:
134dnl AM_PROG_INSTALL
135AC_PROG_INSTALL
6599da04
JM
136
137. ${srcdir}/config.table
138host_makefile_frag=${frag}
3affd5f0
JL
139AC_SUBST_FILE(host_makefile_frag)
140
141# It's OK to check for header files. Although the compiler may not be
142# able to link anything, it had better be able to at least compile
143# something.
c3bb7df0 144AC_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 145AC_HEADER_SYS_WAIT
c6451ce1 146AC_HEADER_TIME
6599da04 147
3b58c099
MS
148libiberty_AC_DECLARE_ERRNO
149
fdfc290b 150AC_CHECK_TYPE(uintptr_t, unsigned long)
d3982b71 151
fdfc290b 152if test $ac_cv_type_uintptr_t = yes
d3982b71 153then
e490616e 154 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
d3982b71
JL
155fi
156
deae2ed9
MM
157AC_TYPE_PID_T
158
3affd5f0
JL
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"
dac45916 167funcs="$funcs bsearch"
3affd5f0 168funcs="$funcs bzero"
a9acf741 169funcs="$funcs calloc"
3affd5f0 170funcs="$funcs clock"
29650b2b 171funcs="$funcs ffs"
3affd5f0
JL
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"
687361c8 181funcs="$funcs mkstemps"
9eb4080f 182funcs="$funcs putenv"
3affd5f0
JL
183funcs="$funcs random"
184funcs="$funcs rename"
185funcs="$funcs rindex"
9eb4080f 186funcs="$funcs setenv"
3affd5f0
JL
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
206vars="sys_errlist sys_nerr sys_siglist"
207
90e72e20 208checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
3affd5f0
JL
209
210# These are neither executed nor required, but they help keep
211# autoheader happy without adding a bunch of text to acconfig.h.
212if test "x" = "y"; then
dac45916
MS
213 AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock)
214 AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy)
215 AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask)
216 AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr)
217 AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
218 AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
29650b2b 219 AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
d1209685
ZW
220 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
221 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
222 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
6599da04
JM
223fi
224
3affd5f0
JL
225# For each of these functions, if the host does not provide the
226# function we want to put FN.o in LIBOBJS, and if the host does
b548dffb 227# provide the function, we want to define HAVE_FN in config.h.
3affd5f0
JL
228
229setobjs=
7c72138a 230CHECK=
48d7db63 231target_header_dir=
3affd5f0
JL
232if test -n "${with_target_subdir}"; then
233
ca6b370d 234 # We are being configured as a target library. AC_REPLACE_FUNCS
3affd5f0 235 # may not work correctly, because the compiler may not be able to
ca6b370d
JL
236 # link executables. Note that we may still be being configured
237 # native.
3affd5f0
JL
238
239 # If we are being configured for newlib, we know which functions
240 # newlib provide and which ones we will be expected to provide.
241
242 if test "x${with_newlib}" = "xyes"; then
ca6b370d 243 LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
3affd5f0
JL
244
245 for f in $funcs; do
246 case "$f" in
ca6b370d 247 asprintf | basename | insque | random | strdup | vasprintf)
3affd5f0
JL
248 ;;
249 *)
250 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
251 AC_DEFINE_UNQUOTED($n)
252 ;;
253 esac
254 done
255
256 # newlib doesnt provide any of the variables in $vars, so we
257 # dont have to check them here.
258
ca6b370d 259 # Of the functions in $checkfuncs, newlib only has strerror.
d1209685 260 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
3affd5f0
JL
261
262 setobjs=yes
263
264 fi
7c72138a 265
48d7db63
PE
266 # We may wish to install the target headers somewhere.
267 AC_ARG_ENABLE(install-libiberty,
268 [ --enable-install-libiberty Install headers for end users],
269 enable_install_libiberty=$enableval,
270 enable_install_libiberty=no)dnl
271
272 # Option parsed, now set things appropriately.
273 case x"$enable_install_libiberty" in
274 xyes|x)
275 target_header_dir=libiberty
276 ;;
277 xno)
278 target_header_dir=
279 ;;
280 *)
281 # This could be sanity-checked in various ways...
282 target_header_dir="${enable_install_libiberty}"
283 ;;
284 esac
285
286
7c72138a
TT
287else
288
289 # Not a target library, so we set things up to run the test suite.
290 CHECK=check-cplus-dem
291
3affd5f0
JL
292fi
293
7c72138a 294AC_SUBST(CHECK)
48d7db63 295AC_SUBST(target_header_dir)
7c72138a 296
b1c45ae4 297case "${host}" in
46af757b 298 *-*-cygwin* | *-*-mingw*)
e490616e
ZW
299 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
300 AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
b1c45ae4
CF
301 ;;
302esac
303
3affd5f0
JL
304if test -z "${setobjs}"; then
305 case "${host}" in
306
307 *-*-vxworks*)
308 # Handle VxWorks configuration specially, since on VxWorks the
309 # libraries are actually on the target board, not in the file
310 # system.
311 LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
312 LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
313 for f in $funcs; do
314 case "$f" in
315 basename | getpagesize | insque | random | strcasecmp)
316 ;;
317 strncasecmp | strdup | vfork | waitpid | vasprintf)
318 ;;
319 *)
320 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
321 AC_DEFINE_UNQUOTED($n)
322 ;;
323 esac
324 done
325
326 # VxWorks doesn't provide any of the variables in $vars, so we
327 # don't have to check them here.
328
329 # Of the functions in $checkfuncs, VxWorks only has strerror.
d1209685 330 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
3affd5f0
JL
331
332 setobjs=yes
333 ;;
334
335 esac
336fi
337
338if test -z "${setobjs}"; then
339
340 case "${host}" in
341
dd8f3ed5
GN
342 *-*-cygwin*)
343 # The Cygwin library actually uses a couple of files from
3affd5f0 344 # libiberty when it is built. If we are building a native
dd8f3ed5 345 # Cygwin, and we run the tests, we will appear to have these
3affd5f0
JL
346 # files. However, when we go on to build winsup, we will wind up
347 # with a library which does not have the files, since they should
348 # have come from libiberty.
349
350 # We handle this by removing the functions the winsup library
351 # provides from our shell variables, so that they appear to be
352 # missing.
353
2f31ed7e
DD
354 # DJ - only if we're *building* cygwin, not just building *with* cygwin
355
356 if test -n "${with_target_subdir}"
357 then
358 funcs="`echo $funcs | sed -e 's/random//'`"
359 LIBOBJS="$LIBOBJS random.o"
360 vars="`echo $vars | sed -e 's/sys_siglist//'`"
361 checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
362 fi
3affd5f0
JL
363 ;;
364
365 *-*-mingw32*)
366 # Under mingw32, sys_nerr and sys_errlist exist, but they are
367 # macros, so the test below won't find them.
d1209685
ZW
368 libiberty_cv_var_sys_nerr=yes
369 libiberty_cv_var_sys_errlist=yes
3affd5f0
JL
370 ;;
371
89f602a7
MK
372 *-*-uwin*)
373 # Under some versions of uwin, vfork is notoriously buggy and the test
374 # can hang configure; on other versions, vfork exists just as a stub.
375 # FIXME: This should be removed once vfork in uwin's runtime is fixed.
376 ac_cv_func_vfork_works=no
62133b5e
MK
377 # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
378 # macros (actually, these are imported from a DLL, but the end effect
379 # is the same), so the test below won't find them.
d1209685
ZW
380 libiberty_cv_var_sys_nerr=yes
381 libiberty_cv_var_sys_errlist=yes
89f602a7
MK
382 ;;
383
ee262b6f
DR
384 *-*-*vms*)
385 # Under VMS, vfork works very different than on Unix. The standard test
386 # won't work, and it isn't easily adaptable. It makes more sense to
387 # just force it.
388 ac_cv_func_vfork_works=yes
389 ;;
390
3affd5f0
JL
391 esac
392
393 # We haven't set the list of objects yet. Use the standard autoconf
394 # tests. This will only work if the compiler works.
395 AC_PROG_CC_WORKS
396 AC_REPLACE_FUNCS($funcs)
b548dffb 397 libiberty_AC_FUNC_C_ALLOCA
3affd5f0
JL
398 AC_FUNC_VFORK
399 if test $ac_cv_func_vfork_works = no; then
400 LIBOBJS="$LIBOBJS vfork.o"
401 fi
e490616e
ZW
402 # We only need _doprnt if we might use it to implement v*printf.
403 if test $ac_cv_func_vprintf != yes \
404 || test $ac_cv_func_vfprintf != yes \
405 || test $ac_cv_func_vsprintf != yes; then
406 AC_REPLACE_FUNCS(_doprnt)
9ce3f7e5
DD
407 else
408 AC_CHECK_FUNCS(_doprnt)
e490616e
ZW
409 fi
410
3affd5f0
JL
411 for v in $vars; do
412 AC_MSG_CHECKING([for $v])
413 AC_CACHE_VAL(libiberty_cv_var_$v,
9f3dbd92 414 [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;],
3affd5f0
JL
415 [eval "libiberty_cv_var_$v=yes"],
416 [eval "libiberty_cv_var_$v=no"])])
417 if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
418 AC_MSG_RESULT(yes)
419 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
420 AC_DEFINE_UNQUOTED($n)
6599da04 421 else
3affd5f0 422 AC_MSG_RESULT(no)
6599da04 423 fi
3affd5f0
JL
424 done
425 AC_CHECK_FUNCS($checkfuncs)
426fi
427
a9266bfa
KG
428libiberty_AC_FUNC_STRNCMP
429
3affd5f0
JL
430# Install a library built with a cross compiler in $(tooldir) rather
431# than $(libdir).
ca6b370d 432if test -z "${with_cross_host}"; then
3affd5f0
JL
433 INSTALL_DEST=libdir
434else
435 INSTALL_DEST=tooldir
6599da04 436fi
3affd5f0
JL
437AC_SUBST(INSTALL_DEST)
438
439# We need multilib support, but only if configuring for the target.
7c72138a 440AC_OUTPUT(Makefile testsuite/Makefile,
3affd5f0
JL
441[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
442if test -n "$CONFIG_FILES"; then
cd862df8 443 if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then
3affd5f0
JL
444 # FIXME: We shouldn't need to set ac_file
445 ac_file=Makefile
6706f116 446 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
3affd5f0
JL
447 . ${libiberty_topdir}/config-ml.in
448 fi
449fi],
450srcdir=${srcdir}
451host=${host}
452target=${target}
453with_target_subdir=${with_target_subdir}
cd862df8 454with_build_subdir=${with_build_subdir}
3affd5f0
JL
455with_multisubdir=${with_multisubdir}
456ac_configure_args="--enable-multilib ${ac_configure_args}"
457CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
458libiberty_topdir=${libiberty_topdir}
459)