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