Merged from silc_1_0_branch.
[silc.git] / configure.in.pre
index afb79c9a2b69ed94ca1c8cfe9fe3ff4a1798bed9..671dac894b0f2fabe6e7c1f8ce2c30b203f3873e 100644 (file)
@@ -60,11 +60,54 @@ if test "$GCC"; then
   CFLAGS="-Wall -finline-functions $CFLAGS"
 fi
 
+#
+# Library versioning.
+#
+# Do the releases and library versioning according to following rules:
+#
+#  - If any code has changed in library, increment [LIB]_REVISION
+#  - If functions were added, set [LIB]_REVISION to 0
+#  - If functions were added, removed or changed, increment [LIB]_CURRENT
+#  - If functions were added, increment [LIB]_AGE
+#  - If functions were removed, set [LIB]_AGE to 0
+#
+# where [LIB] is LIBSILC and LIBSILCCLIENT, and where "functions" means
+# functions public interfaces.
+#
+# The LIB_BASE_VERSION defines the SILC software major.minor version and 
+# it is increment only when these version numbers actually change.
+#
+
+# Base version for libraries.  Do not change this unless SILC version
+# changes too.
+LIB_BASE_VERSION=1.0
+
+# libsilc versions
+LIBSILC_CURRENT=1
+LIBSILC_REVISION=0
+LIBSILC_AGE=1
+
+# libsilcclient versions
+LIBSILCCLIENT_CURRENT=1
+LIBSILCCLIENT_REVISION=1
+LIBSILCCLIENT_AGE=0
+
+# Substitute the version numbers
+AC_SUBST(LIB_BASE_VERSION)
+AC_SUBST(LIBSILC_CURRENT)
+AC_SUBST(LIBSILC_REVISION)
+AC_SUBST(LIBSILC_AGE)
+AC_SUBST(LIBSILCCLIENT_CURRENT)
+AC_SUBST(LIBSILCCLIENT_REVISION)
+AC_SUBST(LIBSILCCLIENT_AGE)
+
+#
 # Program checking
 #
 AC_PROG_INSTALL
 AC_PROG_RANLIB
 AC_PROG_MAKE_SET
+AC_DISABLE_SHARED
 AC_PROG_LIBTOOL
 AC_PATH_PROG(sedpath, sed)
 
@@ -132,20 +175,21 @@ sim_support=false
 AC_MSG_CHECKING(for SIM support)
 AC_MSG_RESULT()
 AC_CHECK_HEADERS(dlfcn.h,
-  AC_CHECK_LIB(dl, dlopen,
-    [
-      AC_DEFINE(SILC_SIM)
-      sim_support=true
-      LIBS="$LIBS -ldl"
-    ],
-    [
-      AC_CHECK_LIB(c, dlopen,
-        [
-          AC_DEFINE(SILC_SIM)
-          sim_support=true
-        ])
-    ])
-  )
+  [
+    AC_CHECK_LIB(dl, dlopen,
+      [
+        AC_DEFINE(SILC_SIM)
+        sim_support=true
+        LIBS="$LIBS -ldl"
+      ],
+      [
+        AC_CHECK_LIB(c, dlopen,
+          [
+            AC_DEFINE(SILC_SIM)
+            sim_support=true
+          ])
+      ])
+   ])
 
 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
 if test x$sim_support = xtrue; then
@@ -386,23 +430,6 @@ AC_ARG_WITH(logsdir,
 AC_SUBST(LOGSDIR)
 AC_DEFINE_UNQUOTED(SILC_LOGSDIR, "$LOGSDIR")
 
-# Manual directory
-#
-MANDIR="$silc_prefix/man"
-AC_ARG_WITH(mandir,
-  [[  --with-mandir=DIR       directory for SILC manual pages [PREFIX/man]]],
-  [
-    case "$withval" in
-      no|yes)
-        ;;
-      *)
-        MANDIR="$withval"
-        ;;
-    esac
-  ])
-AC_SUBST(MANDIR)
-AC_DEFINE_UNQUOTED(SILC_MANDIR, "$MANDIR")
-
 # silcd config file checking
 #
 summary_silcd_configfile="/etc/silc/silcd.conf"
