]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/configure.in
cpphash.h (struct _cpp_buff, [...]): New.
[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
29AC_CANONICAL_HOST
30
31dnl When we start using automake:
32dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
33
34dnl These must be called before AM_PROG_LIBTOOL, because it may want
35dnl to call AC_CHECK_PROG.
36AC_CHECK_TOOL(AR, ar)
37AC_CHECK_TOOL(RANLIB, ranlib, :)
38
3affd5f0
JL
39LIB_AC_PROG_CC
40
41AC_ISC_POSIX
d1209685
ZW
42AC_C_CONST
43AC_C_INLINE
3affd5f0
JL
44
45dnl When we start using libtool:
46dnl Default to a non shared library. This may be overridden by the
47dnl configure option --enable-shared.
48dnl AM_DISABLE_SHARED
49
50dnl When we start using libtool:
51dnl AM_PROG_LIBTOOL
52
53dnl When we start using automake:
54dnl AM_CONFIG_HEADER(config.h:config.in)
55AC_CONFIG_HEADER(config.h:config.in)
56
57dnl When we start using automake:
58dnl AM_MAINTAINER_MODE
dd8f3ed5 59dnl AC_EXEEXT
3affd5f0
JL
60
61dnl When we start using automake:
62dnl AM_PROG_INSTALL
63AC_PROG_INSTALL
6599da04
JM
64
65. ${srcdir}/config.table
66host_makefile_frag=${frag}
3affd5f0
JL
67AC_SUBST_FILE(host_makefile_frag)
68
69# It's OK to check for header files. Although the compiler may not be
70# able to link anything, it had better be able to at least compile
71# something.
c6451ce1 72AC_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)
a6458d1d 73AC_HEADER_SYS_WAIT
c6451ce1 74AC_HEADER_TIME
6599da04 75
3b58c099
MS
76libiberty_AC_DECLARE_ERRNO
77
3affd5f0
JL
78# This is the list of functions which libiberty will provide if they
79# are not available on the host.
80
81funcs="asprintf"
82funcs="$funcs atexit"
83funcs="$funcs basename"
84funcs="$funcs bcmp"
85funcs="$funcs bcopy"
dac45916 86funcs="$funcs bsearch"
3affd5f0 87funcs="$funcs bzero"
a9acf741 88funcs="$funcs calloc"
3affd5f0 89funcs="$funcs clock"
29650b2b 90funcs="$funcs ffs"
3affd5f0
JL
91funcs="$funcs getcwd"
92funcs="$funcs getpagesize"
93funcs="$funcs index"
94funcs="$funcs insque"
95funcs="$funcs memchr"
96funcs="$funcs memcmp"
97funcs="$funcs memcpy"
98funcs="$funcs memmove"
99funcs="$funcs memset"
687361c8 100funcs="$funcs mkstemps"
9eb4080f 101funcs="$funcs putenv"
3affd5f0
JL
102funcs="$funcs random"
103funcs="$funcs rename"
104funcs="$funcs rindex"
9eb4080f 105funcs="$funcs setenv"
3affd5f0
JL
106funcs="$funcs sigsetmask"
107funcs="$funcs strcasecmp"
108funcs="$funcs strchr"
109funcs="$funcs strdup"
110funcs="$funcs strncasecmp"
111funcs="$funcs strrchr"
112funcs="$funcs strstr"
113funcs="$funcs strtod"
114funcs="$funcs strtol"
115funcs="$funcs strtoul"
116funcs="$funcs tmpnam"
117funcs="$funcs vasprintf"
118funcs="$funcs vfprintf"
119funcs="$funcs vprintf"
120funcs="$funcs vsprintf"
121funcs="$funcs waitpid"
122
123# Also in the old function.def file: alloca, vfork, getopt.
124
125vars="sys_errlist sys_nerr sys_siglist"
126
90e72e20 127checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
3affd5f0
JL
128
129# These are neither executed nor required, but they help keep
130# autoheader happy without adding a bunch of text to acconfig.h.
131if test "x" = "y"; then
dac45916
MS
132 AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock)
133 AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy)
134 AC_CHECK_FUNCS(memmove memset putenv random rename rindex sigsetmask)
135 AC_CHECK_FUNCS(strcasecmp setenv strchr strdup strncasecmp strrchr strstr)
136 AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf)
137 AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal)
29650b2b 138 AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs)
d1209685
ZW
139 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
140 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
141 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
6599da04
JM
142fi
143
3affd5f0
JL
144# For each of these functions, if the host does not provide the
145# function we want to put FN.o in LIBOBJS, and if the host does
b548dffb 146# provide the function, we want to define HAVE_FN in config.h.
3affd5f0
JL
147
148setobjs=
7c72138a 149CHECK=
3affd5f0
JL
150if test -n "${with_target_subdir}"; then
151
ca6b370d 152 # We are being configured as a target library. AC_REPLACE_FUNCS
3affd5f0 153 # may not work correctly, because the compiler may not be able to
ca6b370d
JL
154 # link executables. Note that we may still be being configured
155 # native.
3affd5f0
JL
156
157 # If we are being configured for newlib, we know which functions
158 # newlib provide and which ones we will be expected to provide.
159
160 if test "x${with_newlib}" = "xyes"; then
ca6b370d 161 LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
3affd5f0
JL
162
163 for f in $funcs; do
164 case "$f" in
ca6b370d 165 asprintf | basename | insque | random | strdup | vasprintf)
3affd5f0
JL
166 ;;
167 *)
168 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
169 AC_DEFINE_UNQUOTED($n)
170 ;;
171 esac
172 done
173
174 # newlib doesnt provide any of the variables in $vars, so we
175 # dont have to check them here.
176
ca6b370d 177 # Of the functions in $checkfuncs, newlib only has strerror.
d1209685 178 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
3affd5f0
JL
179
180 setobjs=yes
181
182 fi
7c72138a
TT
183
184else
185
186 # Not a target library, so we set things up to run the test suite.
187 CHECK=check-cplus-dem
188
3affd5f0
JL
189fi
190
7c72138a
TT
191AC_SUBST(CHECK)
192
b1c45ae4
CF
193case "${host}" in
194 *-*-cygwin*)
195 AC_DEFINE(HAVE_SYS_ERRLIST)
196 AC_DEFINE(HAVE_SYS_NERR)
197 ;;
198esac
199
3affd5f0
JL
200if test -z "${setobjs}"; then
201 case "${host}" in
202
203 *-*-vxworks*)
204 # Handle VxWorks configuration specially, since on VxWorks the
205 # libraries are actually on the target board, not in the file
206 # system.
207 LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
208 LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
209 for f in $funcs; do
210 case "$f" in
211 basename | getpagesize | insque | random | strcasecmp)
212 ;;
213 strncasecmp | strdup | vfork | waitpid | vasprintf)
214 ;;
215 *)
216 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
217 AC_DEFINE_UNQUOTED($n)
218 ;;
219 esac
220 done
221
222 # VxWorks doesn't provide any of the variables in $vars, so we
223 # don't have to check them here.
224
225 # Of the functions in $checkfuncs, VxWorks only has strerror.
d1209685 226 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
3affd5f0
JL
227
228 setobjs=yes
229 ;;
230
231 esac
232fi
233
234if test -z "${setobjs}"; then
235
236 case "${host}" in
237
dd8f3ed5
GN
238 *-*-cygwin*)
239 # The Cygwin library actually uses a couple of files from
3affd5f0 240 # libiberty when it is built. If we are building a native
dd8f3ed5 241 # Cygwin, and we run the tests, we will appear to have these
3affd5f0
JL
242 # files. However, when we go on to build winsup, we will wind up
243 # with a library which does not have the files, since they should
244 # have come from libiberty.
245
246 # We handle this by removing the functions the winsup library
247 # provides from our shell variables, so that they appear to be
248 # missing.
249
2f31ed7e
DD
250 # DJ - only if we're *building* cygwin, not just building *with* cygwin
251
252 if test -n "${with_target_subdir}"
253 then
254 funcs="`echo $funcs | sed -e 's/random//'`"
255 LIBOBJS="$LIBOBJS random.o"
256 vars="`echo $vars | sed -e 's/sys_siglist//'`"
257 checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
258 fi
3affd5f0
JL
259 ;;
260
261 *-*-mingw32*)
262 # Under mingw32, sys_nerr and sys_errlist exist, but they are
263 # macros, so the test below won't find them.
d1209685
ZW
264 libiberty_cv_var_sys_nerr=yes
265 libiberty_cv_var_sys_errlist=yes
3affd5f0
JL
266 ;;
267
89f602a7
MK
268 *-*-uwin*)
269 # Under some versions of uwin, vfork is notoriously buggy and the test
270 # can hang configure; on other versions, vfork exists just as a stub.
271 # FIXME: This should be removed once vfork in uwin's runtime is fixed.
272 ac_cv_func_vfork_works=no
62133b5e
MK
273 # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
274 # macros (actually, these are imported from a DLL, but the end effect
275 # is the same), so the test below won't find them.
d1209685
ZW
276 libiberty_cv_var_sys_nerr=yes
277 libiberty_cv_var_sys_errlist=yes
89f602a7
MK
278 ;;
279
3affd5f0
JL
280 esac
281
282 # We haven't set the list of objects yet. Use the standard autoconf
283 # tests. This will only work if the compiler works.
284 AC_PROG_CC_WORKS
285 AC_REPLACE_FUNCS($funcs)
b548dffb 286 libiberty_AC_FUNC_C_ALLOCA
3affd5f0
JL
287 AC_FUNC_VFORK
288 if test $ac_cv_func_vfork_works = no; then
289 LIBOBJS="$LIBOBJS vfork.o"
290 fi
291 for v in $vars; do
292 AC_MSG_CHECKING([for $v])
293 AC_CACHE_VAL(libiberty_cv_var_$v,
294 [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
295 [eval "libiberty_cv_var_$v=yes"],
296 [eval "libiberty_cv_var_$v=no"])])
297 if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
298 AC_MSG_RESULT(yes)
299 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
300 AC_DEFINE_UNQUOTED($n)
6599da04 301 else
3affd5f0 302 AC_MSG_RESULT(no)
6599da04 303 fi
3affd5f0
JL
304 done
305 AC_CHECK_FUNCS($checkfuncs)
306fi
307
a9266bfa
KG
308libiberty_AC_FUNC_STRNCMP
309
3affd5f0
JL
310# Install a library built with a cross compiler in $(tooldir) rather
311# than $(libdir).
ca6b370d 312if test -z "${with_cross_host}"; then
3affd5f0
JL
313 INSTALL_DEST=libdir
314else
315 INSTALL_DEST=tooldir
6599da04 316fi
3affd5f0
JL
317AC_SUBST(INSTALL_DEST)
318
319# We need multilib support, but only if configuring for the target.
7c72138a 320AC_OUTPUT(Makefile testsuite/Makefile,
3affd5f0
JL
321[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
322if test -n "$CONFIG_FILES"; then
323 if test -n "${with_target_subdir}"; then
324 # FIXME: We shouldn't need to set ac_file
325 ac_file=Makefile
326 . ${libiberty_topdir}/config-ml.in
327 fi
328fi],
329srcdir=${srcdir}
330host=${host}
331target=${target}
332with_target_subdir=${with_target_subdir}
333with_multisubdir=${with_multisubdir}
334ac_configure_args="--enable-multilib ${ac_configure_args}"
335CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
336libiberty_topdir=${libiberty_topdir}
337)