X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=configure.ad;h=e8c295b30b6efac61d5aaec0a6a91cc310745eb3;hb=28af33fffb344c93dc9b2bd4c4d0ab30855f7c23;hp=d98e4db2d2713e44f0f23e614ac7648303f08831;hpb=486172f0f37b13b3deff8f5aa140f054bfe0599d;p=crypto.git diff --git a/configure.ad b/configure.ad index d98e4db2..e8c295b3 100644 --- a/configure.ad +++ b/configure.ad @@ -53,7 +53,8 @@ case "$target" in esac # Get CPU -SILC_SYSTEM_IS_SMP(AC_DEFINE([SILC_SMP], [], [SILC_SMP]), []) +SILC_SYSTEM_IS_SMP(AC_DEFINE([SILC_SMP], [], [SILC_SMP]), [], + AC_DEFINE([SILC_SMP], [], [SILC_SMP])) cpu_i386=false cpu_i486=false cpu_i586=false @@ -65,6 +66,7 @@ cpu_ia64=false case "$host_cpu" in # All following Intels are considered 32-bit CPUs. i?86) + # All CPUs of today are considered i386 and i486 compatible */ AC_DEFINE([SILC_I386], [], [SILC_I386]) AC_DEFINE([SILC_I486], [], [SILC_I486]) cpu_i386=true @@ -92,9 +94,11 @@ case "$host_cpu" in fi # Check for specific CPU features + SILC_CPU_FLAG(mmx, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), []) SILC_CPU_FLAG(sse2, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), []) SILC_CPU_FLAG(sse3, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), []) SILC_CPU_FLAG(ssse3, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), []) + SILC_CPU_FLAG(sse4, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), []) ;; # Intel IA-64, 64-bit CPU (not x86_64 compatible) @@ -103,9 +107,11 @@ case "$host_cpu" in cpu_ia64=true # Check for specific CPU features + SILC_CPU_FLAG(mmx, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), []) SILC_CPU_FLAG(sse2, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), []) SILC_CPU_FLAG(sse3, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), []) SILC_CPU_FLAG(ssse3, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), []) + SILC_CPU_FLAG(sse4, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), []) ;; # AMD/Intel x86_64, 64-bit CPU @@ -114,9 +120,11 @@ case "$host_cpu" in cpu_x86_64=true # Check for specific CPU features + SILC_CPU_FLAG(mmx, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), []) SILC_CPU_FLAG(sse2, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), []) SILC_CPU_FLAG(sse3, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), []) SILC_CPU_FLAG(ssse3, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), []) + SILC_CPU_FLAG(sse4, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), []) ;; # PowerPC, 32-bit and 64-bit CPUs @@ -141,6 +149,37 @@ AC_PROG_CC AC_C_INLINE AC_C_CONST +# Set some compiler options based on CPU +if test "x$CC" = "xicc"; then + # ICC flags + if test x$x_have_cpu_sse2 = xtrue; then + SILC_ADD_CFLAGS(-axW) + fi + if test x$x_have_cpu_sse3 = xtrue; then + SILC_ADD_CFLAGS(-axP) + fi + if test x$x_have_cpu_ssse3 = xtrue; then + SILC_ADD_CFLAGS(-axT) + fi + if test x$x_have_cpu_sse4 = xtrue; then + SILC_ADD_CFLAGS(-axS) + fi +else + # Other compilers + if test x$x_have_cpu_sse2 = xtrue; then + SILC_ADD_CFLAGS(-msse2) + fi + if test x$x_have_cpu_sse3 = xtrue; then + SILC_ADD_CFLAGS(-msse3) + fi + if test x$x_have_cpu_ssse3 = xtrue; then + SILC_ADD_CFLAGS(-mssse3) + fi + if test x$x_have_cpu_sse4 = xtrue; then + SILC_ADD_CFLAGS(-msse3) + fi +fi + __SILC_HAVE_PTHREAD="" __SILC_HAVE_SIM="" __SILC_ENABLE_DEBUG="" @@ -227,6 +266,12 @@ AC_CHECK_FUNC(gethostbyname, [], AC_CHECK_FUNC(socket, [], AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") ) +AC_CHECK_FUNC(clock_gettime, [], + [ + AC_CHECK_LIB(rt, clock_gettime, + [ LIBS="$LIBS -lrt" + AC_DEFINE([HAVE_CLOCK_GETTIME], [], [HAVE_CLOCK_GETTIME])]) + ]) AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport) AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt) AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage) @@ -385,13 +430,21 @@ have_assembler=false if test x$want_asm = xtrue; then AC_PATH_PROG([NASM], [nasm], [no]) if test "x$NASM" != "xno"; then - SILC_ASSEMBLER="$NASM -O2 -felf" + if test x$cpu_x86_64 = xtrue; then + SILC_ASSEMBLER="$NASM -O2 -felf64" + else + SILC_ASSEMBLER="$NASM -O2 -felf" + fi have_assembler=true fi AC_PATH_PROG([YASM], [yasm], [no]) if test "x$YASM" != "xno"; then - SILC_ASSEMBLER="$YASM -Xgnu -felf" + if test x$cpu_x86_64 = xtrue; then + SILC_ASSEMBLER="$YASM -Xgnu -felf64" + else + SILC_ASSEMBLER="$YASM -Xgnu -felf" + fi have_assembler=true fi fi @@ -527,9 +580,13 @@ else ;; esac - # Intel C++ Compiler needs -restrict + # Intel C++ Compiler flags if test "x$CC" = "xicc"; then SILC_ADD_CFLAGS(-restrict) + SILC_ADD_CFLAGS(-finline-functions) + + # Don't define __GNUC__ except for system includes + SILC_ADD_CFLAGS(-gcc-sys) fi fi @@ -678,6 +735,7 @@ else LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS" fi fi + #else SILC_DIST_TOOLKIT LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS" #endif SILC_DIST_TOOLKIT