Add EM_X86_64.
[deliverable/binutils-gdb.git] / libiberty / configure.in
CommitLineData
252b5132
RH
1dnl Process this file with autoconf to produce a configure script
2
0c0a36a4 3AC_PREREQ(2.13)
252b5132
RH
4AC_INIT(pexecute.c)
5
6dnl We use these options to decide which functions to include.
7AC_ARG_WITH(target-subdir,
8[ --with-target-subdir=SUBDIR Configuring in a subdirectory])
9AC_ARG_WITH(cross-host,
10[ --with-cross-host=HOST Configuring with a cross compiler])
11AC_ARG_WITH(newlib,
12[ --with-newlib Configuring with newlib])
13
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
252b5132
RH
39LIB_AC_PROG_CC
40
41AC_ISC_POSIX
2ea7befd
DD
42AC_C_CONST
43AC_C_INLINE
252b5132
RH
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
59dnl AC_EXEEXT
60
61dnl When we start using automake:
62dnl AM_PROG_INSTALL
63AC_PROG_INSTALL
64
65. ${srcdir}/config.table
66host_makefile_frag=${frag}
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.
62df2065 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)
252b5132 73AC_HEADER_SYS_WAIT
62df2065 74AC_HEADER_TIME
252b5132 75
7d3ffcaf
JL
76libiberty_AC_DECLARE_ERRNO
77
252b5132
RH
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"
86funcs="$funcs bzero"
87funcs="$funcs calloc"
88funcs="$funcs clock"
89funcs="$funcs getcwd"
90funcs="$funcs getpagesize"
91funcs="$funcs index"
92funcs="$funcs insque"
93funcs="$funcs memchr"
94funcs="$funcs memcmp"
95funcs="$funcs memcpy"
96funcs="$funcs memmove"
97funcs="$funcs memset"
98funcs="$funcs mkstemps"
0c0a36a4 99funcs="$funcs putenv"
252b5132
RH
100funcs="$funcs random"
101funcs="$funcs rename"
102funcs="$funcs rindex"
0c0a36a4 103funcs="$funcs setenv"
252b5132
RH
104funcs="$funcs sigsetmask"
105funcs="$funcs strcasecmp"
106funcs="$funcs strchr"
107funcs="$funcs strdup"
108funcs="$funcs strncasecmp"
109funcs="$funcs strrchr"
110funcs="$funcs strstr"
111funcs="$funcs strtod"
112funcs="$funcs strtol"
113funcs="$funcs strtoul"
114funcs="$funcs tmpnam"
115funcs="$funcs vasprintf"
116funcs="$funcs vfprintf"
117funcs="$funcs vprintf"
118funcs="$funcs vsprintf"
119funcs="$funcs waitpid"
120
121# Also in the old function.def file: alloca, vfork, getopt.
122
123vars="sys_errlist sys_nerr sys_siglist"
124
0c0a36a4 125checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
252b5132
RH
126
127# These are neither executed nor required, but they help keep
128# autoheader happy without adding a bunch of text to acconfig.h.
129if test "x" = "y"; then
130 AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bzero calloc clock getcwd)
131 AC_CHECK_FUNCS(getpagesize index insque mkstemps memchr memcmp memcpy memmove)
0c0a36a4
ILT
132 AC_CHECK_FUNCS(memset putenv random rename rindex sigsetmask strcasecmp)
133 AC_CHECK_FUNCS(setenv strchr strdup strncasecmp strrchr strstr strtod strtol)
252b5132 134 AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid)
252b5132 135 AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times)
0c0a36a4 136 AC_CHECK_FUNCS(sbrk gettimeofday)
2ea7befd
DD
137 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
138 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
139 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
252b5132
RH
140fi
141
142# For each of these functions, if the host does not provide the
143# function we want to put FN.o in LIBOBJS, and if the host does
144# provide the function, we want to define HAVE_FN in config.h. Also,
145# if the host does not provide alloca, we set ALLOCA to alloca.o
146
147setobjs=
0c0a36a4 148CHECK=
252b5132
RH
149if test -n "${with_target_subdir}"; then
150
151 # We are being configured as a target library. AC_REPLACE_FUNCS
152 # may not work correctly, because the compiler may not be able to
153 # link executables. Note that we may still be being configured
154 # native.
155
156 # If we are being configured for newlib, we know which functions
157 # newlib provide and which ones we will be expected to provide.
158
159 if test "x${with_newlib}" = "xyes"; then
160 ALLOCA="alloca.o"
161 LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o"
162
163 for f in $funcs; do
164 case "$f" in
165 asprintf | basename | insque | random | strdup | vasprintf)
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
177 # Of the functions in $checkfuncs, newlib only has strerror.
2ea7befd 178 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
252b5132
RH
179
180 setobjs=yes
181
182 fi
0c0a36a4
ILT
183
184else
185
186 # Not a target library, so we set things up to run the test suite.
187 CHECK=check-cplus-dem
188
252b5132
RH
189fi
190
0c0a36a4
ILT
191AC_SUBST(CHECK)
192
252b5132
RH
193if test -z "${setobjs}"; then
194 case "${host}" in
195
196 *-*-vxworks*)
197 # Handle VxWorks configuration specially, since on VxWorks the
198 # libraries are actually on the target board, not in the file
199 # system.
200 LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o"
201 LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o"
202 for f in $funcs; do
203 case "$f" in
204 basename | getpagesize | insque | random | strcasecmp)
205 ;;
206 strncasecmp | strdup | vfork | waitpid | vasprintf)
207 ;;
208 *)
209 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
210 AC_DEFINE_UNQUOTED($n)
211 ;;
212 esac
213 done
214
215 # VxWorks doesn't provide any of the variables in $vars, so we
216 # don't have to check them here.
217
218 # Of the functions in $checkfuncs, VxWorks only has strerror.
2ea7befd 219 AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
252b5132
RH
220
221 setobjs=yes
222 ;;
223
224 esac
225fi
226
227if test -z "${setobjs}"; then
228
229 case "${host}" in
230
231 *-*-cygwin*)
232 # The Cygwin library actually uses a couple of files from
233 # libiberty when it is built. If we are building a native
234 # Cygwin, and we run the tests, we will appear to have these
235 # files. However, when we go on to build winsup, we will wind up
236 # with a library which does not have the files, since they should
237 # have come from libiberty.
238
239 # We handle this by removing the functions the winsup library
240 # provides from our shell variables, so that they appear to be
241 # missing.
242
64e3a659
DD
243 # DJ - only if we're *building* cygwin, not just building *with* cygwin
244
245 if test -n "${with_target_subdir}"
246 then
247 funcs="`echo $funcs | sed -e 's/random//'`"
248 LIBOBJS="$LIBOBJS random.o"
249 vars="`echo $vars | sed -e 's/sys_siglist//'`"
250 checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`"
251 fi
252b5132
RH
252 ;;
253
254 *-*-mingw32*)
255 # Under mingw32, sys_nerr and sys_errlist exist, but they are
256 # macros, so the test below won't find them.
2ea7befd
DD
257 libiberty_cv_var_sys_nerr=yes
258 libiberty_cv_var_sys_errlist=yes
252b5132
RH
259 ;;
260
261 *-*-uwin*)
262 # Under some versions of uwin, vfork is notoriously buggy and the test
263 # can hang configure; on other versions, vfork exists just as a stub.
264 # FIXME: This should be removed once vfork in uwin's runtime is fixed.
265 ac_cv_func_vfork_works=no
0c0a36a4
ILT
266 # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
267 # macros (actually, these are imported from a DLL, but the end effect
268 # is the same), so the test below won't find them.
2ea7befd
DD
269 libiberty_cv_var_sys_nerr=yes
270 libiberty_cv_var_sys_errlist=yes
252b5132
RH
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)
0c0a36a4
ILT
279
280 case "${host}" in
281 *-*-interix)
282 # On Interix, it wrongly concludes that the MSVC compiler supports alloca.
283 # (MSVC does on Win32, not on Interix.)
284 # This should be temporary.
285
286 ac_cv_header_alloca_h=no
287 ac_cv_func_alloca_works=no
288 ALLOCA=alloca.o
289 cat >> confdefs.h <<\EOF
290#define C_ALLOCA 1
291EOF
292 cat >> confdefs.h <<EOF
293#define STACK_DIRECTION -1
294EOF
295 ;;
296 *)
297 AC_FUNC_ALLOCA
298 ;;
299 esac
300
252b5132
RH
301 AC_FUNC_VFORK
302 if test $ac_cv_func_vfork_works = no; then
303 LIBOBJS="$LIBOBJS vfork.o"
304 fi
305 for v in $vars; do
306 AC_MSG_CHECKING([for $v])
307 AC_CACHE_VAL(libiberty_cv_var_$v,
308 [AC_TRY_LINK([int *p;], [extern int $v; p = &$v;],
309 [eval "libiberty_cv_var_$v=yes"],
310 [eval "libiberty_cv_var_$v=no"])])
311 if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then
312 AC_MSG_RESULT(yes)
313 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
314 AC_DEFINE_UNQUOTED($n)
315 else
316 AC_MSG_RESULT(no)
317 fi
318 done
319 AC_CHECK_FUNCS($checkfuncs)
320fi
321
eb383413
L
322libiberty_AC_FUNC_STRNCMP
323
252b5132
RH
324# Install a library built with a cross compiler in $(tooldir) rather
325# than $(libdir).
326if test -z "${with_cross_host}"; then
327 INSTALL_DEST=libdir
328else
329 INSTALL_DEST=tooldir
330fi
331AC_SUBST(INSTALL_DEST)
332
333# We need multilib support, but only if configuring for the target.
0c0a36a4 334AC_OUTPUT(Makefile testsuite/Makefile,
252b5132
RH
335[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
336if test -n "$CONFIG_FILES"; then
337 if test -n "${with_target_subdir}"; then
338 # FIXME: We shouldn't need to set ac_file
339 ac_file=Makefile
340 . ${libiberty_topdir}/config-ml.in
341 fi
342fi],
343srcdir=${srcdir}
344host=${host}
345target=${target}
346with_target_subdir=${with_target_subdir}
347with_multisubdir=${with_multisubdir}
348ac_configure_args="--enable-multilib ${ac_configure_args}"
349CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
350libiberty_topdir=${libiberty_topdir}
351)
This page took 0.070279 seconds and 4 git commands to generate.