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