clarify why --with-gmp exists
[silc.git] / configure.in.pre
index 3940ce84f71a843b0b464954d483f172961e58a9..03da59674eccae12f9578575a7fcd06fc4c54e10 100644 (file)
@@ -308,7 +308,7 @@ AC_ARG_WITH(etcdir,
   [[  --with-etcdir=DIR       directory for system files [/etc/silc]]],
   [
     case "$withval" in
-      no)
+      no|yes)
         ;;
       *)
         ETCDIR="$withval"
@@ -325,7 +325,7 @@ AC_ARG_WITH(helpdir,
   [[  --with-helpdir=DIR      directory for SILC help files [PREFIX/help]]],
   [
     case "$withval" in
-      no)
+      no|yes)
         ;;
       *)
        HELPDIR="$withval"
@@ -342,7 +342,7 @@ AC_ARG_WITH(docdir,
   [[  --with-docdir=DIR       directory for SILC documentation [PREFIX/doc]]],
   [
     case "$withval" in
-      no)
+      no|yes)
         ;;
       *)
         DOCDIR="$withval"
@@ -359,7 +359,7 @@ AC_ARG_WITH(simdir,
   [[  --with-simdir=DIR       directory for SIM modules [PREFIX/modules]]],
   [
     case "$withval" in
-      no)
+      no|yes)
         ;;
       *)
         MODULESDIR="$withval"
@@ -376,7 +376,7 @@ AC_ARG_WITH(logsdir,
   [[  --with-logsdir=DIR      directory for SILC Server logs [PREFIX/logs]]],
   [
     case "$withval" in
-      no)
+      no|yes)
         ;;
       *)
         LOGSDIR="$withval"
@@ -386,6 +386,23 @@ 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"
@@ -409,7 +426,7 @@ AC_ARG_WITH(silcd-pid-file,
                                  Server [/var/run/silcd.pid]]],
   [
     case "$withval" in
-      no)
+      no|yes)
         ;;
       *)
         PIDFILE="$withval"
@@ -425,6 +442,9 @@ AC_SUBST(PIDFILE)
 
 # SOCKS4 support checking
 #
+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]]],
@@ -439,31 +459,34 @@ AC_ARG_WITH(socks4,
     
         if test -d "$withval/include"; then
           CFLAGS="$CFLAGS -I$withval/include"
-        else
-          CFLAGS="$CFLAGS -I$withval"
         fi
         if test -d "$withval/lib"; then
-          withval="-L$withval/lib -lsocks"
-        else
-          withval="-L$withval -lsocks"
+          LDFLAGS="$LDFLAGS -L$withval/lib"
         fi
     
-        LIBS="$withval $LIBS"
-        AC_TRY_LINK([],
-          [
-            Rconnect();
-          ], [],
-          [
-            AC_MSG_ERROR(Could not find SOCKS4 library.)
-          ])
+        LIBS="-lsocks $LIBS"
         ;;
     esac
+
+    AC_TRY_LINK([],
+      [
+        Rconnect();
+      ], [],
+      [
+        AC_MSG_ERROR(Could not find SOCKS4 library.)
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
+      ])
   ],
     AC_MSG_RESULT(no)
   )
 
 # SOCKS5 support checking
 #
+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]]],
@@ -478,25 +501,25 @@ AC_ARG_WITH(socks5,
 
         if test -d "$withval/include"; then
           CFLAGS="$CFLAGS -I$withval/include"
-        else
-          CFLAGS="$CFLAGS -I$withval"
         fi
         if test -d "$withval/lib"; then
-          withval="-L$withval/lib -lsocks5"
-        else
-          withval="-L$withval -lsocks5"
+          LDFLAGS="$LDFLAGS -L$withval/lib"
         fi
 
-        LIBS="$withval $LIBS"
-        AC_TRY_LINK([],
-          [
-            SOCKSconnect();
-          ], [],
-          [
-            AC_MSG_ERROR(Could not find SOCKS5 library.)
-          ])
+        LIBS="-lsocks5 $LIBS"
         ;;
     esac
+
+    AC_TRY_LINK([],
+      [
+        SOCKSconnect();
+      ], [],
+      [
+        AC_MSG_ERROR(Could not find SOCKS5 library.)
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
+      ])
   ],
     AC_MSG_RESULT(no)
   )
@@ -537,6 +560,9 @@ fi
 # source tree.
 #
 mp_gmp=false
+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]]],
@@ -550,24 +576,26 @@ AC_ARG_WITH(gmp,
     
         if test -d "$withval/include"; then
           CFLAGS="$CFLAGS -I$withval/include"
-        else
-          CFLAGS="$CFLAGS -I$withval"
         fi
         if test -d "$withval/lib"; then
-          withval="-L$withval/lib -lgmp"
-        else
-          withval="-L$withval -lgmp"
+          LDFLAGS="$LDFLAGS -L$withval/lib"
         fi
     
-        LIBS="$withval $LIBS"
-        AC_CHECK_LIB(gmp, __gmpz_init,
-          [
-            mp_gmp=true
-            AC_DEFINE(SILC_MP_GMP)
-            AC_MSG_RESULT(Using GMP as a MP library.)
-          ])
+        LIBS="-lgmp $LIBS"
         ;;
     esac
+
+    AC_CHECK_LIB(gmp, __gmpz_init,
+      [
+        mp_gmp=true
+        AC_DEFINE(SILC_MP_GMP)
+        AC_MSG_RESULT(Using GMP as a MP library.)
+      ],
+      [
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
+      ])
   ],
     AC_MSG_RESULT(no)
   )
@@ -583,6 +611,10 @@ fi
 #
 check_iconv=true
 has_iconv=false
+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]]],
@@ -644,24 +676,25 @@ if test x$check_iconv = xtrue; then
         ],
         [
           echo "no"
+          LIBS="$SAVE_LIBS"
+          CFLAGS="$SAVE_CFLAGS"
+          LDFLAGS="$SAVE_LDFLAGS"
+          CPPFLAGS="$SAVE_CPPFLAGS"
         ])
      ])
 fi
 
 if test x$check_iconv = xtrue; then
   # search for iconv library..
-  SAVE_CPPFLAGS="$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
       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"
@@ -695,7 +728,17 @@ if test x$check_iconv = xtrue; then
             [
               echo "no"
               has_iconv=false
+              LIBS="$SAVE_LIBS"    
+              CFLAGS="$SAVE_CFLAGS"
+              LDFLAGS="$SAVE_LDFLAGS"
+              CPPFLAGS="$SAVE_CPPFLAGS"
             ])
+         ],
+         [
+           CFLAGS="$SAVE_CFLAGS"
+           LDFLAGS="$SAVE_LDFLAGS"
+           CPPFLAGS="$SAVE_CPPFLAGS"
          ])
       fi
     done
@@ -766,10 +809,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,
         [
@@ -777,25 +824,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"
@@ -811,7 +853,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
@@ -1010,7 +1064,6 @@ 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 ""
@@ -1026,7 +1079,7 @@ echo ""
 echo " Installation prefix ...........: $prefix"
 echo " bin directory .................: $s_bindir"
 echo " sbin directory ................: $s_sbindir"
-echo " man directory .................: $s_mandir"
+echo " man directory .................: $MANDIR"
 echo " help directory ................: $HELPDIR"
 echo " doc directory .................: $DOCDIR"
 echo " logs directory ................: $LOGSDIR"
@@ -1061,7 +1114,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