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