comparison libiberty/configure.ac @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
126 if test $cross_compiling = no && test $multilib = yes \ 126 if test $cross_compiling = no && test $multilib = yes \
127 && test "x${with_multisubdir}" != x ; then 127 && test "x${with_multisubdir}" != x ; then
128 cross_compiling=maybe 128 cross_compiling=maybe
129 fi 129 fi
130 130
131 # We may wish to install the target headers somewhere.
132 AC_MSG_CHECKING([whether to install libiberty headers and static library])
133 dnl install-libiberty is disabled by default
134
135 AC_ARG_ENABLE(install-libiberty,
136 [ --enable-install-libiberty Install headers and library for end users],
137 enable_install_libiberty=$enableval,
138 enable_install_libiberty=no)dnl
139
140 # Option parsed, now set things appropriately.
141 case x"$enable_install_libiberty" in
142 xyes|x)
143 target_header_dir=libiberty
144 ;;
145 xno)
146 target_header_dir=
147 ;;
148 *)
149 # This could be sanity-checked in various ways...
150 target_header_dir="${enable_install_libiberty}"
151 ;;
152 esac
153 AC_MSG_RESULT($enable_install_libiberty)
154 AC_MSG_NOTICE([target_header_dir = $target_header_dir])
155
131 GCC_NO_EXECUTABLES 156 GCC_NO_EXECUTABLES
132 AC_PROG_CC 157 AC_PROG_CC
158 AC_GNU_SOURCE
133 AC_SYS_LARGEFILE 159 AC_SYS_LARGEFILE
134 AC_PROG_CPP_WERROR 160 AC_PROG_CPP_WERROR
135 161
136 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wc++-compat \ 162 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wc++-compat \
137 -Wstrict-prototypes], [ac_libiberty_warn_cflags]) 163 -Wstrict-prototypes \
164 -Wshadow=local], [ac_libiberty_warn_cflags])
138 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([], [ac_libiberty_warn_cflags]) 165 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([], [ac_libiberty_warn_cflags])
139 166
140 AC_PROG_CC_C_O 167 AC_PROG_CC_C_O
141 # autoconf is lame and doesn't give us any substitution variable for this. 168 # autoconf is lame and doesn't give us any substitution variable for this.
142 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then 169 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
189 216
190 if [[ -n "${frag}" ]]; then 217 if [[ -n "${frag}" ]]; then
191 frag=${libiberty_topdir}/libiberty/config/$frag 218 frag=${libiberty_topdir}/libiberty/config/$frag
192 fi 219 fi
193 220
221 GCC_PICFLAG
222
194 # If they didn't specify --enable-shared, don't generate shared libs. 223 # If they didn't specify --enable-shared, don't generate shared libs.
195 case "${enable_shared}" in 224 case "${enable_shared}" in
196 yes) shared=yes ;; 225 yes) shared=yes ;;
197 no) shared=no ;; 226 no) shared=no ;;
198 "") shared=no ;; 227 "") shared=no ;;
199 *) shared=yes ;; 228 *) shared=yes ;;
200 esac 229 esac
201 if [[ "${shared}" = "yes" ]]; then 230
202 case "${host}" in 231 # ...unless --enable-host-shared was passed from top-level config:
203 *-*-cygwin*) ;; 232 if [[ "${enable_host_shared}" = "yes" ]]; then
204 alpha*-*-linux*) PICFLAG=-fPIC ;; 233 shared=yes
205 arm*-*-*) PICFLAG=-fPIC ;; 234 fi
206 hppa*-*-*) PICFLAG=-fPIC ;; 235
207 i370-*-*) PICFLAG=-fPIC ;; 236 if [[ "${shared}" != "yes" ]]; then
208 ia64-*-*) PICFLAG=-fpic ;; 237 PICFLAG=
209 i[[34567]]86-*-* | x86_64-*-*)
210 PICFLAG=-fpic ;;
211 m68k-*-*) PICFLAG=-fpic ;;
212 mips*-*-linux*) PICFLAG=-fPIC ;;
213 powerpc*-*-aix*) ;;
214 powerpc*-*-*) PICFLAG=-fPIC ;;
215 sparc*-*-*) case "${CFLAGS}" in
216 *-fpic* ) PICFLAG=-fpic ;;
217 * ) PICFLAG=-fPIC ;;
218 esac ;;
219 s390*-*-*) PICFLAG=-fpic ;;
220 sh*-*-*) PICFLAG=-fPIC ;;
221 esac
222 fi 238 fi
223 AC_SUBST(PICFLAG) 239 AC_SUBST(PICFLAG)
240
241 NOASANFLAG=
242 case " ${CFLAGS} " in
243 *\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;;
244 esac
245 AC_SUBST(NOASANFLAG)
224 246
225 echo "# Warning: this fragment is automatically generated" > temp-frag 247 echo "# Warning: this fragment is automatically generated" > temp-frag
226 248
227 if [[ -n "${frag}" ]] && [[ -f "${frag}" ]]; then 249 if [[ -n "${frag}" ]] && [[ -f "${frag}" ]]; then
228 echo "Appending ${frag} to xhost-mkfrag" 250 echo "Appending ${frag} to xhost-mkfrag"
250 AC_HEADER_SYS_WAIT 272 AC_HEADER_SYS_WAIT
251 AC_HEADER_TIME 273 AC_HEADER_TIME
252 274
253 libiberty_AC_DECLARE_ERRNO 275 libiberty_AC_DECLARE_ERRNO
254 276
255 # Determine the size of an int for struct fibnode. 277 # Determine sizes of some types.
256 AC_CHECK_SIZEOF([int]) 278 AC_CHECK_SIZEOF([int])
279 AC_CHECK_SIZEOF([long])
280 AC_CHECK_SIZEOF([size_t])
281
282 # Check for presense of long long
283 AC_CHECK_TYPE([long long],
284 [AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have the `long long' type.]) AC_CHECK_SIZEOF([long long])],
285 [])
257 286
258 # Look for a 64-bit type. 287 # Look for a 64-bit type.
259 AC_MSG_CHECKING([for a 64-bit type]) 288 AC_MSG_CHECKING([for a 64-bit type])
260 AC_CACHE_VAL(liberty_cv_uint64, 289 AC_CACHE_VAL(liberty_cv_uint64,
261 [AC_TRY_COMPILE( 290 [AC_TRY_COMPILE(
337 funcs="$funcs strcasecmp" 366 funcs="$funcs strcasecmp"
338 funcs="$funcs strchr" 367 funcs="$funcs strchr"
339 funcs="$funcs strdup" 368 funcs="$funcs strdup"
340 funcs="$funcs strncasecmp" 369 funcs="$funcs strncasecmp"
341 funcs="$funcs strndup" 370 funcs="$funcs strndup"
371 funcs="$funcs strnlen"
342 funcs="$funcs strrchr" 372 funcs="$funcs strrchr"
343 funcs="$funcs strstr" 373 funcs="$funcs strstr"
344 funcs="$funcs strtod" 374 funcs="$funcs strtod"
345 funcs="$funcs strtol" 375 funcs="$funcs strtol"
346 funcs="$funcs strtoul" 376 funcs="$funcs strtoul"
377 funcs="$funcs strtoll"
378 funcs="$funcs strtoull"
347 funcs="$funcs strverscmp" 379 funcs="$funcs strverscmp"
348 funcs="$funcs tmpnam" 380 funcs="$funcs tmpnam"
349 funcs="$funcs vasprintf" 381 funcs="$funcs vasprintf"
350 funcs="$funcs vfprintf" 382 funcs="$funcs vfprintf"
351 funcs="$funcs vprintf" 383 funcs="$funcs vprintf"
356 388
357 # Also in the old function.def file: alloca, vfork, getopt. 389 # Also in the old function.def file: alloca, vfork, getopt.
358 390
359 vars="sys_errlist sys_nerr sys_siglist" 391 vars="sys_errlist sys_nerr sys_siglist"
360 392
361 checkfuncs="__fsetlocking canonicalize_file_name dup3 getrusage getsysinfo \ 393 checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \
362 gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic realpath \ 394 getsysinfo gettimeofday on_exit psignal pstat_getdynamic pstat_getstatic \
363 sbrk spawnve spawnvpe strerror strsignal sysconf sysctl sysmp table \ 395 realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \
364 times wait3 wait4" 396 sysmp table times wait3 wait4"
365 397
366 # These are neither executed nor required, but they help keep 398 # These are neither executed nor required, but they help keep
367 # autoheader happy without adding a bunch of text to acconfig.h. 399 # autoheader happy without adding a bunch of text to acconfig.h.
368 if test "x" = "y"; then 400 if test "x" = "y"; then
369 AC_CHECK_FUNCS(asprintf atexit \ 401 AC_CHECK_FUNCS(asprintf atexit \
370 basename bcmp bcopy bsearch bzero \ 402 basename bcmp bcopy bsearch bzero \
371 calloc canonicalize_file_name clock \ 403 calloc canonicalize_file_name clock \
372 dup3 \ 404 dup3 \
373 ffs __fsetlocking \ 405 ffs __fsetlocking \
374 getcwd getpagesize getrusage getsysinfo gettimeofday \ 406 getcwd getpagesize getrlimit getrusage getsysinfo gettimeofday \
375 index insque \ 407 index insque \
376 memchr memcmp memcpy memmem memmove memset mkstemps \ 408 memchr memcmp memcpy memmem memmove memset mkstemps \
377 on_exit \ 409 on_exit \
378 psignal pstat_getdynamic pstat_getstatic putenv \ 410 psignal pstat_getdynamic pstat_getstatic putenv \
379 random realpath rename rindex \ 411 random realpath rename rindex \
380 sbrk setenv setproctitle sigsetmask snprintf spawnve spawnvpe \ 412 sbrk setenv setproctitle setrlimit sigsetmask snprintf spawnve spawnvpe \
381 stpcpy stpncpy strcasecmp strchr strdup \ 413 stpcpy stpncpy strcasecmp strchr strdup \
382 strerror strncasecmp strndup strrchr strsignal strstr strtod strtol \ 414 strerror strncasecmp strndup strnlen strrchr strsignal strstr strtod \
383 strtoul strverscmp sysconf sysctl sysmp \ 415 strtol strtoul strtoll strtoull strverscmp sysconf sysctl sysmp \
384 table times tmpnam \ 416 table times tmpnam \
385 vasprintf vfprintf vprintf vsprintf \ 417 vasprintf vfprintf vprintf vsprintf \
386 wait3 wait4 waitpid) 418 wait3 wait4 waitpid)
387 AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf]) 419 AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf, strtol, strtoul, strtoll, strtoull, strnlen])
388 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) 420 AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
389 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) 421 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.])
390 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) 422 AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
391 fi 423 fi
392 424
394 # function we want to put FN.o in LIBOBJS, and if the host does 426 # function we want to put FN.o in LIBOBJS, and if the host does
395 # provide the function, we want to define HAVE_FN in config.h. 427 # provide the function, we want to define HAVE_FN in config.h.
396 428
397 setobjs= 429 setobjs=
398 CHECK= 430 CHECK=
399 target_header_dir=
400 if test -n "${with_target_subdir}"; then 431 if test -n "${with_target_subdir}"; then
401 432
402 # We are being configured as a target library. AC_REPLACE_FUNCS 433 # We are being configured as a target library. AC_REPLACE_FUNCS
403 # may not work correctly, because the compiler may not be able to 434 # may not work correctly, because the compiler may not be able to
404 # link executables. Note that we may still be being configured 435 # link executables. Note that we may still be being configured
457 AC_LIBOBJ([rindex]) 488 AC_LIBOBJ([rindex])
458 AC_LIBOBJ([sigsetmask]) 489 AC_LIBOBJ([sigsetmask])
459 AC_LIBOBJ([stpcpy]) 490 AC_LIBOBJ([stpcpy])
460 AC_LIBOBJ([stpncpy]) 491 AC_LIBOBJ([stpncpy])
461 AC_LIBOBJ([strndup]) 492 AC_LIBOBJ([strndup])
493 AC_LIBOBJ([strnlen])
462 AC_LIBOBJ([strverscmp]) 494 AC_LIBOBJ([strverscmp])
463 AC_LIBOBJ([vasprintf]) 495 AC_LIBOBJ([vasprintf])
464 AC_LIBOBJ([waitpid]) 496 AC_LIBOBJ([waitpid])
465 497
466 for f in $funcs; do 498 for f in $funcs; do
467 case "$f" in 499 case "$f" in
468 asprintf | basename | bcmp | bcopy | bzero | clock | ffs | getpagesize | index | insque | mempcpy | mkstemps | random | rindex | sigsetmask | stpcpy | stpncpy | strdup | strndup | strverscmp | vasprintf | waitpid) 500 asprintf | basename | bcmp | bcopy | bzero | clock | ffs | getpagesize | index | insque | mempcpy | mkstemps | random | rindex | sigsetmask | stpcpy | stpncpy | strdup | strndup | strnlen | strverscmp | vasprintf | waitpid)
469 ;; 501 ;;
470 *) 502 *)
471 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 503 n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
472 AC_DEFINE_UNQUOTED($n) 504 AC_DEFINE_UNQUOTED($n)
473 ;; 505 ;;
504 536
505 setobjs=yes 537 setobjs=yes
506 ;; 538 ;;
507 539
508 esac 540 esac
509
510 # We may wish to install the target headers somewhere.
511 AC_ARG_ENABLE(install-libiberty,
512 [ --enable-install-libiberty Install headers for end users],
513 enable_install_libiberty=$enableval,
514 enable_install_libiberty=no)dnl
515
516 # Option parsed, now set things appropriately.
517 case x"$enable_install_libiberty" in
518 xyes|x)
519 target_header_dir=libiberty
520 ;;
521 xno)
522 target_header_dir=
523 ;;
524 *)
525 # This could be sanity-checked in various ways...
526 target_header_dir="${enable_install_libiberty}"
527 ;;
528 esac
529
530 541
531 else 542 else
532 543
533 # Not a target library, so we set things up to run the test suite. 544 # Not a target library, so we set things up to run the test suite.
534 CHECK=really-check 545 CHECK=really-check
589 600
590 if test -z "${setobjs}"; then 601 if test -z "${setobjs}"; then
591 602
592 case "${host}" in 603 case "${host}" in
593 604
605 *-*-android*)
606 # On android, getpagesize is defined in unistd.h as a static inline
607 # function, which AC_CHECK_FUNCS does not handle properly.
608 ac_cv_func_getpagesize=yes
609 ;;
610
594 *-*-mingw32*) 611 *-*-mingw32*)
595 # Under mingw32, sys_nerr and sys_errlist exist, but they are 612 # Under mingw32, sys_nerr and sys_errlist exist, but they are
596 # macros, so the test below won't find them. 613 # macros, so the test below won't find them.
597 libiberty_cv_var_sys_nerr=yes 614 libiberty_cv_var_sys_nerr=yes
598 libiberty_cv_var_sys_errlist=yes 615 libiberty_cv_var_sys_errlist=yes
668 [AC_MSG_RESULT([no])]) 685 [AC_MSG_RESULT([no])])
669 686
670 AC_CHECK_FUNCS($checkfuncs) 687 AC_CHECK_FUNCS($checkfuncs)
671 AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf]) 688 AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
672 AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk]) 689 AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk])
690 AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
673 AC_CHECK_DECLS([strverscmp]) 691 AC_CHECK_DECLS([strverscmp])
692 AC_CHECK_DECLS([strnlen])
674 libiberty_NEED_DECLARATION(canonicalize_file_name) 693 libiberty_NEED_DECLARATION(canonicalize_file_name)
675 fi 694 fi
676 695
677 # Figure out which version of pexecute to use. 696 # Figure out which version of pexecute to use.
678 case "${host}" in 697 case "${host}" in