Avoid false detection of SMSC FDC37N972 when Infineon TPM is present
[coreboot.git] / util / mkelfImage / configure.ac
index 0c0e9c09febfd62d5745c413050fecf6b5bd984a..a7fc37ecf2503e2485482920cc4b7e355a8d906c 100644 (file)
@@ -1,7 +1,7 @@
-dnl 
+dnl
 dnl configure.ac for mkelfImage
-dnl 
-dnl 
+dnl
+dnl
 
 dnl ---Required
 AC_INIT(Makefile.conf.in)
@@ -16,11 +16,11 @@ AC_CANONICAL_HOST
 
 
 dnl Compute target cpu
-case $host_cpu in 
-       i?86 )  
+case $host_cpu in
+       i?86 )
                target_cpu="i386"
                ;;
-       * ) 
+       * )
                target_cpu="$host_cpu"
                ;;
 esac
@@ -111,7 +111,7 @@ if test "$with_i386" != "no" ; then
        fi
        AC_CHECK_PROG([I386_CC], [$cc], [$cc], [""], [$PATH])
        if test "$I386_CC" = no; then
-          
+
                AC_MSG_ERROR([$cc not found])
        fi
        AC_CHECK_PROG([I386_CPP], [$cpp], [$cpp], [""], [$PATH])
@@ -148,7 +148,7 @@ if test "$with_ia64" != "no" ; then
        fi
        AC_CHECK_PROG([IA64_CC], [$cc], [$cc], [""], [$PATH])
        if test "$IA64_CC" = no; then
-          
+
                AC_MSG_ERROR([$cc not found])
        fi
        AC_CHECK_PROG([IA64_CPP], [$cpp], [$cpp], [""], [$PATH])
@@ -173,19 +173,40 @@ fi
 dnl ---Output variables...
 
 HOST_CC=$CC
-HOST_CFLAGS='-O2 -Wall $(HOST_CPPFLAGS)'
+HOST_CFLAGS="$HOST_CFLAGS -O2 -Wall \$(HOST_CPPFLAGS)"
 
 dnl TODO: figure out how to set these appropriately for compilers other than gcc
-I386_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format $(I386_CPPFLAGS)'
+I386_CFLAGS="$I386_CFLAGS -Os -ffreestanding -Wall -W -Wno-format \$(I386_CPPFLAGS)"
 I386_ASFLAGS=''
 I386_LDFLAGS='-static --warn-multiple-gp --warn-common'
 
 dnl TODO: figure out how to set these appropriately for compilers other than gcc
-IA64_CFLAGS='-Os -ffreestanding -Wall -W -Wno-format -fpic -mconstant-gp -mauto-pic -fno-unwind-tables $(IA64_CPPFLAGS)'
+IA64_CFLAGS="$IA64_CFLAGS -Os -ffreestanding -Wall -W -Wno-format -fpic -mconstant-gp -mauto-pic -fno-unwind-tables \$(IA64_CPPFLAGS)"
 IA64_ASFLAGS='-mconstant-gp -mauto-pic'
 IA64_LDFLAGS='-static --warn-multiple-gp --warn-common'
 
 AC_SUBST([HOST_CC])
+
+AC_CACHE_CHECK(for -fno-stack-protector, libc_cv_fno_stack_protector, [
+cat > conftest.c <<EOF
+int foo;
+main () { return 0;}
+EOF
+if AC_TRY_COMMAND([$I386_CC -fno-stack-protector
+                           -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_fno_stack_protector=yes
+else
+  libc_cv_fno_stack_protector=no
+fi
+rm -f conftest*])
+if test $libc_cv_fno_stack_protector = yes; then
+  I386_CFLAGS="$I386_CFLAGS -fno-stack-protector"
+  IA64_CFLAGS="$IA64_CFLAGS -fno-stack-protector"
+  
+fi
+AC_SUBST(libc_cv_fno_stack_protector)
+
 AC_SUBST([HOST_CFLAGS])
 
 AC_SUBST([I386_CC])