summaryrefslogtreecommitdiffstats
path: root/c++tools
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-12-17 05:57:13 -0800
committerNathan Sidwell <nathan@acm.org>2020-12-17 05:57:13 -0800
commit096164229a4c2d1efab9f259f50be1bdcdfc8abd (patch)
tree0b12ffe2253c9c39b900696978b1b86f09927d32 /c++tools
parentlibcody: Remove nop asm (diff)
downloadgcc-096164229a4c2d1efab9f259f50be1bdcdfc8abd.tar.gz
gcc-096164229a4c2d1efab9f259f50be1bdcdfc8abd.tar.bz2
gcc-096164229a4c2d1efab9f259f50be1bdcdfc8abd.tar.xz
bootstrap: Fix some windows issues [PR 98300]
When breaking out the sample server from the gcc/cp directory, it lost its check for mmap, and the sample resolver just assumed it was there. Fixed thusly. The non-mapping paths in module.cc weren't (recently) excercised, and led to a signedness warning. Finally I'd missed c++tools's config.h.in in the gcc_update script. There I took the opportunity of adding a 'tools' segment of the dependency lists. PR bootstrap/98300 contrib/ * gcc_update: Add c++tools/config.h.in. c++tools/ * configure.ac: Check for sys/mman.h. * resolver.cc: Don't assume mmap, O_CLOEXEC are available. Use xmalloc. * config.h.in: Regenerated. * configure: Regenerated. gcc/cp/ * module.cc: Fix ::read, ::write result signedness comparisons.
Diffstat (limited to 'c++tools')
-rw-r--r--c++tools/config.h.in33
-rwxr-xr-xc++tools/configure653
-rw-r--r--c++tools/configure.ac2
-rw-r--r--c++tools/resolver.cc41
4 files changed, 726 insertions, 3 deletions
diff --git a/c++tools/config.h.in b/c++tools/config.h.in
index 747aaf40b12..bfb49582357 100644
--- a/c++tools/config.h.in
+++ b/c++tools/config.h.in
@@ -15,12 +15,42 @@
15/* Define if inet_ntop provided. */ 15/* Define if inet_ntop provided. */
16#undef HAVE_INET_NTOP 16#undef HAVE_INET_NTOP
17 17
18/* Define to 1 if you have the <inttypes.h> header file. */
19#undef HAVE_INTTYPES_H
20
21/* Define to 1 if you have the <memory.h> header file. */
22#undef HAVE_MEMORY_H
23
18/* Define if pselect provided. */ 24/* Define if pselect provided. */
19#undef HAVE_PSELECT 25#undef HAVE_PSELECT
20 26
21/* Define if select provided. */ 27/* Define if select provided. */
22#undef HAVE_SELECT 28#undef HAVE_SELECT
23 29
30/* Define to 1 if you have the <stdint.h> header file. */
31#undef HAVE_STDINT_H
32
33/* Define to 1 if you have the <stdlib.h> header file. */
34#undef HAVE_STDLIB_H
35
36/* Define to 1 if you have the <strings.h> header file. */
37#undef HAVE_STRINGS_H
38
39/* Define to 1 if you have the <string.h> header file. */
40#undef HAVE_STRING_H
41
42/* Define to 1 if you have the <sys/mman.h> header file. */
43#undef HAVE_SYS_MMAN_H
44
45/* Define to 1 if you have the <sys/stat.h> header file. */
46#undef HAVE_SYS_STAT_H
47
48/* Define to 1 if you have the <sys/types.h> header file. */
49#undef HAVE_SYS_TYPES_H
50
51/* Define to 1 if you have the <unistd.h> header file. */
52#undef HAVE_UNISTD_H
53
24/* Define if O_CLOEXEC supported by fcntl. */ 54/* Define if O_CLOEXEC supported by fcntl. */
25#undef HOST_HAS_O_CLOEXEC 55#undef HOST_HAS_O_CLOEXEC
26 56
@@ -41,3 +71,6 @@
41 71
42/* Define to the version of this package. */ 72/* Define to the version of this package. */
43#undef PACKAGE_VERSION 73#undef PACKAGE_VERSION
74
75/* Define to 1 if you have the ANSI C header files. */
76#undef STDC_HEADERS
diff --git a/c++tools/configure b/c++tools/configure
index ec0cef9200a..e32558e936a 100755
--- a/c++tools/configure
+++ b/c++tools/configure
@@ -195,7 +195,8 @@ test -x / || exit 1"
195 as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO 195 as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
196 as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO 196 as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
197 eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && 197 eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
198 test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" 198 test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
199test \$(( 1 + 1 )) = 2 || exit 1"
199 if (eval "$as_required") 2>/dev/null; then : 200 if (eval "$as_required") 2>/dev/null; then :
200 as_have_required=yes 201 as_have_required=yes
201else 202else
@@ -583,9 +584,48 @@ PACKAGE_URL=
583 584
584ac_unique_file="c++tools" 585ac_unique_file="c++tools"
585ac_unique_file="server.cc" 586ac_unique_file="server.cc"
587# Factoring default headers for most tests.
588ac_includes_default="\
589#include <stdio.h>
590#ifdef HAVE_SYS_TYPES_H
591# include <sys/types.h>
592#endif
593#ifdef HAVE_SYS_STAT_H
594# include <sys/stat.h>
595#endif
596#ifdef STDC_HEADERS
597# include <stdlib.h>
598# include <stddef.h>
599#else
600# ifdef HAVE_STDLIB_H
601# include <stdlib.h>
602# endif
603#endif
604#ifdef HAVE_STRING_H
605# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
606# include <memory.h>
607# endif
608# include <string.h>
609#endif
610#ifdef HAVE_STRINGS_H
611# include <strings.h>
612#endif
613#ifdef HAVE_INTTYPES_H
614# include <inttypes.h>
615#endif
616#ifdef HAVE_STDINT_H
617# include <stdint.h>
618#endif
619#ifdef HAVE_UNISTD_H
620# include <unistd.h>
621#endif"
622
586ac_subst_vars='LTLIBOBJS 623ac_subst_vars='LTLIBOBJS
587LIBOBJS 624LIBOBJS
588get_gcc_base_ver 625get_gcc_base_ver
626EGREP
627GREP
628CPP
589ac_ct_CC 629ac_ct_CC
590CFLAGS 630CFLAGS
591CC 631CC
@@ -671,7 +711,8 @@ LIBS
671CPPFLAGS 711CPPFLAGS
672CCC 712CCC
673CC 713CC
674CFLAGS' 714CFLAGS
715CPP'
675 716
676 717
677# Initialize some variables set by options. 718# Initialize some variables set by options.
@@ -1305,6 +1346,7 @@ Some influential environment variables:
1305 you have headers in a nonstandard directory <include dir> 1346 you have headers in a nonstandard directory <include dir>
1306 CC C compiler command 1347 CC C compiler command
1307 CFLAGS C compiler flags 1348 CFLAGS C compiler flags
1349 CPP C preprocessor
1308 1350
1309Use these variables to override the choices made by `configure' or to help 1351Use these variables to override the choices made by `configure' or to help
1310it to find libraries and programs with nonstandard names/locations. 1352it to find libraries and programs with nonstandard names/locations.
@@ -1461,6 +1503,203 @@ fi
1461 as_fn_set_status $ac_retval 1503 as_fn_set_status $ac_retval
1462 1504
1463} # ac_fn_c_try_compile 1505} # ac_fn_c_try_compile
1506
1507# ac_fn_c_try_cpp LINENO
1508# ----------------------
1509# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
1510ac_fn_c_try_cpp ()
1511{
1512 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1513 if { { ac_try="$ac_cpp conftest.$ac_ext"
1514case "(($ac_try" in
1515 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1516 *) ac_try_echo=$ac_try;;
1517esac
1518eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1519$as_echo "$ac_try_echo"; } >&5
1520 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
1521 ac_status=$?
1522 if test -s conftest.err; then
1523 grep -v '^ *+' conftest.err >conftest.er1
1524 cat conftest.er1 >&5
1525 mv -f conftest.er1 conftest.err
1526 fi
1527 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1528 test $ac_status = 0; } > conftest.i && {
1529 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
1530 test ! -s conftest.err
1531 }; then :
1532 ac_retval=0
1533else
1534 $as_echo "$as_me: failed program was:" >&5
1535sed 's/^/| /' conftest.$ac_ext >&5
1536
1537 ac_retval=1
1538fi
1539 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1540 as_fn_set_status $ac_retval
1541
1542} # ac_fn_c_try_cpp
1543
1544# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
1545# -------------------------------------------------------
1546# Tests whether HEADER exists, giving a warning if it cannot be compiled using
1547# the include files in INCLUDES and setting the cache variable VAR
1548# accordingly.
1549ac_fn_c_check_header_mongrel ()
1550{
1551 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1552 if eval \${$3+:} false; then :
1553 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1554$as_echo_n "checking for $2... " >&6; }
1555if eval \${$3+:} false; then :
1556 $as_echo_n "(cached) " >&6
1557fi
1558eval ac_res=\$$3
1559 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1560$as_echo "$ac_res" >&6; }
1561else
1562 # Is the header compilable?
1563{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
1564$as_echo_n "checking $2 usability... " >&6; }
1565cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1566/* end confdefs.h. */
1567$4
1568#include <$2>
1569_ACEOF
1570if ac_fn_c_try_compile "$LINENO"; then :
1571 ac_header_compiler=yes
1572else
1573 ac_header_compiler=no
1574fi
1575rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1576{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
1577$as_echo "$ac_header_compiler" >&6; }
1578
1579# Is the header present?
1580{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
1581$as_echo_n "checking $2 presence... " >&6; }
1582cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1583/* end confdefs.h. */
1584#include <$2>
1585_ACEOF
1586if ac_fn_c_try_cpp "$LINENO"; then :
1587 ac_header_preproc=yes
1588else
1589 ac_header_preproc=no
1590fi
1591rm -f conftest.err conftest.i conftest.$ac_ext
1592{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
1593$as_echo "$ac_header_preproc" >&6; }
1594
1595# So? What about this header?
1596case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
1597 yes:no: )
1598 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
1599$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
1600 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
1601$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
1602 ;;
1603 no:yes:* )
1604 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
1605$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
1606 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
1607$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
1608 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
1609$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
1610 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
1611$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
1612 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
1613$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
1614 ;;
1615esac
1616 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1617$as_echo_n "checking for $2... " >&6; }
1618if eval \${$3+:} false; then :
1619 $as_echo_n "(cached) " >&6
1620else
1621 eval "$3=\$ac_header_compiler"
1622fi
1623eval ac_res=\$$3
1624 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1625$as_echo "$ac_res" >&6; }
1626fi
1627 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1628
1629} # ac_fn_c_check_header_mongrel
1630
1631# ac_fn_c_try_run LINENO
1632# ----------------------
1633# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
1634# that executables *can* be run.
1635ac_fn_c_try_run ()
1636{
1637 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1638 if { { ac_try="$ac_link"
1639case "(($ac_try" in
1640 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1641 *) ac_try_echo=$ac_try;;
1642esac
1643eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1644$as_echo "$ac_try_echo"; } >&5
1645 (eval "$ac_link") 2>&5
1646 ac_status=$?
1647 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1648 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
1649 { { case "(($ac_try" in
1650 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1651 *) ac_try_echo=$ac_try;;
1652esac
1653eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1654$as_echo "$ac_try_echo"; } >&5
1655 (eval "$ac_try") 2>&5
1656 ac_status=$?
1657 $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1658 test $ac_status = 0; }; }; then :
1659 ac_retval=0
1660else
1661 $as_echo "$as_me: program exited with status $ac_status" >&5
1662 $as_echo "$as_me: failed program was:" >&5
1663sed 's/^/| /' conftest.$ac_ext >&5
1664
1665 ac_retval=$ac_status
1666fi
1667 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
1668 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1669 as_fn_set_status $ac_retval
1670
1671} # ac_fn_c_try_run
1672
1673# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
1674# -------------------------------------------------------
1675# Tests whether HEADER exists and can be compiled using the include files in
1676# INCLUDES, setting the cache variable VAR accordingly.
1677ac_fn_c_check_header_compile ()
1678{
1679 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1680 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1681$as_echo_n "checking for $2... " >&6; }
1682if eval \${$3+:} false; then :
1683 $as_echo_n "(cached) " >&6
1684else
1685 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1686/* end confdefs.h. */
1687$4
1688#include <$2>
1689_ACEOF
1690if ac_fn_c_try_compile "$LINENO"; then :
1691 eval "$3=yes"
1692else
1693 eval "$3=no"
1694fi
1695rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1696fi
1697eval ac_res=\$$3
1698 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1699$as_echo "$ac_res" >&6; }
1700 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1701
1702} # ac_fn_c_check_header_compile
1464cat >config.log <<_ACEOF 1703cat >config.log <<_ACEOF
1465This file contains any messages produced by compilers while 1704This file contains any messages produced by compilers while
1466running configure, to aid debugging if configure makes a mistake. 1705running configure, to aid debugging if configure makes a mistake.
@@ -3275,6 +3514,416 @@ $as_echo "#define HOST_HAS_O_CLOEXEC 1" >>confdefs.h
3275 3514
3276fi 3515fi
3277 3516
3517ac_ext=c
3518ac_cpp='$CPP $CPPFLAGS'
3519ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3520ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3521ac_compiler_gnu=$ac_cv_c_compiler_gnu
3522{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
3523$as_echo_n "checking how to run the C preprocessor... " >&6; }
3524# On Suns, sometimes $CPP names a directory.
3525if test -n "$CPP" && test -d "$CPP"; then
3526 CPP=
3527fi
3528if test -z "$CPP"; then
3529 if ${ac_cv_prog_CPP+:} false; then :
3530 $as_echo_n "(cached) " >&6
3531else
3532 # Double quotes because CPP needs to be expanded
3533 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
3534 do
3535 ac_preproc_ok=false
3536for ac_c_preproc_warn_flag in '' yes
3537do
3538 # Use a header file that comes with gcc, so configuring glibc
3539 # with a fresh cross-compiler works.
3540 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3541 # <limits.h> exists even on freestanding compilers.
3542 # On the NeXT, cc -E runs the code through the compiler's parser,
3543 # not just through cpp. "Syntax error" is here to catch this case.
3544 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3545/* end confdefs.h. */
3546#ifdef __STDC__
3547# include <limits.h>
3548#else
3549# include <assert.h>
3550#endif
3551 Syntax error
3552_ACEOF
3553if ac_fn_c_try_cpp "$LINENO"; then :
3554
3555else
3556 # Broken: fails on valid input.
3557continue
3558fi
3559rm -f conftest.err conftest.i conftest.$ac_ext
3560
3561 # OK, works on sane cases. Now check whether nonexistent headers
3562 # can be detected and how.
3563 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3564/* end confdefs.h. */
3565#include <ac_nonexistent.h>
3566_ACEOF
3567if ac_fn_c_try_cpp "$LINENO"; then :
3568 # Broken: success on invalid input.
3569continue
3570else
3571 # Passes both tests.
3572ac_preproc_ok=:
3573break
3574fi
3575rm -f conftest.err conftest.i conftest.$ac_ext
3576
3577done
3578# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3579rm -f conftest.i conftest.err conftest.$ac_ext
3580if $ac_preproc_ok; then :
3581 break
3582fi
3583
3584 done
3585 ac_cv_prog_CPP=$CPP
3586
3587fi
3588 CPP=$ac_cv_prog_CPP
3589else
3590 ac_cv_prog_CPP=$CPP
3591fi
3592{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
3593$as_echo "$CPP" >&6; }
3594ac_preproc_ok=false
3595for ac_c_preproc_warn_flag in '' yes
3596do
3597 # Use a header file that comes with gcc, so configuring glibc
3598 # with a fresh cross-compiler works.
3599 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
3600 # <limits.h> exists even on freestanding compilers.
3601 # On the NeXT, cc -E runs the code through the compiler's parser,
3602 # not just through cpp. "Syntax error" is here to catch this case.
3603 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3604/* end confdefs.h. */
3605#ifdef __STDC__
3606# include <limits.h>
3607#else
3608# include <assert.h>
3609#endif
3610 Syntax error
3611_ACEOF
3612if ac_fn_c_try_cpp "$LINENO"; then :
3613
3614else
3615 # Broken: fails on valid input.
3616continue
3617fi
3618rm -f conftest.err conftest.i conftest.$ac_ext
3619
3620 # OK, works on sane cases. Now check whether nonexistent headers
3621 # can be detected and how.
3622 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3623/* end confdefs.h. */
3624#include <ac_nonexistent.h>
3625_ACEOF
3626if ac_fn_c_try_cpp "$LINENO"; then :
3627 # Broken: success on invalid input.
3628continue
3629else
3630 # Passes both tests.
3631ac_preproc_ok=:
3632break
3633fi
3634rm -f conftest.err conftest.i conftest.$ac_ext
3635
3636done
3637# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3638rm -f conftest.i conftest.err conftest.$ac_ext
3639if $ac_preproc_ok; then :
3640
3641else
3642 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3643$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
3644as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
3645See \`config.log' for more details" "$LINENO" 5; }
3646fi
3647
3648ac_ext=c
3649ac_cpp='$CPP $CPPFLAGS'
3650ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3651ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3652ac_compiler_gnu=$ac_cv_c_compiler_gnu
3653
3654
3655{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
3656$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
3657if ${ac_cv_path_GREP+:} false; then :
3658 $as_echo_n "(cached) " >&6
3659else
3660 if test -z "$GREP"; then
3661 ac_path_GREP_found=false
3662 # Loop through the user's path and test for each of PROGNAME-LIST
3663 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3664for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
3665do
3666 IFS=$as_save_IFS
3667 test -z "$as_dir" && as_dir=.
3668 for ac_prog in grep ggrep; do
3669 for ac_exec_ext in '' $ac_executable_extensions; do
3670 ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
3671 as_fn_executable_p "$ac_path_GREP" || continue
3672# Check for GNU ac_path_GREP and select it if it is found.
3673 # Check for GNU $ac_path_GREP
3674case `"$ac_path_GREP" --version 2>&1` in
3675*GNU*)
3676 ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
3677*)
3678 ac_count=0
3679 $as_echo_n 0123456789 >"conftest.in"
3680 while :
3681 do
3682 cat "conftest.in" "conftest.in" >"conftest.tmp"
3683 mv "conftest.tmp" "conftest.in"
3684 cp "conftest.in" "conftest.nl"
3685 $as_echo 'GREP' >> "conftest.nl"
3686 "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
3687 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
3688 as_fn_arith $ac_count + 1 && ac_count=$as_val
3689 if test $ac_count -gt ${ac_path_GREP_max-0}; then
3690 # Best one so far, save it but keep looking for a better one
3691 ac_cv_path_GREP="$ac_path_GREP"
3692 ac_path_GREP_max=$ac_count
3693 fi
3694 # 10*(2^10) chars as input seems more than enough
3695 test $ac_count -gt 10 && break
3696 done
3697 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
3698esac
3699
3700 $ac_path_GREP_found && break 3
3701 done
3702 done
3703 done
3704IFS=$as_save_IFS
3705 if test -z "$ac_cv_path_GREP"; then
3706 as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
3707 fi
3708else
3709 ac_cv_path_GREP=$GREP
3710fi
3711
3712fi
3713{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
3714$as_echo "$ac_cv_path_GREP" >&6; }
3715 GREP="$ac_cv_path_GREP"
3716
3717
3718{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
3719$as_echo_n "checking for egrep... " >&6; }
3720if ${ac_cv_path_EGREP+:} false; then :
3721 $as_echo_n "(cached) " >&6
3722else
3723 if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
3724 then ac_cv_path_EGREP="$GREP -E"
3725 else
3726 if test -z "$EGREP"; then
3727 ac_path_EGREP_found=false
3728 # Loop through the user's path and test for each of PROGNAME-LIST
3729 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3730for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
3731do
3732 IFS=$as_save_IFS
3733 test -z "$as_dir" && as_dir=.
3734 for ac_prog in egrep; do
3735 for ac_exec_ext in '' $ac_executable_extensions; do
3736 ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
3737 as_fn_executable_p "$ac_path_EGREP" || continue
3738# Check for GNU ac_path_EGREP and select it if it is found.
3739 # Check for GNU $ac_path_EGREP
3740case `"$ac_path_EGREP" --version 2>&1` in
3741*GNU*)
3742 ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
3743*)
3744 ac_count=0
3745 $as_echo_n 0123456789 >"conftest.in"
3746 while :
3747 do
3748 cat "conftest.in" "conftest.in" >"conftest.tmp"
3749 mv "conftest.tmp" "conftest.in"
3750 cp "conftest.in" "conftest.nl"
3751 $as_echo 'EGREP' >> "conftest.nl"
3752 "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
3753 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
3754 as_fn_arith $ac_count + 1 && ac_count=$as_val
3755 if test $ac_count -gt ${ac_path_EGREP_max-0}; then
3756 # Best one so far, save it but keep looking for a better one
3757 ac_cv_path_EGREP="$ac_path_EGREP"
3758 ac_path_EGREP_max=$ac_count
3759 fi
3760 # 10*(2^10) chars as input seems more than enough
3761 test $ac_count -gt 10 && break
3762 done
3763 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
3764esac
3765
3766 $ac_path_EGREP_found && break 3
3767 done
3768 done
3769 done
3770IFS=$as_save_IFS
3771 if test -z "$ac_cv_path_EGREP"; then
3772 as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
3773 fi
3774else
3775 ac_cv_path_EGREP=$EGREP
3776fi
3777
3778 fi
3779fi
3780{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
3781$as_echo "$ac_cv_path_EGREP" >&6; }
3782 EGREP="$ac_cv_path_EGREP"
3783
3784
3785{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
3786$as_echo_n "checking for ANSI C header files... " >&6; }
3787if ${ac_cv_header_stdc+:} false; then :
3788 $as_echo_n "(cached) " >&6
3789else
3790 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3791/* end confdefs.h. */
3792#include <stdlib.h>
3793#include <stdarg.h>
3794#include <string.h>
3795#include <float.h>
3796
3797int
3798main ()
3799{
3800
3801 ;
3802 return 0;
3803}
3804_ACEOF
3805if ac_fn_c_try_compile "$LINENO"; then :
3806 ac_cv_header_stdc=yes
3807else
3808 ac_cv_header_stdc=no
3809fi
3810rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3811
3812if test $ac_cv_header_stdc = yes; then
3813 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
3814 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3815/* end confdefs.h. */
3816#include <string.h>
3817
3818_ACEOF
3819if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3820 $EGREP "memchr" >/dev/null 2>&1; then :
3821
3822else
3823 ac_cv_header_stdc=no
3824fi
3825rm -f conftest*
3826
3827fi
3828
3829if test $ac_cv_header_stdc = yes; then
3830 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
3831 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3832/* end confdefs.h. */
3833#include <stdlib.h>
3834
3835_ACEOF
3836if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3837 $EGREP "free" >/dev/null 2>&1; then :
3838
3839else
3840 ac_cv_header_stdc=no
3841fi
3842rm -f conftest*
3843
3844fi
3845
3846if test $ac_cv_header_stdc = yes; then
3847 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
3848 if test "$cross_compiling" = yes; then :
3849 :
3850else
3851 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3852/* end confdefs.h. */
3853#include <ctype.h>
3854#include <stdlib.h>
3855#if ((' ' & 0x0FF) == 0x020)
3856# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
3857# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
3858#else
3859# define ISLOWER(c) \
3860 (('a' <= (c) && (c) <= 'i') \
3861 || ('j' <= (c) && (c) <= 'r') \
3862 || ('s' <= (c) && (c) <= 'z'))
3863# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
3864#endif
3865
3866#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
3867int
3868main ()
3869{
3870 int i;
3871 for (i = 0; i < 256; i++)
3872 if (XOR (islower (i), ISLOWER (i))
3873 || toupper (i) != TOUPPER (i))
3874 return 2;
3875 return 0;
3876}
3877_ACEOF
3878if ac_fn_c_try_run "$LINENO"; then :
3879
3880else
3881 ac_cv_header_stdc=no
3882fi
3883rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
3884 conftest.$ac_objext conftest.beam conftest.$ac_ext
3885fi
3886
3887fi
3888fi
3889{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
3890$as_echo "$ac_cv_header_stdc" >&6; }
3891if test $ac_cv_header_stdc = yes; then
3892
3893$as_echo "#define STDC_HEADERS 1" >>confdefs.h
3894
3895fi
3896
3897# On IRIX 5.3, sys/types and inttypes.h are conflicting.
3898for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
3899 inttypes.h stdint.h unistd.h
3900do :
3901 as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
3902ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
3903"
3904if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
3905 cat >>confdefs.h <<_ACEOF
3906#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
3907_ACEOF
3908
3909fi
3910
3911done
3912
3913
3914for ac_header in sys/mman.h
3915do :
3916 ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default"
3917if test "x$ac_cv_header_sys_mman_h" = xyes; then :
3918 cat >>confdefs.h <<_ACEOF
3919#define HAVE_SYS_MMAN_H 1
3920_ACEOF
3921
3922fi
3923
3924done
3925
3926
3278# C++ Modules would like some networking features to provide the mapping 3927# C++ Modules would like some networking features to provide the mapping
3279# server. You can still use modules without them though. 3928# server. You can still use modules without them though.
3280# The following network-related checks could probably do with some 3929# The following network-related checks could probably do with some
diff --git a/c++tools/configure.ac b/c++tools/configure.ac
index 14c476b1ac7..21b3a0668e6 100644
--- a/c++tools/configure.ac
+++ b/c++tools/configure.ac
@@ -77,6 +77,8 @@ if test $ac_cv_o_cloexec = yes; then
77 [Define if O_CLOEXEC supported by fcntl.]) 77 [Define if O_CLOEXEC supported by fcntl.])
78fi 78fi
79 79
80AC_CHECK_HEADERS(sys/mman.h)
81
80# C++ Modules would like some networking features to provide the mapping 82# C++ Modules would like some networking features to provide the mapping
81# server. You can still use modules without them though. 83# server. You can still use modules without them though.
82# The following network-related checks could probably do with some 84# The following network-related checks could probably do with some
diff --git a/c++tools/resolver.cc b/c++tools/resolver.cc
index 5028d2a4a37..c8d31153574 100644
--- a/c++tools/resolver.cc
+++ b/c++tools/resolver.cc
@@ -28,10 +28,36 @@ along with GCC; see the file COPYING3. If not see
28// OS 28// OS
29#include <fcntl.h> 29#include <fcntl.h>
30#include <unistd.h> 30#include <unistd.h>
31#if 0 // 1 for testing no mmap
32#define MAPPED_READING 0
33#else
34#ifdef IN_GCC
35#if HAVE_MMAP_FILE && _POSIX_MAPPED_FILES > 0
36#define MAPPED_READING 1
37#else
38#define MAPPED_READING 0
39#endif
40#else
41#ifdef HAVE_SYS_MMAN_H
31#include <sys/mman.h> 42#include <sys/mman.h>
43#define MAPPED_READING 1
44#else
45#define MAPPED_READING 0
46#endif
47#endif
48#endif
49
32#include <sys/types.h> 50#include <sys/types.h>
33#include <sys/stat.h> 51#include <sys/stat.h>
34 52
53#if !defined (IN_GCC) && !MAPPED_READING
54#define xmalloc(X) malloc(X)
55#endif
56
57#if !HOST_HAS_O_CLOEXEC
58#define O_CLOEXEC 0
59#endif
60
35#ifndef DIR_SEPARATOR 61#ifndef DIR_SEPARATOR
36#define DIR_SEPARATOR '/' 62#define DIR_SEPARATOR '/'
37#endif 63#endif
@@ -81,11 +107,20 @@ module_resolver::read_tuple_file (int fd, char const *prefix, bool force)
81 if (!stat.st_size) 107 if (!stat.st_size)
82 return 0; 108 return 0;
83 109
110 void *buffer = nullptr;
111#if MAPPED_READING
84 // Just map the file, we're gonna read all of it, so no need for 112 // Just map the file, we're gonna read all of it, so no need for
85 // line buffering 113 // line buffering
86 void *buffer = mmap (nullptr, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); 114 buffer = mmap (nullptr, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
87 if (buffer == MAP_FAILED) 115 if (buffer == MAP_FAILED)
88 return -errno; 116 return -errno;
117#else
118 buffer = xmalloc (stat.st_size);
119 if (!buffer)
120 return -errno;
121 if (read (fd, buffer, stat.st_size) != stat.st_size)
122 return -errno;
123#endif
89 124
90 size_t prefix_len = prefix ? strlen (prefix) : 0; 125 size_t prefix_len = prefix ? strlen (prefix) : 0;
91 unsigned lineno = 0; 126 unsigned lineno = 0;
@@ -144,7 +179,11 @@ module_resolver::read_tuple_file (int fd, char const *prefix, bool force)
144 } 179 }
145 } 180 }
146 181
182#if MAPPED_READING
147 munmap (buffer, stat.st_size); 183 munmap (buffer, stat.st_size);
184#else
185 free (buffer);
186#endif
148 187
149 return 0; 188 return 0;
150} 189}