fix --with-gmp to correctly handle situation when $withval=yes
authorLubomir Sedlacik <salo@silcnet.org>
Sat, 9 Nov 2002 17:00:27 +0000 (17:00 +0000)
committerLubomir Sedlacik <salo@silcnet.org>
Sat, 9 Nov 2002 17:00:27 +0000 (17:00 +0000)
configure.in.pre

index 2766a7ce4c8821acfba9b38969045fa41070f30f..1dee7247a07cdb6c43e4dbf86cc37acdb6ed8746 100644 (file)
@@ -554,6 +554,8 @@ fi
 # source tree.
 #
 mp_gmp=false
+SAVELIBS="$LIBS"
+SAVECFLAGS="$CFLAGS"
 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]]],
@@ -562,6 +564,10 @@ AC_ARG_WITH(gmp,
       no)
         AC_MSG_RESULT(no)
         ;;
+      yes)
+        AC_MSG_RESULT(yes)
+        LIBS="-lgmp $LIBS"
+        ;;
       *)
         AC_MSG_RESULT(yes)
     
@@ -577,14 +583,19 @@ AC_ARG_WITH(gmp,
         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.)
-          ])
         ;;
     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="$SAVELIBS"
+        CFLAGS="$SAVECFLAGS"
+      ])
   ],
     AC_MSG_RESULT(no)
   )