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