clarify why --with-gmp exists
[silc.git] / configure.in.pre
index d701746430519fdfb5e7b9b21cc1f3f27d893984..03da59674eccae12f9578575a7fcd06fc4c54e10 100644 (file)
@@ -442,8 +442,9 @@ AC_SUBST(PIDFILE)
 
 # SOCKS4 support checking
 #
-SAVELIBS="$LIBS"
-SAVECFLAGS="$CFLAGS"
+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]]],
@@ -452,27 +453,18 @@ AC_ARG_WITH(socks4,
       no)
         AC_MSG_RESULT(no)
         ;;
-      yes)
-        AC_MSG_RESULT(yes)
-        socks=4
-        LIBS="-lsocks $LIBS"
-        ;;
       *)
         AC_MSG_RESULT(yes)
         socks=4
     
         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"
+        LIBS="-lsocks $LIBS"
         ;;
     esac
 
@@ -482,8 +474,9 @@ AC_ARG_WITH(socks4,
       ], [],
       [
         AC_MSG_ERROR(Could not find SOCKS4 library.)
-        CFLAGS="$SAVECFLAGS"
-        LIBS="$SAVELIBS"
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
       ])
   ],
     AC_MSG_RESULT(no)
@@ -491,8 +484,9 @@ AC_ARG_WITH(socks4,
 
 # SOCKS5 support checking
 #
-SAVELIBS="$LIBS"
-SAVECFLAGS="$CFLAGS"
+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]]],
@@ -501,27 +495,18 @@ AC_ARG_WITH(socks5,
       no)
         AC_MSG_RESULT(no)
         ;;
-      yes)
-        AC_MSG_RESULT(yes)
-        socks=5
-        LIBS="-lsocks5 $LIBS"
-        ;;
       *)
         AC_MSG_RESULT(yes)
         socks=5
 
         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"
+        LIBS="-lsocks5 $LIBS"
         ;;
     esac
 
@@ -531,8 +516,9 @@ AC_ARG_WITH(socks5,
       ], [],
       [
         AC_MSG_ERROR(Could not find SOCKS5 library.)
-        CFLAGS="$SAVECFLAGS"
-        LIBS="$SAVELIBS"
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
       ])
   ],
     AC_MSG_RESULT(no)
@@ -574,8 +560,9 @@ fi
 # source tree.
 #
 mp_gmp=false
-SAVELIBS="$LIBS"
-SAVECFLAGS="$CFLAGS"
+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]]],
@@ -584,25 +571,17 @@ AC_ARG_WITH(gmp,
       no)
         AC_MSG_RESULT(no)
         ;;
-      yes)
-        AC_MSG_RESULT(yes)
-        LIBS="-lgmp $LIBS"
-        ;;
       *)
         AC_MSG_RESULT(yes)
     
         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"
+        LIBS="-lgmp $LIBS"
         ;;
     esac
 
@@ -613,8 +592,9 @@ AC_ARG_WITH(gmp,
         AC_MSG_RESULT(Using GMP as a MP library.)
       ],
       [
-        LIBS="$SAVELIBS"
-        CFLAGS="$SAVECFLAGS"
+        LIBS="$SAVE_LIBS"
+        CFLAGS="$SAVE_CFLAGS"
+        LDFLAGS="$SAVE_LDFLAGS"
       ])
   ],
     AC_MSG_RESULT(no)
@@ -631,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]]],
@@ -692,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"
@@ -743,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
@@ -814,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,
         [
@@ -825,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"
@@ -859,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
@@ -1108,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