configure: Do a real check for -idirafter anyhow.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 19 May 2020 12:08:05 -0400
changeset 13832b65783853022
parent 13831 0522c30c1990
child 13833 9e4cca5c8e62
configure: Do a real check for -idirafter anyhow.

(The CMake project cheats around this by asking "are we GCC or Clang?" and I'm
inclined to leave it like that for now.)
configure
configure.ac
     1.1 --- a/configure	Tue May 19 11:52:15 2020 -0400
     1.2 +++ b/configure	Tue May 19 12:08:05 2020 -0400
     1.3 @@ -16000,7 +16000,37 @@
     1.4          ;;
     1.5  esac
     1.6  
     1.7 -INCLUDE="-I$srcdir/include -I$srcdir/src/video/khronos"
     1.8 +save_CFLAGS="$CFLAGS"
     1.9 +have_idirafter="no"
    1.10 +idirafter="-I"
    1.11 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -idirafter option" >&5
    1.12 +$as_echo_n "checking for -idirafter option... " >&6; }
    1.13 +CFLAGS="$save_CFLAGS -idirafter src"
    1.14 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.15 +/* end confdefs.h.  */
    1.16 +
    1.17 +
    1.18 +int
    1.19 +main ()
    1.20 +{
    1.21 +
    1.22 +
    1.23 +  ;
    1.24 +  return 0;
    1.25 +}
    1.26 +_ACEOF
    1.27 +if ac_fn_c_try_compile "$LINENO"; then :
    1.28 +
    1.29 +have_idirafter="yes"
    1.30 +idirafter="-idirafter"
    1.31 +
    1.32 +fi
    1.33 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.34 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_idirafter" >&5
    1.35 +$as_echo "$have_idirafter" >&6; }
    1.36 +CFLAGS="$save_CFLAGS"
    1.37 +
    1.38 +INCLUDE="-I$srcdir/include $idirafter $srcdir/src/video/khronos"
    1.39  if test x$srcdir != x.; then
    1.40      INCLUDE="-Iinclude $INCLUDE"
    1.41  elif test -d .hg; then
     2.1 --- a/configure.ac	Tue May 19 11:52:15 2020 -0400
     2.2 +++ b/configure.ac	Tue May 19 12:08:05 2020 -0400
     2.3 @@ -69,8 +69,23 @@
     2.4          ;;
     2.5  esac
     2.6  
     2.7 +dnl see if -idirafter is available.
     2.8 +save_CFLAGS="$CFLAGS"
     2.9 +have_idirafter="no"
    2.10 +idirafter="-I"
    2.11 +AC_MSG_CHECKING(for -idirafter option)
    2.12 +CFLAGS="$save_CFLAGS -idirafter src"
    2.13 +AC_TRY_COMPILE([
    2.14 +],[
    2.15 +],[
    2.16 +have_idirafter="yes"
    2.17 +idirafter="-idirafter"
    2.18 +])
    2.19 +AC_MSG_RESULT($have_idirafter)
    2.20 +CFLAGS="$save_CFLAGS"
    2.21 +
    2.22  dnl Set up the compiler and linker flags
    2.23 -INCLUDE="-I$srcdir/include -I$srcdir/src/video/khronos"
    2.24 +INCLUDE="-I$srcdir/include $idirafter $srcdir/src/video/khronos"
    2.25  if test x$srcdir != x.; then
    2.26      INCLUDE="-Iinclude $INCLUDE"
    2.27  elif test -d .hg; then