Merged silc_1_0_branch to trunk.
[silc.git] / configure.in.pre
index 671dac894b0f2fabe6e7c1f8ce2c30b203f3873e..4bb362c80a9c18ec25db05ff880927b44369a7a1 100644 (file)
@@ -39,6 +39,7 @@ AM_INIT_AUTOMAKE(SILC_PACKAGE, SILC_VERSION)
 AC_PREREQ(2.52)
 AC_CONFIG_HEADERS(includes/silcdefs.h)
 
+CFLAGS=
 AC_PROG_CC
 AC_C_INLINE
 AC_C_CONST
@@ -46,23 +47,18 @@ AC_C_CONST
 AC_PROG_LN_S
 AC_SUBST(LN_S)
 
-# Distribution definition. ./prepare will automatically add here a correct
-# value. Do not edit!
-#
+##
+## Distribution definition. ./prepare will automatically add here a correct
+## value. Do not edit!
+##
 silc_dist=SILC_PACKAGE
 SILC_DIST_SUBDIRS="SILC_DISTRIBUTION_SUBDIRS"
 AC_DEFINE(SILC_DIST_DEFINE)
 
-# XXX
-# Compiler flags
-#
-if test "$GCC"; then
-  CFLAGS="-Wall -finline-functions $CFLAGS"
-fi
 
-#
-# Library versioning.
-#
+##
+## Library versioning.
+##
 # Do the releases and library versioning according to following rules:
 #
 #  - If any code has changed in library, increment [LIB]_REVISION
@@ -83,13 +79,13 @@ fi
 LIB_BASE_VERSION=1.0
 
 # libsilc versions
-LIBSILC_CURRENT=1
+LIBSILC_CURRENT=2
 LIBSILC_REVISION=0
-LIBSILC_AGE=1
+LIBSILC_AGE=0
 
 # libsilcclient versions
-LIBSILCCLIENT_CURRENT=1
-LIBSILCCLIENT_REVISION=1
+LIBSILCCLIENT_CURRENT=2
+LIBSILCCLIENT_REVISION=0
 LIBSILCCLIENT_AGE=0
 
 # Substitute the version numbers
@@ -205,7 +201,6 @@ AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
 AC_CHECK_FUNC(getopt_long, have_getopt_long=1, have_getopt_long=0)
 AM_CONDITIONAL(HAVE_GETOPT_LONG, test x$have_getopt_long = x1)
 
-
 ##
 ##  Enable/disable checking
 ##
@@ -277,17 +272,14 @@ AC_ARG_ENABLE(debug,
       yes)
         AC_MSG_RESULT(yes)
         AC_DEFINE(SILC_DEBUG)
-        CFLAGS="-O -g $CFLAGS"
        summary_debug="yes"
         ;;
       *)
         AC_MSG_RESULT(no)
-        CFLAGS="-O2 -g $CFLAGS"
         ;;
     esac
   ],
   [
-    CFLAGS="-O2 -g $CFLAGS"
     AC_MSG_RESULT(no)
   ])
 
@@ -327,6 +319,72 @@ AC_ARG_ENABLE(asm,
   ])
 
 
+##
+## Compiler and compiler flag checks
+##
+
+# 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
+])
+
+if test "$GCC"; then
+  # GCC specific options
+  if test "x$summary_debug" = "xyes"; then
+    SILC_ADD_CFLAGS(-g -O)
+  else
+    SILC_ADD_CFLAGS(-g -O2)
+  fi
+  SILC_ADD_CFLAGS(-Wall -finline-functions)
+else
+  # Other compilers
+  case "$target" in
+    alpha*-dec-osf*)
+      SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
+      ;;
+    *)
+      SILC_ADD_CFLAGS(-g)
+      SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
+      ;;
+  esac
+
+  # Intel C++ Compiler needs -restrict
+  if test "x$CC" = "xicc"; then
+    SILC_ADD_CFLAGS(-restrict)
+  fi
+fi
+
+#
+# Workaround a bug in GCC 2.x which causes memory exhaustion
+# when compiling sha1 with optimizations on UltraSPARC.
+#
+FIX_SHA1='#'
+if test "$GCC" -a "$host_cpu" = "sparc64"; then
+  AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1)
+  AC_TRY_COMPILE(
+    [
+      #if defined(__sparc64__) && (__GNUC__ == 2)
+      #else
+      choke me
+      #endif
+    ],
+    [],
+    [
+      FIX_SHA1=''
+      AC_MSG_RESULT(yes)
+    ],
+      AC_MSG_RESULT(no)
+    )
+fi
+AC_SUBST(FIX_SHA1)
+
 ##
 ##  Installation
 ##
@@ -942,7 +1000,7 @@ fi
 #
 AC_MSG_CHECKING(whether to compile native WIN32 code)
 AC_ARG_WITH(win32,
-  [  --with-win32            compile native WIN32 code (-mno-cygwin)],
+  [  --with-win32            compile native WIN32 (MinGW) code (-mno-cygwin)],
   [
     AC_MSG_RESULT(yes)
     AC_DEFINE(SILC_WIN32)
@@ -997,6 +1055,13 @@ AC_ARG_WITH(silcd,
     AC_MSG_RESULT(yes)
   ])
 
+# Irssi perl support
+#
+AC_ARG_WITH(perl,
+  [[  --with-perl[=yes|no|module]  Build with Perl support - also specifies
+                               if it should be built into main silc binary
+                               (static, default) or as a module]])
+
 libtoolfix=true
 AC_MSG_CHECKING(whether to do libtoolfix)
 AC_ARG_WITH(libtoolfix,
@@ -1141,6 +1206,7 @@ echo ""
 echo " Installation prefix ...........: $prefix"
 echo " bin directory .................: $s_bindir"
 echo " sbin directory ................: $s_sbindir"
+echo " etc directory .................: $ETCDIR"
 echo " man directory .................: $s_mandir"
 echo " help directory ................: $HELPDIR"
 echo " doc directory .................: $DOCDIR"
@@ -1174,8 +1240,14 @@ if test x$sim_support = xfalse; then
 else
   sim_support="yes"
 fi
+if test x$has_iconv = xfalse; then
+  iconv_support="no"
+else
+  iconv_support="yes"
+fi
 echo " SIM support ...................: $sim_support"
 echo " IPv6 support ..................: $summary_ipv6"
+echo " Iconv support .................: $iconv_support"
 echo " Assembler optimizations .......: $summary_asm"
 
 mp="MPI"