Added SilcFloat32 and SilcFloat64, 32-bit and 64-bit floating point types
[runtime.git] / configure.ad
index 3fad742985fb10bc4978605984b66e60ca0c8a97..1fe945ea7c33a5d22345b3cf764deeb0a6eced70 100644 (file)
@@ -19,7 +19,7 @@ AD_INIT
 AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE
 AC_PREREQ(2.52)
-AC_CONFIG_HEADERS(silcdefs.h)
+AC_CONFIG_HEADERS(runtimedefs.h)
 
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
@@ -149,20 +149,16 @@ case "$host_cpu" in
     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]), [])
+    SILC_CPU_FLAG(sse4a, true, AC_DEFINE([SILC_CPU_SSE4A], [], [SILC_CPU_SSE4A]), [])
+    SILC_CPU_FLAG(sse4_1, true, AC_DEFINE([SILC_CPU_SSE41], [], [SILC_CPU_SSE41]), [])
+    SILC_CPU_FLAG(sse4_2, true, AC_DEFINE([SILC_CPU_SSE42], [], [SILC_CPU_SSE42]), [])
+    SILC_CPU_FLAG(sse5, true, AC_DEFINE([SILC_CPU_SSE5], [], [SILC_CPU_SSE5]), [])
     ;;
 
   # 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
@@ -175,7 +171,10 @@ case "$host_cpu" in
     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]), [])
+    SILC_CPU_FLAG(sse4a, true, AC_DEFINE([SILC_CPU_SSE4A], [], [SILC_CPU_SSE4A]), [])
+    SILC_CPU_FLAG(sse4_1, true, AC_DEFINE([SILC_CPU_SSE41], [], [SILC_CPU_SSE41]), [])
+    SILC_CPU_FLAG(sse4_2, true, AC_DEFINE([SILC_CPU_SSE42], [], [SILC_CPU_SSE42]), [])
+    SILC_CPU_FLAG(sse5, true, AC_DEFINE([SILC_CPU_SSE5], [], [SILC_CPU_SSE5]), [])
     ;;
 
   # PowerPC, 32-bit and 64-bit CPUs
@@ -197,17 +196,15 @@ 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_sse2 = xtrue; then
-      SILC_ADD_CFLAGS(-axW)
-    fi
-    if test x$x_have_cpu_sse3 = xtrue; then
-      SILC_ADD_CFLAGS(-axP)
+    if test x$x_have_cpu_sse4_1 = xtrue; then
+      SILC_ADD_CFLAGS(-axS)
     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)
+    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
@@ -220,7 +217,7 @@ if test x$want_cpu_optimizations = xtrue; then
     if test x$x_have_cpu_ssse3 = xtrue; then
       SILC_ADD_CFLAGS(-mssse3)
     fi
-    if test x$x_have_cpu_sse4 = xtrue; then
+    if test x$x_have_cpu_sse4_1 = xtrue; then
       SILC_ADD_CFLAGS(-msse4)
     fi
   fi
@@ -260,7 +257,7 @@ AC_HEADER_STAT
 
 # More header checking
 #
-AC_CHECK_HEADERS(unistd.h string.h errno.h fcntl.h assert.h)
+AC_CHECK_HEADERS(unistd.h string.h errno.h fcntl.h assert.h execinfo.h)
 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
@@ -382,7 +379,7 @@ AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
 AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep)
 AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
-AC_CHECK_FUNCS(setenv getenv putenv unsetenv clearenv)
+AC_CHECK_FUNCS(setenv getenv putenv unsetenv clearenv backtrace)
 
 # Check getopt_long
 AC_CHECK_FUNC(getopt_long,
@@ -437,6 +434,7 @@ AC_CHECK_FUNC(epoll_wait,
 
 # Check for va_copy
 va_copy=false
+__SILC_VA_COPY="#define __SILC_VA_COPY(dest, src) dest = src"
 AC_MSG_CHECKING(for va_copy)
 AC_TRY_COMPILE(
   [
@@ -461,7 +459,7 @@ AC_TRY_COMPILE(
     }
   ],
   [
-    AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY])
+    __SILC_VA_COPY="#define __SILC_VA_COPY(dest, src) va_copy(dest, src)"
     AC_MSG_RESULT(yes)
     va_copy=true
   ],
@@ -496,7 +494,7 @@ if test x$va_copy = xfalse; then
     }
   ],
   [
-    AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY])
+    __SILC_VA_COPY="#define __SILC_VA_COPY(dest, src) __va_copy(dest, src)"
     AC_MSG_RESULT(yes)
     va_copy=true
   ],
@@ -531,10 +529,12 @@ if test x$va_copy = xfalse; then
     [va_copy=false],
     [
       AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
+      __SILC_VA_COPY="#define __SILC_VA_COPY(dest, src) memmove(dest, src, sizeof(va_list))"
     ],
     [va=copy=false]
   )
 fi
