+
+# Base version for library.
+RUNTIME_BASE_VERSION=1.2
+
+# libsilc versions
+RUNTIME_CURRENT=1 # prev = 0
+RUNTIME_REVISION=0 # prev = 0
+RUNTIME_AGE=0 # prev = 0
+
+# Substitute the version numbers
+AC_SUBST(RUNTIME_BASE_VERSION)
+AC_SUBST(RUNTIME_CURRENT)
+AC_SUBST(RUNTIME_REVISION)
+AC_SUBST(RUNTIME_AGE)
+
+
+##
+## Installation
+##
+
+# Default installation destination
+AC_PREFIX_DEFAULT(/usr/local)
+if test "x$prefix" != xNONE; then
+ silc_prefix="$prefix"
+else
+ silc_prefix="$ac_default_prefix"
+ prefix="$silc_prefix"
+fi
+
+
+##
+## Detect CPU
+##
+
+# Disable all CPU feature optimizations
+AC_MSG_CHECKING(whether to enable CPU feature optimizations)
+AC_ARG_ENABLE(cpu-optimizations,
+ [ --disable-cpu-optimizations do not use any CPU feature optimizations],
+ [
+ AC_MSG_RESULT(no)
+ AC_DEFINE([SILC_NO_CPU_OPTIMIZATIONS], [], [SILC_NO_CPU_OPTIMIZATIONS])
+ want_cpu_optimizations=false
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ want_cpu_optimizations=true
+ ])
+AM_CONDITIONAL(SILC_NO_CPU_OPTIMIZATIONS,
+ test x$want_cpu_optimizations = xfalse)
+
+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
+cpu_i686=false
+cpu_i786=false
+cpu_x86_64=false
+cpu_ppc=false
+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
+ cpu_i486=true
+
+ if test "x$host_cpu" = "xi586"; then
+ AC_DEFINE([SILC_I586], [], [SILC_I586])
+ cpu_i586=true
+ fi
+
+ if test "x$host_cpu" = "xi686"; then
+ AC_DEFINE([SILC_I586], [], [SILC_I586])
+ AC_DEFINE([SILC_I686], [], [SILC_I686])
+ cpu_i586=true
+ cpu_i686=true
+ fi
+
+ if test "x$host_cpu" = "xi786"; then
+ AC_DEFINE([SILC_I586], [], [SILC_I586])
+ AC_DEFINE([SILC_I686], [], [SILC_I686])
+ AC_DEFINE([SILC_I786], [], [SILC_I786])
+ cpu_i586=true
+ cpu_i686=true
+ cpu_i786=true
+ fi
+
+ # Check for specific CPU features
+ SILC_CPU_FLAG(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
+ SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
+ SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
+ SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
+ SILC_CPU_FLAG(sse4, true, 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(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
+ SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
+ SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
+ SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
+ SILC_CPU_FLAG(sse4, true, 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(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
+ SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
+ SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
+ SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
+ SILC_CPU_FLAG(sse4, true, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), [])
+ ;;
+
+ # PowerPC, 32-bit and 64-bit CPUs
+ powerpc*)
+ AC_DEFINE([SILC_POWERPC], [], [SILC_POWERPC])
+ cpu_ppc=true
+ ;;
+esac
+AM_CONDITIONAL(SILC_I386, test x$cpu_i386 = xtrue)
+AM_CONDITIONAL(SILC_I486, test x$cpu_i486 = xtrue)
+AM_CONDITIONAL(SILC_I586, test x$cpu_i586 = xtrue)
+AM_CONDITIONAL(SILC_I686, test x$cpu_i686 = xtrue)
+AM_CONDITIONAL(SILC_7686, test x$cpu_i786 = xtrue)
+AM_CONDITIONAL(SILC_X86_64, test x$cpu_x86_64 = xtrue)
+AM_CONDITIONAL(SILC_POWERPC, test x$cpu_ppc = xtrue)
+AM_CONDITIONAL(SILC_IA64, test x$cpu_ia64 = xtrue)
+
+if test x$want_cpu_optimizations = xtrue; then
+ # Set some compiler options based on CPU
+ if test "x$CC" = "xicc"; then
+ # ICC flags
+ if test x$x_have_cpu_sse4 = xtrue; then
+ SILC_ADD_CFLAGS(-axS)
+ fi
+ if test x$x_have_cpu_ssse3 = xtrue; then
+ SILC_ADD_CFLAGS(-axT)
+ elif test x$x_have_cpu_pni = xtrue; then
+ SILC_ADD_CFLAGS(-axP)
+ elif test x$x_have_cpu_sse2 = xtrue; then
+ SILC_ADD_CFLAGS(-axW)
+ fi
+ else
+ # Other compilers
+ if test x$x_have_cpu_sse2 = xtrue; then
+ SILC_ADD_CFLAGS(-msse2)
+ fi
+ if test x$x_have_cpu_pni = 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(-msse4)
+ fi
+ fi
+fi
+
+
+##
+## Put here any platform specific stuff
+##
+