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