configure: Check if building against a x86/x64 architecture
authorMartin Willi <martin@revosec.ch>
Thu, 2 Apr 2015 13:08:34 +0000 (15:08 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 29 Jun 2015 15:32:14 +0000 (17:32 +0200)
This allows us to include compiler flags specific for them, such as MMX/SSE.

configure.ac

index 95018f4..e4d1480 100644 (file)
@@ -839,6 +839,22 @@ AC_COMPILE_IFELSE(
        ]
 )
 
+AC_MSG_CHECKING([x86/x64 target])
+AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+               [], [[
+                #if !defined(__i386__) && !defined(__x86_64__)
+                # error not on x86/x64
+                #endif
+               ]])],
+       [
+               x86x64=true
+               AC_MSG_RESULT([yes])
+       ],
+       [AC_MSG_RESULT([no])]
+)
+AM_CONDITIONAL(USE_X86X64, [test "x$x86x64" = xtrue])
+
 if test x$printf_hooks = xvstr; then
        AC_CHECK_LIB([vstr],[main],[LIBS="$LIBS"],[AC_MSG_ERROR([Vstr string library not found])],[])
        AC_DEFINE([USE_VSTR], [], [use Vstr string library for printf hooks])