]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/configure.in
ANSI does not allow a prototype to specify an item smaller than an int if the functio...
[thirdparty/gcc.git] / libiberty / configure.in
CommitLineData
3affd5f0 1dnl Process this file with autoconf to produce a configure script
6599da04 2
3affd5f0
JL
3AC_PREREQ(2.5)
4AC_INIT(pexecute.c)
6599da04 5
3affd5f0
JL
6dnl We use these options to decide which functions to include.
7AC_ARG_WITH(target-subdir,
8[ --with-target-subdir=SUBDIR Configuring with a cross compiler])
9AC_ARG_WITH(newlib,
10[ --with-newlib Configuring with newlib])
6599da04 11
3affd5f0
JL
12if test "${srcdir}" = "."; then
13 if test -z "${with_target_subdir}"; then
14 libiberty_topdir="${srcdir}/.."
15 else
16 if test "${with_target_subdir}" != "."; then
17 libiberty_topdir="${srcdir}/${with_multisrctop}../.."
18 else
19 libiberty_topdir="${srcdir}/${with_multisrctop}.."
20 fi
21 fi
22else
23 libiberty_topdir="${srcdir}/.."
24fi
25AC_CONFIG_AUX_DIR($libiberty_topdir)
26
27AC_CANONICAL_HOST
28
29dnl When we start using automake:
30dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
31
32dnl These must be called before AM_PROG_LIBTOOL, because it may want
33dnl to call AC_CHECK_PROG.
34AC_CHECK_TOOL(AR, ar)
35AC_CHECK_TOOL(RANLIB, ranlib, :)
36
37# FIXME: We temporarily define our own version of AC_PROG_CC. This is
38# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
39# are probably using a cross compiler, which will not be able to fully
40# link an executable. This should really be fixed in autoconf
41# itself.
42
43AC_DEFUN(LIB_AC_PROG_CC,
44[AC_BEFORE([$0], [AC_PROG_CPP])dnl
45AC_PROVIDE([AC_PROG_CC])
46AC_CHECK_PROG(CC, gcc, gcc)
47if test -z "$CC"; then
48 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
49 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
50fi
51
52AC_PROG_CC_GNU
53
54if test $ac_cv_prog_gcc = yes; then
55 GCC=yes
56dnl Check whether -g works, even if CFLAGS is set, in case the package
57dnl plays around with CFLAGS (such as to build both debugging and
58dnl normal versions of a library), tasteless as that idea is.
59 ac_test_CFLAGS="${CFLAGS+set}"
60 ac_save_CFLAGS="$CFLAGS"
61 CFLAGS=
62 AC_PROG_CC_G
63 if test "$ac_test_CFLAGS" = set; then
64 CFLAGS="$ac_save_CFLAGS"
65 elif test $ac_cv_prog_cc_g = yes; then
66 CFLAGS="-g -O2"
67 else
68 CFLAGS="-O2"
69 fi
70else
71 GCC=
72 test "${CFLAGS+set}" = set || CFLAGS="-g"
73fi
74])
75
76LIB_AC_PROG_CC
77
78AC_ISC_POSIX
79
80dnl When we start using libtool:
81dnl Default to a non shared library. This may be overridden by the
82dnl configure option --enable-shared.
83dnl AM_DISABLE_SHARED
84
85dnl When we start using libtool:
86dnl AM_PROG_LIBTOOL
87
88dnl When we start using automake:
89dnl AM_CONFIG_HEADER(config.h:config.in)
90AC_CONFIG_HEADER(config.h:config.in)
91
92dnl When we start using automake:
93dnl AM_MAINTAINER_MODE
94dnl AM_EXEEXT
95
96dnl When we start using automake:
97dnl AM_PROG_INSTALL
98AC_PROG_INSTALL
6599da04
JM
99
100. ${srcdir}/config.table
101host_makefile_frag=${frag}
3affd5f0
JL
102AC_SUBST_FILE(host_makefile_frag)
103
104# It's OK to check for header files. Although the compiler may not be
105# able to link anything, it had better be able to at least compile
106# something.
107AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h)
6599da04 108
3affd5f0
JL
109# This is the list of functions which libiberty will provide if they
110# are not available on the host.
111
112funcs="asprintf"
113funcs="$funcs atexit"
114funcs="$funcs basename"
115funcs="$funcs bcmp"
116funcs="$funcs bcopy"
117funcs="$funcs bzero"
118funcs="$funcs clock"
119funcs="$funcs getcwd"
120funcs="$funcs getpagesize"
121funcs="$funcs index"
122funcs="$funcs insque"
123funcs="$funcs memchr"
124funcs="$funcs memcmp"
125funcs="$funcs memcpy"
126funcs="$funcs memmove"
127funcs="$funcs memset"
128funcs="$funcs random"
129funcs="$funcs rename"
130funcs="$funcs rindex"
131funcs="$funcs sigsetmask"
132funcs="$funcs strcasecmp"
133funcs="$funcs strchr"
134funcs="$funcs strdup"
135funcs="$funcs strncasecmp"
136funcs="$funcs strrchr"
137funcs="$funcs strstr"
138funcs="$funcs strtod"
139funcs="$funcs strtol"
140funcs="$funcs strtoul"
141funcs="$funcs tmpnam"
142funcs="$funcs vasprintf"
143funcs="$funcs vfprintf"
144funcs="$funcs vprintf"
145funcs="$funcs vsprintf"
146funcs="$funcs waitpid"
147
148# Also in the old function.def file: alloca, vfork, getopt.
149
150vars="sys_errlist sys_nerr sys_siglist"
151
152checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times"
153
154# These are neither executed nor required, but they help keep
155# autoheader happy without adding a bunch of text to acconfig.h.
156if test "x" = "y"; then
157 AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bzero clock getcwd)
158 AC_CHECK_FUNCS(getpagesize index insque memchr memcmp memcpy memmove)
159 AC_CHECK_FUNCS(memset random rename rindex sigsetmask strcasecmp)
160 AC_CHECK_FUNCS(strchr strdup strncasecmp strrchr strstr strtod strtol)
161 AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid)
162 AC_DEFINE(HAVE_SYS_ERRLIST)
163 AC_DEFINE(HAVE_SYS_NERR)
164 AC_DEFINE(HAVE_SYS_SIGLIST)
165 AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times)
6599da04
JM
166fi
167
3affd5f0
JL
168# For each of these functions, if the host does not provide the
169# function we want to put FN.o in LIBOBJS, and if the host does
170# provide the function, we want to define HAVE_FN in config.h. Also,
171# if the host does not provide alloca, we set ALLOCA to alloca.o
172
173setobjs=
174if test -n "${with_target_subdir}"; then
175
176 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
177 # may not work correctly, because the compiler may not be able to
178 # link executables.
179
180 # If we are being configured for newlib, we know which functions
181 # newlib provide and which ones we will be expected to provide.
182
183 if test "x${with_newlib}" = "xyes"; then
184 ALLOCA="alloca.o"
185 LIBOBJS="basename.o insque.o random.o strdup.o vasprintf.o"
186
187 for f in $funcs; do
188 case "$f" in
189 basename | insque | random | strdup | vasprintf)
190 ;;
191 *)
192 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
193 AC_DEFINE_UNQUOTED($n)
194 ;;
195 esac
196 done
197
198 # newlib doesnt provide any of the variables in $vars, so we
199 # dont have to check them here.
200
201 # Of the functions in $checkfuncs, VxWorks only has strerror.
202 AC_DEFINE(HAVE_STRERROR)
203
204 setobjs=yes
205
206 fi
207fi
208
209if test -z "${setobjs}"; then
210 case "${host}" in
211
212 *-*-vxworks*)
213 # Handle VxWorks configuration specially, since on VxWorks the
214 # libraries are actually on the target board, not in the file
215 # system.
216 LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
217 LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
218 for f in $funcs; do
219 case "$f" in
220 basename | getpagesize | insque | random | strcasecmp)
221 ;;
222 strncasecmp | strdup | vfork | waitpid | vasprintf)
223 ;;
224 *)
225 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
226 AC_DEFINE_UNQUOTED($n)
227 ;;
228 esac
229 done
230
231 # VxWorks doesn't provide any of the variables in $vars, so we
232 # don't have to check them here.
233
234 # Of the functions in $checkfuncs, VxWorks only has strerror.
235 AC_DEFINE(HAVE_STRERROR)
236
237 setobjs=yes
238 ;;
239
240 esac
241fi
242
243if test -z "${setobjs}"; then
244
245 case "${host}" in
246
247 *-*-cygwin32*)
248 # The cygwin32 library actually uses a couple of files from
249 # libiberty when it is built. If we are building a native
250 # cygwin32, and we run the tests, we will appear to have these
251 # files. However, when we go on to build winsup, we will wind up
252 # with a library which does not have the files, since they should
253 # have come from libiberty.
254
255 # We handle this by removing the functions the winsup library
256 # provides from our shell variables, so that they appear to be
257 # missing.
258
259 funcs="`echo $funcs | sed -e 's/random//'`"
260 LIBOBJS="$LIBOBJS random.o"
261 vars="`echo $vars | sed -e 's/sys_siglist//'`"
262 checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//`"
263 ;;
264
265 *-*-mingw32*)
266 # Under mingw32, sys_nerr and sys_errlist exist, but they are
267 # macros, so the test below won't find them.
268 vars="`echo $vars | sed -e 's/sys_nerr//' -e 's/sys_errlist//'`"
269 AC_DEFINE(HAVE_SYS_NERR)
270 AC_DEFINE(HAVE_SYS_ERRLIST)
271 ;;
272
273 esac
274
275 # We haven't set the list of objects yet. Use the standard autoconf
276 # tests. This will only work if the compiler works.
277 AC_PROG_CC_WORKS
278 AC_REPLACE_FUNCS($funcs)
279 AC_FUNC_ALLOCA
280 AC_FUNC_VFORK
281 if test $ac_cv_func_vfork_works = no; then
282 LIBOBJS="$LIBOBJS vfork.o"
283 fi
284 for v in $vars; do
285 AC_MSG_CHECKING([for $v])
286 AC_CACHE_VAL(libiberty_cv_var_$v,
287 [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
288 [eval "libiberty_cv_var_$v=yes"],
289 [eval "libiberty_cv_var_$v=no"])])
290 if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
291 AC_MSG_RESULT(yes)
292 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
293 AC_DEFINE_UNQUOTED($n)
6599da04 294 else
3affd5f0 295 AC_MSG_RESULT(no)
6599da04 296 fi
3affd5f0
JL
297 done
298 AC_CHECK_FUNCS($checkfuncs)
299fi
300
301# Install a library built with a cross compiler in $(tooldir) rather
302# than $(libdir).
303if test -z "${with_target_subdir}"; then
304 INSTALL_DEST=libdir
305else
306 INSTALL_DEST=tooldir
6599da04 307fi
3affd5f0
JL
308AC_SUBST(INSTALL_DEST)
309
310# We need multilib support, but only if configuring for the target.
311AC_OUTPUT(Makefile,
312[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
313if test -n "$CONFIG_FILES"; then
314 if test -n "${with_target_subdir}"; then
315 # FIXME: We shouldn't need to set ac_file
316 ac_file=Makefile
317 . ${libiberty_topdir}/config-ml.in
318 fi
319fi],
320srcdir=${srcdir}
321host=${host}
322target=${target}
323with_target_subdir=${with_target_subdir}
324with_multisubdir=${with_multisubdir}
325ac_configure_args="--enable-multilib ${ac_configure_args}"
326CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
327libiberty_topdir=${libiberty_topdir}
328)