+AC_SUBST(__SILC_VA_COPY)
 
 # Check for timezone and tm_gmtoff for timezone information
 AC_MSG_CHECKING(whether system has timezone)
@@ -717,6 +717,7 @@ AC_ARG_WITH(alignment,
   ])
 
 # Stack trace checking
+__SILC_ENABLE_STACKTRACE=""
 AC_MSG_CHECKING(whether to enable stack tracing)
 AC_ARG_ENABLE(stack-trace,
   [  --enable-stack-trace    enable memory stack trace],
@@ -725,6 +726,9 @@ AC_ARG_ENABLE(stack-trace,
     yes)
       AC_MSG_RESULT(yes)
       AC_DEFINE([SILC_STACKTRACE], [], [SILC_STACKTRACE])
+      __SILC_ENABLE_STACKTRACE="#define __SILC_ENABLE_STACKTRACE 1"
+      CFLAGS="$CFLAGS -rdynamic"
+      PC_CFLAGS="$PC_CFLAGS -rdynamic"
       ;;
     *)
       AC_MSG_RESULT(no)
@@ -788,6 +792,7 @@ AC_ARG_ENABLE(debug,
       yes)
         AC_MSG_RESULT(yes)
         AC_DEFINE([SILC_DEBUG], [], [enable-debug])
+        PC_CFLAGS="$PC_CFLAGS -DSILC_DEBUG"
        summary_debug="yes"
         __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
         ;;
@@ -851,6 +856,7 @@ LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
 
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/contrib"
 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcutil"
+SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silchttp"
 
 
 # Check for iconv support
@@ -1183,9 +1189,54 @@ if test x$has_threads = xtrue; then
   AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
   AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
   __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
+  PC_CFLAGS="$PC_CFLAGS -DSILC_THREADS"
 fi
 
 
+# Check for Expat
+AC_ARG_WITH(expat,
+  [[  --with-expat[=DIR]      use Expat XML [search in DIR/include and DIR/lib]]],
+  [
+    case "${withval}" in
+      no)
+        ;;
+      *)
+        if test -d $withval/include; then
+          CPPFLAGS="$CPPFLAGS -I$withval/include"
+          CFLAGS="$CFLAGS -I$withval/include"
+        fi
+        if test -d $withval/lib; then
+          LDFLAGS="$LDFLAGS -L$withval/lib"
+        fi
+        ;;
+    esac
+  ])
+
+AC_CHECK_HEADERS(expat.h,
+  [ LIBS="$LIBS -lexpat" ],
+  [ AC_MSG_ERROR(Expat XML Library is required to compile SRT) ])
+
+
+##
+## Native WIN32 compilation under cygwin
+##
+AC_MSG_CHECKING(whether to compile native WIN32 code)
+AC_ARG_WITH(win32,
+  [  --with-win32            compile native WIN32 (MinGW) code (-mno-cygwin)],
+  [
+    AC_MSG_RESULT(yes)
+    AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
+    win32_support=true
+    CFLAGS="-mno-cygwin $CFLAGS"
+    LIBS="$LIBS -lwsock32"
+  ],
+  [
+    AC_MSG_RESULT(no)
+    win32_support=false
+  ])
+AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
+
+
 ##
 ## Outputs and substitutions
 ##
@@ -1195,13 +1246,12 @@ AC_SUBST(SILC_TOP_SRCDIR)
 AC_SUBST(LDFLAGS)
 AC_SUBST(LIBS)
 AC_SUBST(SILC_LIB_INCLUDES)
+AC_SUBST(PC_CFLAGS)
 AC_SUBST(__SILC_ENABLE_DEBUG)
+AC_SUBST(__SILC_ENABLE_STACKTRACE)
 AC_SUBST(__SILC_HAVE_PTHREAD)
 AC_SUBST(__RUNTIME_PACKAGE_VERSION)
 
-# Native Windows support (disabled by default)
-AM_CONDITIONAL(SILC_WIN32, test xfalse = xtrue)
-
 # Native Symbian OS support (disabled by default)
 AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
 
@@ -1219,6 +1269,9 @@ AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
 AC_SUBST(INCLUDE_DEFINES_INT)
 
+DATE=`date`
+AC_SUBST(DATE)
+
 
 #
 # Makefile outputs
@@ -1226,11 +1279,11 @@ AC_SUBST(INCLUDE_DEFINES_INT)
 AC_CONFIG_FILES(
 Makefile
 doc/Makefile
+doc/runtime.in/index.html
+doc/runtime.in/manual.html
 Makefile.defines
 Makefile.defines_int
 includes/Makefile
-includes/silcversion.h
-includes/silc.h
 apps/Makefile
 win32/Makefile
 )
@@ -1244,6 +1297,8 @@ lib/silcutil/tests/Makefile
 lib/silcutil/unix/Makefile
 lib/silcutil/win32/Makefile
 lib/silcutil/symbian/Makefile
+lib/silchttp/Makefile
+lib/silchttp/tests/Makefile
 lib/srt.pc
 )