configure.in
changeset 10009 8c6b05b0a27e
parent 9985 091503bd5054
child 10043 24e8d042e532
     1.1 --- a/configure.in	Mon Jan 04 22:00:04 2016 -0500
     1.2 +++ b/configure.in	Mon Jan 04 22:58:38 2016 -0500
     1.3 @@ -1124,6 +1124,30 @@
     1.4      fi
     1.5  }
     1.6  
     1.7 +dnl See if GCC's -Wdeclaration-after-statement is supported.
     1.8 +dnl  This lets us catch things that would fail on a C89 compiler when using
     1.9 +dnl  a modern GCC.
    1.10 +CheckDeclarationAfterStatement()
    1.11 +{
    1.12 +    AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
    1.13 +    have_gcc_declaration_after_statement=no
    1.14 +
    1.15 +    save_CFLAGS="$CFLAGS"
    1.16 +    CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
    1.17 +    AC_TRY_COMPILE([
    1.18 +    int x = 0;
    1.19 +    ],[
    1.20 +    ],[
    1.21 +    have_gcc_declaration_after_statement=yes
    1.22 +    ])
    1.23 +    AC_MSG_RESULT($have_gcc_declaration_after_statement)
    1.24 +    CFLAGS="$save_CFLAGS"
    1.25 +
    1.26 +    if test x$have_gcc_declaration_after_statement = xyes; then
    1.27 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
    1.28 +    fi
    1.29 +}
    1.30 +
    1.31  dnl See if GCC's -Wall is supported.
    1.32  CheckWarnAll()
    1.33  {
    1.34 @@ -2801,6 +2825,9 @@
    1.35                    , enable_rpath=yes)
    1.36  }
    1.37  
    1.38 +dnl Do this on all platforms, before everything else (other things might want to override it).
    1.39 +CheckWarnAll
    1.40 +
    1.41  dnl Set up the configuration based on the host platform!
    1.42  case "$host" in
    1.43      *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
    1.44 @@ -2870,6 +2897,7 @@
    1.45              *-*-minix*)         ARCH=minix ;;
    1.46          esac
    1.47          CheckVisibilityHidden
    1.48 +        CheckDeclarationAfterStatement
    1.49          CheckDummyVideo
    1.50          CheckDiskAudio
    1.51          CheckDummyAudio
    1.52 @@ -3196,6 +3224,7 @@
    1.53          ARCH=ios
    1.54  
    1.55          CheckVisibilityHidden
    1.56 +        CheckDeclarationAfterStatement
    1.57          CheckDummyVideo
    1.58          CheckDiskAudio
    1.59          CheckDummyAudio
    1.60 @@ -3265,6 +3294,7 @@
    1.61          EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
    1.62  
    1.63          CheckVisibilityHidden
    1.64 +        CheckDeclarationAfterStatement
    1.65          CheckDummyVideo
    1.66          CheckDiskAudio
    1.67          CheckDummyAudio
    1.68 @@ -3366,6 +3396,7 @@
    1.69          fi
    1.70  
    1.71          CheckVisibilityHidden
    1.72 +        CheckDeclarationAfterStatement
    1.73          CheckDummyVideo
    1.74          CheckDiskAudio
    1.75          CheckDummyAudio
    1.76 @@ -3407,9 +3438,6 @@
    1.77          ;;
    1.78  esac
    1.79  
    1.80 -dnl Do this on all platforms, after everything else.
    1.81 -CheckWarnAll
    1.82 -
    1.83  # Verify that we have all the platform specific files we need
    1.84  
    1.85  if test x$have_joystick != xyes; then