fix SOCKS[45] handling when only --with-socks[5] is provided
authorLubomir Sedlacik <salo@silcnet.org>
Sat, 9 Nov 2002 17:38:19 +0000 (17:38 +0000)
committerLubomir Sedlacik <salo@silcnet.org>
Sat, 9 Nov 2002 17:38:19 +0000 (17:38 +0000)
configure.in.pre

index bb35b80edcfc8e9aa912bbb3c6db2e37fcb5bc30..d701746430519fdfb5e7b9b21cc1f3f27d893984 100644 (file)
@@ -442,6 +442,8 @@ AC_SUBST(PIDFILE)
 
 # SOCKS4 support checking
 #
+SAVELIBS="$LIBS"
+SAVECFLAGS="$CFLAGS"
 AC_MSG_CHECKING(whether to support SOCKS4)
 AC_ARG_WITH(socks4,
   [[  --with-socks4[=DIR]     with SOCKS4 support [search in DIR/lib and DIR/include]]],
@@ -450,6 +452,11 @@ 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
@@ -466,21 +473,26 @@ AC_ARG_WITH(socks4,
         fi
     
         LIBS="$withval $LIBS"
-        AC_TRY_LINK([],
-          [
-            Rconnect();
-          ], [],
-          [
-            AC_MSG_ERROR(Could not find SOCKS4 library.)
-          ])
         ;;
     esac
+
+    AC_TRY_LINK([],
+      [
+        Rconnect();
+      ], [],
+      [
+        AC_MSG_ERROR(Could not find SOCKS4 library.)
+        CFLAGS="$SAVECFLAGS"
+        LIBS="$SAVELIBS"
+      ])
   ],
     AC_MSG_RESULT(no)
   )
 
 # SOCKS5 support checking
 #
+SAVELIBS="$LIBS"
+SAVECFLAGS="$CFLAGS"
 AC_MSG_CHECKING(whether to support SOCKS5)
 AC_ARG_WITH(socks5,
   [[  --with-socks5[=DIR]     with SOCKS5 support [search in DIR/lib and DIR/include]]],
@@ -489,6 +501,11 @@ 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
@@ -505,15 +522,18 @@ AC_ARG_WITH(socks5,
         fi
 
         LIBS="$withval $LIBS"
-        AC_TRY_LINK([],
-          [
-            SOCKSconnect();
-          ], [],
-          [
-            AC_MSG_ERROR(Could not find SOCKS5 library.)
-          ])
         ;;
     esac
+
+    AC_TRY_LINK([],
+      [
+        SOCKSconnect();
+      ], [],
+      [
+        AC_MSG_ERROR(Could not find SOCKS5 library.)
+        CFLAGS="$SAVECFLAGS"
+        LIBS="$SAVELIBS"
+      ])
   ],
     AC_MSG_RESULT(no)
   )