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