@@ -442,9 +469,9 @@ AC_SUBST(PIDFILE)
 
 # SOCKS4 support checking
 #
-SAVELIBS="$LIBS"
-SAVECFLAGS="$CFLAGS"
-SAVELDFLAGS="$LDFLAGS"
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
 AC_MSG_CHECKING(whether to support SOCKS4)
 AC_ARG_WITH(socks4,
   [[  --with-socks4[=DIR]     with SOCKS4 support [search in DIR/lib and DIR/include]]],
@@ -474,9 +501,9 @@ AC_ARG_WITH(socks4,
       ], [],
       [
         AC_MSG_ERROR(Could not find SOCKS4 library.)
-        LIBS="$SAVELIBS"
-        CFLAGS="$SAVECFLAGS"
-        LDFLAGS="$SAVELDFLAGS"
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
       ])
   ],
     AC_MSG_RESULT(no)
@@ -484,9 +511,9 @@ AC_ARG_WITH(socks4,
 
 # SOCKS5 support checking
 #
-SAVELIBS="$LIBS"
-SAVECFLAGS="$CFLAGS"
-SAVELDFLAGS="$LDFLAGS"
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
 AC_MSG_CHECKING(whether to support SOCKS5)
 AC_ARG_WITH(socks5,
   [[  --with-socks5[=DIR]     with SOCKS5 support [search in DIR/lib and DIR/include]]],
@@ -516,9 +543,9 @@ AC_ARG_WITH(socks5,
       ], [],
       [
         AC_MSG_ERROR(Could not find SOCKS5 library.)
-        LIBS="$SAVELIBS"
-        CFLAGS="$SAVECFLAGS"
-        LDFLAGS="$SAVELDFLAGS"
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
       ])
   ],
     AC_MSG_RESULT(no)
@@ -560,9 +587,9 @@ fi
 # source tree.
 #
 mp_gmp=false
-SAVELIBS="$LIBS"
-SAVECFLAGS="$CFLAGS"
-SAVELDFLAGS="$LDFLAGS"
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
 AC_MSG_CHECKING(whether to search for GMP)
 AC_ARG_WITH(gmp,
   [[  --with-gmp[=DIR]        use GMP instead of MPI [search in DIR/lib and DIR/include]]],
@@ -592,9 +619,9 @@ AC_ARG_WITH(gmp,
         AC_MSG_RESULT(Using GMP as a MP library.)
       ],
       [
-        LIBS="$SAVELIBS"
-        CFLAGS="$SAVECFLAGS"
-        LDFLAGS="$SAVELDFLAGS"
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
       ])
   ],
     AC_MSG_RESULT(no)
@@ -611,10 +638,10 @@ fi
 #
 check_iconv=true
 has_iconv=false
-SAVELIBS="$LIBS"
-SAVECFLAGS="$CFLAGS"
-SAVELDFLAGS="$LDFLAGS"
-SAVECPPFLAGS="$CPPFLAGS"
+SAVE_LIBS="$LIBS"
+SAVE_CFLAGS="$CFLAGS"
+SAVE_LDFLAGS="$LDFLAGS"
+SAVE_CPPFLAGS="$CPPFLAGS"
 AC_MSG_CHECKING(whether to implicit search for libiconv)
 AC_ARG_WITH(iconv,
   [[  --with-iconv[=DIR]      use libiconv [search in DIR/include and DIR/lib]]],
@@ -622,13 +649,14 @@ AC_ARG_WITH(iconv,
     case "${withval}" in
       no)
         AC_MSG_RESULT(no)
-
-        AC_CHECK_HEADERS(iconv.h, AC_CHECK_FUNC(iconv, has_iconv=true))
+        AC_CHECK_HEADERS(iconv.h,
+          [
+            AC_CHECK_FUNC(iconv, has_iconv=true)
+          ])
         check_iconv=false
         ;;
       *)
         AC_MSG_RESULT(yes)
-
         if test -d $withval/include; then
           CPPFLAGS="$CPPFLAGS -I$withval/include"
           CFLAGS="$CFLAGS -I$withval/include"
