source: trunk/third/gcc/libiberty/configure.in @ 18474

Revision 18474, 12.0 KB checked in by ghudson, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18473, which included commits to RCS files with non-trunk default branches.
Line 
1dnl Process this file with autoconf to produce a configure script
2
3AC_PREREQ(2.13)
4AC_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...
10ORIGINAL_LD_FOR_MULTILIBS=$LD
11
12dnl We use these options to decide which functions to include.
13AC_ARG_WITH(target-subdir,
14[  --with-target-subdir=SUBDIR      Configuring in a subdirectory])
15AC_ARG_WITH(cross-host,
16[  --with-cross-host=HOST           Configuring with a cross compiler])
17AC_ARG_WITH(newlib,
18[  --with-newlib                    Configuring with newlib])
19
20if 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
30else
31  libiberty_topdir="${srcdir}/.."
32fi
33AC_CONFIG_AUX_DIR($libiberty_topdir)
34
35dnl Very limited version of automake's enable-maintainer-mode
36
37AC_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)
45
46AC_MSG_RESULT($maintainer_mode)
47
48if test "$maintainer_mode" = "yes"; then
49  MAINT=''
50  NOTMAINT='#'
51else
52  MAINT='#'
53  NOTMAINT=''
54fi
55AC_SUBST(MAINT)dnl
56AC_SUBST(NOTMAINT)dnl
57
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.
60AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
61if test "x$MAKEINFO" = "x"; then
62    MAKEINFO="@echo makeinfo missing; true"
63    BUILD_INFO=
64else
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
74fi
75AC_SUBST(MAKEINFO)
76AC_SUBST(BUILD_INFO)
77
78AC_CHECK_PROG(PERL, perl, perl, )
79if test x"$PERL" = x""; then
80  HAVE_PERL='#'
81else
82  HAVE_PERL=''
83fi
84AC_SUBST(HAVE_PERL)
85
86AC_CANONICAL_HOST
87
88dnl When we start using automake:
89dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
90
91dnl These must be called before AM_PROG_LIBTOOL, because it may want
92dnl to call AC_CHECK_PROG.
93AC_CHECK_TOOL(AR, ar)
94AC_CHECK_TOOL(RANLIB, ranlib, :)
95
96LIB_AC_PROG_CC
97
98AC_ISC_POSIX
99AC_C_CONST
100AC_C_INLINE
101
102dnl When we start using libtool:
103dnl Default to a non shared library.  This may be overridden by the
104dnl configure option --enable-shared.
105dnl AM_DISABLE_SHARED
106
107dnl When we start using libtool:
108dnl AM_PROG_LIBTOOL
109
110dnl When we start using automake:
111dnl AM_CONFIG_HEADER(config.h:config.in)
112AC_CONFIG_HEADER(config.h:config.in)
113
114dnl When we start using automake:
115dnl AM_MAINTAINER_MODE
116dnl AC_EXEEXT
117
118dnl When we start using automake:
119dnl AM_PROG_INSTALL
120AC_PROG_INSTALL
121
122. ${srcdir}/config.table
123host_makefile_frag=${frag}
124AC_SUBST_FILE(host_makefile_frag)
125
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.
129AC_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)
130AC_HEADER_SYS_WAIT
131AC_HEADER_TIME
132
133libiberty_AC_DECLARE_ERRNO
134
135AC_CHECK_TYPE(uintptr_t, unsigned long)
136
137if test $ac_cv_type_uintptr_t = yes
138then
139  AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
140fi
141
142# This is the list of functions which libiberty will provide if they
143# are not available on the host.
144
145funcs="asprintf"
146funcs="$funcs atexit"
147funcs="$funcs basename"
148funcs="$funcs bcmp"
149funcs="$funcs bcopy"
150funcs="$funcs bsearch"
151funcs="$funcs bzero"
152funcs="$funcs calloc"
153funcs="$funcs clock"
154funcs="$funcs ffs"
155funcs="$funcs getcwd"
156funcs="$funcs getpagesize"
157funcs="$funcs index"
158funcs="$funcs insque"
159funcs="$funcs memchr"
160funcs="$funcs memcmp"
161funcs="$funcs memcpy"
162funcs="$funcs memmove"
163funcs="$funcs memset"
164funcs="$funcs mkstemps"
165funcs="$funcs putenv"
166funcs="$funcs random"
167funcs="$funcs rename"
168funcs="$funcs rindex"
169funcs="$funcs setenv"
170funcs="$funcs sigsetmask"
171funcs="$funcs strcasecmp"
172funcs="$funcs strchr"
173funcs="$funcs strdup"
174funcs="$funcs strncasecmp"
175funcs="$funcs strrchr"
176funcs="$funcs strstr"
177funcs="$funcs strtod"
178funcs="$funcs strtol"
179funcs="$funcs strtoul"
180funcs="$funcs tmpnam"
181funcs="$funcs vasprintf"
182funcs="$funcs vfprintf"
183funcs="$funcs vprintf"
184funcs="$funcs vsprintf"
185funcs="$funcs waitpid"
186
187# Also in the old function.def file: alloca, vfork, getopt.
188
189vars="sys_errlist sys_nerr sys_siglist"
190
191checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
192
193# These are neither executed nor required, but they help keep
194# autoheader happy without adding a bunch of text to acconfig.h.
195if 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.])
206fi
207
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.
211
212setobjs=
213CHECK=
214if 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
248else
249
250   # Not a target library, so we set things up to run the test suite.
251   CHECK=check-cplus-dem
252
253fi
254
255AC_SUBST(CHECK)
256
257case "${host}" in
258  *-*-cygwin* | *-*-mingw*)
259    AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
260    AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
261    ;;
262esac
263
264if test -z "${setobjs}"; then
265  case "${host}" in
266
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
285
286    # VxWorks doesn't provide any of the variables in $vars, so we
287    # don't have to check them here.
288
289    # Of the functions in $checkfuncs, VxWorks only has strerror.
290    AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR)
291
292    setobjs=yes
293    ;;
294
295  esac
296fi
297
298if test -z "${setobjs}"; then
299
300  case "${host}" in
301
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.
309
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.
313
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    ;;
324
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    ;;
331
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    ;;
343
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    ;;
350
351  esac
352
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
370
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)
386fi
387
388libiberty_AC_FUNC_STRNCMP
389
390# Install a library built with a cross compiler in $(tooldir) rather
391# than $(libdir).
392if test -z "${with_cross_host}"; then
393  INSTALL_DEST=libdir
394else
395  INSTALL_DEST=tooldir
396fi
397AC_SUBST(INSTALL_DEST)
398
399# We need multilib support, but only if configuring for the target.
400AC_OUTPUT(Makefile testsuite/Makefile,
401[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
402if 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
409fi],
410srcdir=${srcdir}
411host=${host}
412target=${target}
413with_target_subdir=${with_target_subdir}
414with_multisubdir=${with_multisubdir}
415ac_configure_args="--enable-multilib ${ac_configure_args}"
416CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
417libiberty_topdir=${libiberty_topdir}
418)
Note: See TracBrowser for help on using the repository browser.