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