@@ -636,16 +664,19 @@ AC_ARG_WITH(iconv,
         if test -d $withval/lib; then
           LDFLAGS="$LDFLAGS -L$withval/lib"
         fi
+        ;;
     esac
   ],
   [
     AC_MSG_RESULT(no)
-
-    AC_CHECK_HEADERS(iconv.h, AC_CHECK_FUNCS(iconv,
-                                [
-                                  has_iconv=true
-                                  check_iconv=false
-                                 ]))
+    AC_CHECK_HEADERS(iconv.h,
+      [
+        AC_CHECK_FUNCS(iconv,
+          [
+            has_iconv=true
+            check_iconv=false
+          ])
+      ])
   ])
 
 if test x$check_iconv = xtrue; then
@@ -676,20 +707,20 @@ if test x$check_iconv = xtrue; then
         ],
         [
           echo "no"
-          LIBS="$SAVELIBS"
-          CFLAGS="$SAVECFLAGS"
-          LDFLAGS="$SAVELDFLAGS"
-          CPPFLAGS="$SAVECPPFLAGS"
+          LIBS="$SAVE_LIBS"
+          CFLAGS="$SAVE_CFLAGS"
+          LDFLAGS="$SAVE_LDFLAGS"
+          CPPFLAGS="$SAVE_CPPFLAGS"
         ])
      ])
 fi
 
 if test x$check_iconv = xtrue; then
   # search for iconv library..
-  SAVELIBS="$LIBS"
-  SAVECFLAGS="$CFLAGS"
-  SAVELDFLAGS="$LDFLAGS"
-  SAVECPPFLAGS="$CPPFLAGS"
+  SAVE_LIBS="$LIBS"
+  SAVE_CFLAGS="$CFLAGS"
+  SAVE_LDFLAGS="$LDFLAGS"
+  SAVE_CPPFLAGS="$CPPFLAGS"
     
   for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
     if test x$has_iconv = xfalse; then
@@ -729,16 +760,16 @@ if test x$check_iconv = xtrue; then
               echo "no"
               has_iconv=false
  
-              LIBS="$SAVELIBS"    
-              CFLAGS="$SAVECFLAGS"
-              LDFLAGS="$SAVELDFLAGS"
-              CPPFLAGS="$SAVECPPFLAGS"
+              LIBS="$SAVE_LIBS"    
+              CFLAGS="$SAVE_CFLAGS"
+              LDFLAGS="$SAVE_LDFLAGS"
+              CPPFLAGS="$SAVE_CPPFLAGS"
             ])
          ],
          [
-           CFLAGS="$SAVECFLAGS"
-           LDFLAGS="$SAVELDFLAGS"
-           CPPFLAGS="$SAVECPPFLAGS"
+           CFLAGS="$SAVE_CFLAGS"
+           LDFLAGS="$SAVE_LDFLAGS"
+           CPPFLAGS="$SAVE_CPPFLAGS"
          ])
       fi
     done
@@ -809,10 +840,14 @@ AC_ARG_WITH(pthreads,
   ])
 
 if test x$check_threads = xtrue; then
+  SAVE_LIBS="$LIBS"
+  SAVE_CFLAGS="$CFLAGS"
+  SAVE_LDFLAGS="$LDFLAGS"
+  SAVE_CPPFLAGS="$CPPFLAGS"
+  
   AC_MSG_RESULT(yes)
   AC_CHECK_HEADERS(pthread.h,
     [
-      SAVE_LIBS="$LIBS"
       LIBS="$LIBS -lpthread"
       AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
         [
@@ -820,25 +855,20 @@ if test x$check_threads = xtrue; then
           case "${target}" in
             *-*-freebsd*)
               LIBS="$SAVE_LIBS -pthread"
-              AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true)
+              AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
+              ;;
+            *)
+              LIBS="$SAVE_LIBS"
               ;;
           esac
         ])
     ],
     [
       # search for pthread library..
-      SAVE_CPPFLAGS="$CPPFLAGS"
-      SAVE_CFLAGS="$CFLAGS"
-      SAVE_LDFLAGS="$LDFLAGS"
-
       for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
         if test x$has_threads = xfalse; then
           AC_MSG_RESULT(searching in $dir...)
   
-          CPPFLAGS="$SAVE_CPPFLAGS"
-          CFLAGS="$SAVE_CFLAGS"
-          LDFLAGS="$SAVE_LDFLAGS"
-  
           if test -d $dir/include; then
             CPPFLAGS="$CPPFLAGS -I$dir/include"
             CFLAGS="$CFLAGS -I$dir/include"
@@ -854,7 +884,19 @@ if test x$check_threads = xtrue; then
             [ 
               LIBS="$LIBS -lpthread"
               AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
-                                                       has_threads=false)
+                [
+                  has_threads=false
+
+                  LIBS="$SAVE_LIBS"
+                  CFLAGS="$SAVE_CFLAGS"
+                  LDFLAGS="$SAVE_LDFLAGS"
+                  CPPFLAGS="$SAVE_CPPFLAGS"
+                ])
+            ],
+            [
+              CFLAGS="$SAVE_CFLAGS"
+              LDFLAGS="$SAVE_LDFLAGS"
+              CPPFLAGS="$SAVE_CPPFLAGS"
             ])
         fi
       done
