X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=configure.ad;h=15da13be757c27f19471aaf7ed7d4c2f6ae7db96;hb=c2d3eb61a944452c29c5eeb2e89b9113097422de;hp=ca534c970b9e9afba91b174bbccda2c47d03e76b;hpb=be52e8850f90e718c6df066c588af839cc287ef5;p=silc.git diff --git a/configure.ad b/configure.ad index ca534c97..15da13be 100644 --- a/configure.ad +++ b/configure.ad @@ -30,6 +30,7 @@ AC_SUBST(LN_S) AC_PATH_PROG(sedpath, sed) #ifdef SILC_DIST_COMPILER + # Put here any platform specific stuff # case "$target" in @@ -52,6 +53,8 @@ case "$target" in esac # Get CPU +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 @@ -88,18 +91,36 @@ case "$host_cpu" in cpu_i686=true cpu_i786=true fi + + # Check for specific CPU features + 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) ia64) AC_DEFINE([SILC_IA64], [], [SILC_IA64]) cpu_ia64=true + + # Check for specific CPU features + 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 x86_64) AC_DEFINE([SILC_X86_64], [], [SILC_X86_64]) cpu_x86_64=true + + # Check for specific CPU features + 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 @@ -124,6 +145,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="" @@ -198,30 +250,6 @@ AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p) AC_CHECK_TYPES(long long) AC_CHECK_TYPES(long double) -# Function to check if compiler flag works -# Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED]) -AC_DEFUN([SILC_ADD_CFLAGS], -[ tmp_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $1" - AC_MSG_CHECKING(whether $CC accepts $1 flag) - AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) - CFLAGS="$tmp_CFLAGS" - $2]) - unset tmp_CFLAGS -]) - -# Function to check if compiler flag works, destination specifiable -# Usage: SILC_ADD_CC_FLAGS(VAR, FLAGS, [ACTION-IF-FAILED]) -AC_DEFUN([SILC_ADD_CC_FLAGS], -[ tmp_CFLAGS="$1_CFLAGS" - $1_CFLAGS="${$1_CFLAGS} $2" - AC_MSG_CHECKING(whether $CC accepts $2 flag) - AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) - $1_CFLAGS="$tmp_CFLAGS" - $3]) - unset tmp_CFLAGS -]) - # Function and library checking # AC_CHECK_FUNC(gethostbyname, [], @@ -234,6 +262,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) @@ -534,9 +568,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 @@ -685,6 +723,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