source: trunk/src/gcc/libiberty/configure.in@ 1036

Last change on this file since 1036 was 2, checked in by bird, 22 years ago

Initial revision

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