@@ -955,6 +997,22 @@ AC_ARG_WITH(silcd,
     AC_MSG_RESULT(yes)
   ])
 
+libtoolfix=true
+AC_MSG_CHECKING(whether to do libtoolfix)
+AC_ARG_WITH(libtoolfix,
+  [  --without-libtoolfix     Do not fix libtool, for package builders],
+  [
+    AC_MSG_RESULT(no)
+    libtoolfix=false
+  ],
+  [
+    AC_MSG_RESULT(yes)
+  ])
+
+AC_SUBST(ETCDIR)
+AC_DEFINE_UNQUOTED(SILC_ETCDIR, "$ETCDIR")
+
+
 
 ##
 ##  Misc
@@ -984,6 +1042,18 @@ INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
 AC_SUBST(INCLUDE_DEFINES_INT)
 AC_SUBST(SILC_DIST_SUBDIRS)
 
+#
+# Fix the libtool to support run-time configuration.  This allows us
+# to in run-time specify when to compile shared/static libraries without
+# need to reconfigure the entire libtool.
+#
+if test x$libtoolfix = xtrue; then
+  ./libtoolfix $SILC_TOP_SRCDIR/ltmain.sh
+fi
+AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
+
+
+#
 # Makefile outputs
 #
 AC_CONFIG_FILES(
@@ -995,7 +1065,9 @@ includes/Makefile
 lib/Makefile
 lib/contrib/Makefile
 lib/silccore/Makefile
+lib/silccore/tests/Makefile
 lib/silccrypt/Makefile
+lib/silccrypt/tests/Makefile
 lib/silcmath/Makefile
 lib/silcmath/mpi/Makefile.defines
 lib/silcmath/mpi/Makefile.defines_int
@@ -1053,6 +1125,7 @@ AC_OUTPUT
 
 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
+s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
 
 echo ""
@@ -1068,7 +1141,7 @@ echo ""
 echo " Installation prefix ...........: $prefix"
 echo " bin directory .................: $s_bindir"
 echo " sbin directory ................: $s_sbindir"
-echo " man directory .................: $MANDIR"
+echo " man directory .................: $s_mandir"
 echo " help directory ................: $HELPDIR"
 echo " doc directory .................: $DOCDIR"
 echo " logs directory ................: $LOGSDIR"
@@ -1089,7 +1162,7 @@ if test "x$silc_dist" = "xsilc-server" ||
    test "x$silc_dist" = "xsilc-toolkit"; then
   silcd="yes"
   if test x$without_silcd = xtrue; then
-    without_silcd="no"
+    silcd="no"
   fi
 echo " Compile SILC Server ...........: $silcd"
 echo " Server configuration file .....: $summary_silcd_configfile"
@@ -1103,7 +1176,7 @@ else
 fi
 echo " SIM support ...................: $sim_support"
 echo " IPv6 support ..................: $summary_ipv6"
-echo " Assmebler optimizations .......: $summary_asm"
+echo " Assembler optimizations .......: $summary_asm"
 
 mp="MPI"
 if test x$mp_gmp = xtrue; then