diff options
| author | Glenn Morris | 2012-05-15 23:15:52 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-05-15 23:15:52 -0700 |
| commit | 27cb7be27d1ee87665bd497af42e142e41a00765 (patch) | |
| tree | 8781700b8f1c241040f7240ba3716e00899c40d1 | |
| parent | b05725233bee74ae0bd58aebbcb90302abe2cb00 (diff) | |
| download | emacs-27cb7be27d1ee87665bd497af42e142e41a00765.tar.gz emacs-27cb7be27d1ee87665bd497af42e142e41a00765.zip | |
Try to fix building with gcc >= 4.6 on Darwin.
Eg, hydra builds have been failing for some time because (?) of this.
In gcc < 4.6, unrecognized -no-fo options just cause a warning.
In 4.6 and later, they cause an error.
* configure.in: (CPP): Do not unconditionally set it on Darwin.
Instead, try to test if -no-cpp-precomp is accepted.
(CPP_TEST_OPTIONS, SPECIFIED_CPP): New.
Fixes: debbugs:9755
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | configure.in | 64 |
2 files changed, 63 insertions, 8 deletions
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-05-16 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * configure.in: Try to fix building with gcc >= 4.6 on Darwin. | ||
| 4 | (CPP): Do not unconditionally set it on Darwin. | ||
| 5 | Instead, try to test if -no-cpp-precomp is accepted. | ||
| 6 | (CPP_TEST_OPTIONS, SPECIFIED_CPP): New. (Bug#9755) | ||
| 7 | |||
| 1 | 2012-05-15 Glenn Morris <rgm@gnu.org> | 8 | 2012-05-15 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * Makefile.in (install-arch-dep): Replace use of MV_DIRS. | 10 | * Makefile.in (install-arch-dep): Replace use of MV_DIRS. |
diff --git a/configure.in b/configure.in index 46909d75f9e..5dfcc921e4f 100644 --- a/configure.in +++ b/configure.in | |||
| @@ -492,12 +492,11 @@ case "${canonical}" in | |||
| 492 | * ) unported=yes ;; | 492 | * ) unported=yes ;; |
| 493 | esac | 493 | esac |
| 494 | opsys=darwin | 494 | opsys=darwin |
| 495 | # Define CPP as follows to make autoconf work correctly. | ||
| 496 | CPP="${CC-cc} -E -no-cpp-precomp" | ||
| 497 | # Use fink packages if available. | 495 | # Use fink packages if available. |
| 496 | # FIXME? Is it really our business to decide this for the user? | ||
| 498 | if test -d /sw/include && test -d /sw/lib; then | 497 | if test -d /sw/include && test -d /sw/lib; then |
| 499 | GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib" | 498 | GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib" |
| 500 | CPP="${CPP} ${GCC_TEST_OPTIONS}" | 499 | CPP_TEST_OPTIONS=${GCC_TEST_OPTIONS} |
| 501 | NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS} | 500 | NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS} |
| 502 | fi | 501 | fi |
| 503 | ;; | 502 | ;; |
| @@ -581,9 +580,7 @@ case "${canonical}" in | |||
| 581 | machine=intel386 | 580 | machine=intel386 |
| 582 | case "${canonical}" in | 581 | case "${canonical}" in |
| 583 | *-cygwin ) opsys=cygwin ;; | 582 | *-cygwin ) opsys=cygwin ;; |
| 584 | *-darwin* ) opsys=darwin | 583 | *-darwin* ) opsys=darwin ;; |
| 585 | CPP="${CC-cc} -E -no-cpp-precomp" | ||
| 586 | ;; | ||
| 587 | *-sysv4.2uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;; | 584 | *-sysv4.2uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;; |
| 588 | *-sysv5uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;; | 585 | *-sysv5uw* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;; |
| 589 | *-sysv5OpenUNIX* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;; | 586 | *-sysv5OpenUNIX* ) opsys=unixware; NON_GNU_CPP=/lib/cpp ;; |
| @@ -633,13 +630,18 @@ test -n "$CC" && cc_specified=yes | |||
| 633 | # Save the value of CFLAGS that the user specified. | 630 | # Save the value of CFLAGS that the user specified. |
| 634 | SPECIFIED_CFLAGS="$CFLAGS" | 631 | SPECIFIED_CFLAGS="$CFLAGS" |
| 635 | 632 | ||
| 633 | # Save specified CPP (if any), before AC_PROG_CPP runs. | ||
| 634 | SPECIFIED_CPP="$CPP" | ||
| 635 | |||
| 636 | dnl Sets GCC=yes if using gcc. | 636 | dnl Sets GCC=yes if using gcc. |
| 637 | AC_PROG_CC | 637 | AC_PROG_CC |
| 638 | AM_PROG_CC_C_O | 638 | AM_PROG_CC_C_O |
| 639 | 639 | ||
| 640 | # Initialize gnulib right after verifying that the C compiler works. | 640 | # Initialize gnulib right after verifying that the C compiler works. |
| 641 | # Note: this ends up setting CPP. | ||
| 641 | gl_EARLY | 642 | gl_EARLY |
| 642 | 643 | ||
| 644 | dnl Note: looks like gl_EARLY has already done this (via AC_PROG_CPP). | ||
| 643 | # On Suns, sometimes $CPP names a directory. | 645 | # On Suns, sometimes $CPP names a directory. |
| 644 | if test -n "$CPP" && test -d "$CPP"; then | 646 | if test -n "$CPP" && test -d "$CPP"; then |
| 645 | CPP= | 647 | CPP= |
| @@ -663,6 +665,46 @@ fail; | |||
| 663 | fi | 665 | fi |
| 664 | fi | 666 | fi |
| 665 | 667 | ||
| 668 | ## If using gcc, and on darwin, see if using Apple's gcc, where old | ||
| 669 | ## (pre gcc 3.3?) versions need -no-cpp-precomp to workaround some | ||
| 670 | ## (unrecorded) issue. | ||
| 671 | ## Frankly, I suspect this option is no longer needed on any system | ||
| 672 | ## still in use today. It is at best a no-op since Apple's version | ||
| 673 | ## of gcc 3.3 (?), which corresponds (?) to Xcode 1.5 from 2004. | ||
| 674 | ## This was for OS X 10.3, and the nextstep port (for example) | ||
| 675 | ## only supports 10.4 or later (although you could be building a | ||
| 676 | ## non-ns version on some older OS X I guess). | ||
| 677 | if test x"$opsys" = xdarwin && test x"$GCC" = xyes; then | ||
| 678 | AC_MSG_CHECKING([whether we are using an Apple version of GCC]) | ||
| 679 | AC_CACHE_VAL(emacs_cv_apple_gcc, | ||
| 680 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], | ||
| 681 | [[#ifndef __APPLE_CC__ | ||
| 682 | fail; | ||
| 683 | #endif | ||
| 684 | ]])], emacs_cv_apple_gcc=yes, emacs_cv_apple_gcc=no)]) | ||
| 685 | AC_MSG_RESULT($emacs_cv_apple_gcc) | ||
| 686 | |||
| 687 | ## This only tests that adding the option does not cause an error. | ||
| 688 | ## FIXME It may still cause "unrecognized option" | ||
| 689 | ## (in gcc < 4.6 --no-foo does that; newer versions throw an error). | ||
| 690 | ## The message appears on stderr, so AC_EGREP_CPP is no use. | ||
| 691 | ## It would be better to test if it is actually needed. | ||
| 692 | ## For that, someone would have actually had to document what the | ||
| 693 | ## issues it worked around were, so we could test for them. | ||
| 694 | if test $emacs_cv_apple_gcc = yes; then | ||
| 695 | AC_MSG_CHECKING([whether preprocessor accepts -no-cpp-precomp]) | ||
| 696 | save_CPP="$CPP" | ||
| 697 | test x$SPECIFIED_CPP = x && CPP="${CC-cc} -E" | ||
| 698 | CPP="$CPP -no-cpp-precomp" | ||
| 699 | dnl NB this will run AC_PROG_CPP first if it has not already happened. | ||
| 700 | AC_CACHE_VAL(emacs_cv_precomp, | ||
| 701 | [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]],[[]])], emacs_cv_precomp=yes, emacs_cv_precomp=no)]) | ||
| 702 | AC_MSG_RESULT($emacs_cv_precomp) | ||
| 703 | |||
| 704 | test $emacs_cv_precomp = no && CPP="$save_CPP" | ||
| 705 | fi | ||
| 706 | fi | ||
| 707 | |||
| 666 | #### Some systems specify a CPP to use unless we are using GCC. | 708 | #### Some systems specify a CPP to use unless we are using GCC. |
| 667 | #### Now that we know whether we are using GCC, we can decide whether | 709 | #### Now that we know whether we are using GCC, we can decide whether |
| 668 | #### to use that one. | 710 | #### to use that one. |
| @@ -671,6 +713,8 @@ then | |||
| 671 | CPP="$NON_GNU_CPP" | 713 | CPP="$NON_GNU_CPP" |
| 672 | fi | 714 | fi |
| 673 | 715 | ||
| 716 | test "x$CPP_TEST_OPTIONS" != x && CPP="$CPP $CPP_TEST_OPTIONS" | ||
| 717 | |||
| 674 | #### Some systems specify a CC to use unless we are using GCC. | 718 | #### Some systems specify a CC to use unless we are using GCC. |
| 675 | #### Now that we know whether we are using GCC, we can decide whether | 719 | #### Now that we know whether we are using GCC, we can decide whether |
| 676 | #### to use that one. | 720 | #### to use that one. |
| @@ -805,12 +849,16 @@ fi | |||
| 805 | 849 | ||
| 806 | #### Some other nice autoconf tests. | 850 | #### Some other nice autoconf tests. |
| 807 | 851 | ||
| 808 | dnl checks for programs | 852 | dnl Note: looks like gl_EARLY has already done this. |
| 809 | AC_PROG_CPP | 853 | AC_PROG_CPP |
| 810 | AC_PROG_INSTALL | 854 | AC_PROG_INSTALL |
| 855 | |||
| 856 | dnl Note: looks like configure does this very early on anyway. | ||
| 811 | AC_PROG_MKDIR_P | 857 | AC_PROG_MKDIR_P |
| 858 | |||
| 859 | dnl Note: looks like gl_EARLY has already done this. | ||
| 812 | if test "x$RANLIB" = x; then | 860 | if test "x$RANLIB" = x; then |
| 813 | AC_PROG_RANLIB | 861 | AC_PROG_RANLIB |
| 814 | fi | 862 | fi |
| 815 | 863 | ||
| 816 | ## Although we're running on an amd64 kernel, we're actually compiling for | 864 | ## Although we're running on an amd64 kernel, we're actually compiling for |