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 | # 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
|
---|
11 |
|
---|
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])
|
---|
19 |
|
---|
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}/.."
|
---|
32 | fi
|
---|
33 | AC_SUBST(libiberty_topdir)
|
---|
34 | AC_CONFIG_AUX_DIR($libiberty_topdir)
|
---|
35 |
|
---|
36 | dnl Very limited version of automake's enable-maintainer-mode
|
---|
37 |
|
---|
38 | AC_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 |
|
---|
47 | AC_MSG_RESULT($maintainer_mode)
|
---|
48 |
|
---|
49 | if test "$maintainer_mode" = "yes"; then
|
---|
50 | MAINT=''
|
---|
51 | NOTMAINT='#'
|
---|
52 | else
|
---|
53 | MAINT='#'
|
---|
54 | NOTMAINT=''
|
---|
55 | fi
|
---|
56 | AC_SUBST(MAINT)dnl
|
---|
57 | AC_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.
|
---|
61 | AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
|
---|
62 | if test "x$MAKEINFO" = "x"; then
|
---|
63 | MAKEINFO="@echo makeinfo missing; true"
|
---|
64 | BUILD_INFO=
|
---|
65 | else
|
---|
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
|
---|
75 | fi
|
---|
76 | AC_SUBST(MAKEINFO)
|
---|
77 | AC_SUBST(BUILD_INFO)
|
---|
78 |
|
---|
79 | AC_CHECK_PROG(PERL, perl, perl, )
|
---|
80 | if test x"$PERL" = x""; then
|
---|
81 | HAVE_PERL='#'
|
---|
82 | else
|
---|
83 | HAVE_PERL=''
|
---|
84 | fi
|
---|
85 | AC_SUBST(HAVE_PERL)
|
---|
86 |
|
---|
87 | AC_CANONICAL_HOST
|
---|
88 |
|
---|
89 | dnl When we start using automake:
|
---|
90 | dnl AM_INIT_AUTOMAKE(libiberty, 1.0)
|
---|
91 |
|
---|
92 | dnl These must be called before AM_PROG_LIBTOOL, because it may want
|
---|
93 | dnl to call AC_CHECK_PROG.
|
---|
94 | AC_CHECK_TOOL(AR, ar)
|
---|
95 | AC_CHECK_TOOL(RANLIB, ranlib, :)
|
---|
96 |
|
---|
97 | LIB_AC_PROG_CC
|
---|
98 |
|
---|
99 | AC_ISC_POSIX
|
---|
100 | AC_C_CONST
|
---|
101 | AC_C_INLINE
|
---|
102 |
|
---|
103 | dnl When we start using libtool:
|
---|
104 | dnl Default to a non shared library. This may be overridden by the
|
---|
105 | dnl configure option --enable-shared.
|
---|
106 | dnl AM_DISABLE_SHARED
|
---|
107 |
|
---|
108 | dnl When we start using libtool:
|
---|
109 | dnl AM_PROG_LIBTOOL
|
---|
110 |
|
---|
111 | dnl When we start using automake:
|
---|
112 | dnl AM_CONFIG_HEADER(config.h:config.in)
|
---|
113 | AC_CONFIG_HEADER(config.h:config.in)
|
---|
114 |
|
---|
115 | dnl When we start using automake:
|
---|
116 | dnl AM_MAINTAINER_MODE
|
---|
117 | dnl AC_EXEEXT
|
---|
118 |
|
---|
119 | dnl When we start using automake:
|
---|
120 | dnl AM_PROG_INSTALL
|
---|
121 | AC_PROG_INSTALL
|
---|
122 |
|
---|
123 | . ${srcdir}/config.table
|
---|
124 | host_makefile_frag=${frag}
|
---|
125 | AC_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.
|
---|
130 | 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)
|
---|
131 | AC_HEADER_SYS_WAIT
|
---|
132 | AC_HEADER_TIME
|
---|
133 |
|
---|
134 | libiberty_AC_DECLARE_ERRNO
|
---|
135 |
|
---|
136 | AC_CHECK_TYPE(uintptr_t, unsigned long)
|
---|
137 |
|
---|
138 | if test $ac_cv_type_uintptr_t = yes
|
---|
139 | then
|
---|
140 | AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.])
|
---|
141 | fi
|
---|
142 |
|
---|
143 | # This is the list of functions which libiberty will provide if they
|
---|
144 | # are not available on the host.
|
---|
145 |
|
---|
146 | funcs="asprintf"
|
---|
147 | funcs="$funcs atexit"
|
---|
148 | funcs="$funcs basename"
|
---|
149 | funcs="$funcs bcmp"
|
---|
150 | funcs="$funcs bcopy"
|
---|
151 | funcs="$funcs bsearch"
|
---|
152 | funcs="$funcs bzero"
|
---|
153 | funcs="$funcs calloc"
|
---|
154 | funcs="$funcs clock"
|
---|
155 | funcs="$funcs ffs"
|
---|
156 | funcs="$funcs getcwd"
|
---|
157 | funcs="$funcs getpagesize"
|
---|
158 | funcs="$funcs index"
|
---|
159 | funcs="$funcs insque"
|
---|
160 | funcs="$funcs memchr"
|
---|
161 | funcs="$funcs memcmp"
|
---|
162 | funcs="$funcs memcpy"
|
---|
163 | funcs="$funcs memmove"
|
---|
164 | funcs="$funcs memset"
|
---|
165 | funcs="$funcs mkstemps"
|
---|
166 | funcs="$funcs putenv"
|
---|
167 | funcs="$funcs random"
|
---|
168 | funcs="$funcs rename"
|
---|
169 | funcs="$funcs rindex"
|
---|
170 | funcs="$funcs setenv"
|
---|
171 | funcs="$funcs sigsetmask"
|
---|
172 | funcs="$funcs strcasecmp"
|
---|
173 | funcs="$funcs strchr"
|
---|
174 | funcs="$funcs strdup"
|
---|
175 | funcs="$funcs strncasecmp"
|
---|
176 | funcs="$funcs strrchr"
|
---|
177 | funcs="$funcs strstr"
|
---|
178 | funcs="$funcs strtod"
|
---|
179 | funcs="$funcs strtol"
|
---|
180 | funcs="$funcs strtoul"
|
---|
181 | funcs="$funcs tmpnam"
|
---|
182 | funcs="$funcs vasprintf"
|
---|
183 | funcs="$funcs vfprintf"
|
---|
184 | funcs="$funcs vprintf"
|
---|
185 | funcs="$funcs vsprintf"
|
---|
186 | funcs="$funcs waitpid"
|
---|
187 |
|
---|
188 | # Also in the old function.def file: alloca, vfork, getopt.
|
---|
189 |
|
---|
190 | vars="sys_errlist sys_nerr sys_siglist"
|
---|
191 |
|
---|
192 | checkfuncs="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.
|
---|
196 | if 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.])
|
---|
207 | fi
|
---|
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 |
|
---|
213 | setobjs=
|
---|
214 | CHECK=
|
---|
215 | if 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 |
|
---|
249 | else
|
---|
250 |
|
---|
251 | # Not a target library, so we set things up to run the test suite.
|
---|
252 | CHECK=check-cplus-dem
|
---|
253 |
|
---|
254 | fi
|
---|
255 |
|
---|
256 | AC_SUBST(CHECK)
|
---|
257 |
|
---|
258 | case "${host}" in
|
---|
259 | *-*-cygwin* | *-*-mingw*)
|
---|
260 | AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST)
|
---|
261 | AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR)
|
---|
262 | ;;
|
---|
263 | esac
|
---|
264 |
|
---|
265 | if 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
|
---|
297 | fi
|
---|
298 |
|
---|
299 | if 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)
|
---|
387 | fi
|
---|
388 |
|
---|
389 | libiberty_AC_FUNC_STRNCMP
|
---|
390 |
|
---|
391 | # Install a library built with a cross compiler in $(tooldir) rather
|
---|
392 | # than $(libdir).
|
---|
393 | if test -z "${with_cross_host}"; then
|
---|
394 | INSTALL_DEST=libdir
|
---|
395 | else
|
---|
396 | INSTALL_DEST=tooldir
|
---|
397 | fi
|
---|
398 | AC_SUBST(INSTALL_DEST)
|
---|
399 |
|
---|
400 | # We need multilib support, but only if configuring for the target.
|
---|
401 | AC_OUTPUT(Makefile testsuite/Makefile,
|
---|
402 | [test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
|
---|
403 | if 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
|
---|
410 | fi],
|
---|
411 | srcdir=${srcdir}
|
---|
412 | host=${host}
|
---|
413 | target=${target}
|
---|
414 | with_target_subdir=${with_target_subdir}
|
---|
415 | with_multisubdir=${with_multisubdir}
|
---|
416 | ac_configure_args="--enable-multilib ${ac_configure_args}"
|
---|
417 | CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
---|
418 | libiberty_topdir=${libiberty_topdir}
|
---|
419 | )
|
---|