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