fix configure script to avoid polluting LDFLAGS/LIBS/LDADD/...
authorPierre Habouzit <madcoder@debian.org>
Sat, 12 May 2007 11:09:37 +0000 (13:09 +0200)
committerPierre Habouzit <madcoder@debian.org>
Sat, 12 May 2007 11:09:37 +0000 (13:09 +0200)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
configure.ac
tools/Makefile

index 2dc8f14..2c54741 100644 (file)
@@ -63,7 +63,7 @@ AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL",[ Where to find sendmail on y
 dnl ---------------- lua5.1 ----------------
 PKG_CHECK_MODULES(LUA,lua5.1,[
     CPPFLAGS="$CPPFLAGS $LUA_CFLAGS"
-    LDFLAGS="$LDFLAGS $LUA_LIBS"
+    MUTTLIBS="$MUTTLIBS $LUA_LIBS"
 ],[AC_MSG_ERROR([could not find lua5.1])])
 
 dnl ---------------- gpgme ----------------
@@ -102,7 +102,7 @@ main ()
             if test -d $srcdir/../slang; then
                 mutt_cv_slang=$srcdir/../slang/src
                 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
-                LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
+                MUTTLIBS="$MUTTLIBS -L${mutt_cv_slang}/objs"
             else
                 if test -d ${prefix}/include/slang; then
                     CFLAGS="$CFLAGS -I${prefix}/include/slang"
@@ -116,7 +116,7 @@ main ()
             if test -f $withval/src/slang.h; then
                 mutt_cv_slang=$withval/src
                 CFLAGS="$CFLAGS -I${mutt_cv_slang}"
-                LDFLAGS="$LDFLAGS -L${mutt_cv_slang}/objs"
+                MUTTLIBS="$MUTTLIBS -L${mutt_cv_slang}/objs"
             else
                 dnl ---Must be installed somewhere
                 mutt_cv_slang=$withval
@@ -125,7 +125,7 @@ main ()
                 elif test -d $withval/include; then
                         CFLAGS="$CFLAGS -I${withval}/include"
                 fi
-                LDFLAGS="$LDFLAGS -L${withval}/lib"
+                MUTTLIBS="$MUTTLIBS -L${withval}/lib"
             fi
         fi
         AC_MSG_RESULT($mutt_cv_slang)
@@ -146,7 +146,7 @@ main ()
                 mutt_cv_curses=$withval
             fi
             if test x$mutt_cv_curses != x/usr; then
-                LDFLAGS="-L${mutt_cv_curses}/lib $LDFLAGS"
+                MUTTLIBS="-L${mutt_cv_curses}/lib $MUTTLIBS"
                 CPPFLAGS="$CPPFLAGS -I${mutt_cv_curses}/include"
             fi
         ])
@@ -172,14 +172,13 @@ main ()
             [CF_CURSES_LIBS])
         ])
 
-        old_LIBS="$LIBS"
-        LIBS="$LIBS $MUTTLIBS"
+        LIBS="$MUTTLIBS"
         CF_CHECK_FUNCDECLS([#include <${cf_cv_ncurses_header-curses.h}>],
                            [start_color typeahead bkgdset curs_set meta use_default_colors resizeterm])
         if test "$ac_cv_func_decl_start_color" != yes; then
             AC_MSG_ERROR([Your curses library does not supports color.])
         fi
-        LIBS="$old_LIBS"
+        LIBS=""
     ])
 
 AC_CHECK_HEADERS(stdarg.h sys/ioctl.h ioctl.h sysexits.h)
@@ -338,7 +337,8 @@ AM_PATH_LIBGNUTLS(,[
 ])
 
 AC_CHECK_LIB(sasl2, sasl_client_init,,AC_MSG_ERROR([could not find libsasl2]))
-MUTTLIBS="$MUTTLIBS -lsasl2"
+MUTTLIBS="$MUTTLIBS $LIBS"
+LIBS=""
 
 AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn], [Use GNU libidn for domain names]),[
     if test x$with_idn != xno ; then
@@ -347,7 +347,7 @@ AC_ARG_WITH(idn, AC_HELP_STRING([--with-idn], [Use GNU libidn for domain names])
                 AC_MSG_ERROR([libidn is too old, want 0.6 at least])
             fi
             CPPFLAGS="$CPPFLAGS $IDN_CFLAGS"
-            LDFLAGS="$LDFLAGS $IDN_LIBS"
+            MUTTLIBS="$MUTTLIBS $IDN_LIBS"
             AC_DEFINE(HAVE_LIBIDN, 1, [IDN Support])
         ],[AC_MSG_ERROR([could not find libidn])])
     fi
@@ -381,10 +381,7 @@ dnl -- start cache --
 AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching]),
 [if test x$enableval = xyes; then
     AC_DEFINE(USE_HCACHE, 1, [Enable header caching])
-
     OLDCPPFLAGS="$CPPFLAGS"
-    OLDLIBS="$LIBS"
-
     need_md5="yes"
 
     ac_prefer_qdbm=yes
@@ -406,7 +403,7 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
             GDBM_INC="-I$d/include"
             GDBM_LIB="-L$d/lib"
             CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
-            LIBS="$OLDLIBS $GDBM_LIB -lgdbm"
+            LIBS="$MUTTLIBS $GDBM_LIB -lgdbm"
             AC_TRY_LINK([#include <gdbm.h>],[gdbm_open(0,0,0,0,0);],[ac_cv_gdbmopen=yes])
           fi
         done
@@ -440,7 +437,7 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
                         BDB_LIB_DIR="$d/lib/$v"
                         for l in `echo $BDB_VERSIONS`; do
                             CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
-                            LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$l"
+                            LIBS="$MUTTLIBS -L$BDB_LIB_DIR -l$l"
                             AC_TRY_LINK([
                                 #include <stdlib.h>
                                 #include <db.h>
@@ -468,19 +465,20 @@ AC_ARG_ENABLE(hcache, AC_HELP_STRING([--enable-hcache], [Enable header caching])
 
     if test x$ac_qdbm_here = xyes; then
         CPPFLAGS="$OLDCPPFLAGS $QDBM_CFLAGS"
-        LIBS="$OLDLIBS $QDBM_LIBS"
+        MUTTLIBS="$MUTTLIBS $QDBM_LIBS"
         AC_DEFINE(HAVE_QDBM, 1, [QDBM Support])
     elif test x$ac_cv_gdbmopen = xyes; then
         CPPFLAGS="$OLDCPPFLAGS $GDBM_INC"
-        LIBS="$OLDLIBS $GDBM_LIB -lgdbm";
+        MUTTLIBS="$MUTTLIBS $GDBM_LIB -lgdbm";
         AC_DEFINE(HAVE_GDBM, 1, [GDBM Support])
     elif test x$ac_cv_dbcreate = xyes; then
         CPPFLAGS="-I$BDB_INCLUDE_DIR $OLDCPPFLAGS"
-        LIBS="$OLDLIBS -L$BDB_LIB_DIR -l$BDB_LIB"
+        MUTTLIBS="$MUTTLIBS -L$BDB_LIB_DIR -l$BDB_LIB"
         AC_DEFINE(HAVE_DB4, 1, [Sleepycat DB4 Support])
     else
         AC_MSG_ERROR([You need one of: QDBM, GDBM or Sleepycat DB4 for --enable-hcache])
     fi
+    LIBS=""
 fi])
 dnl -- end cache --
 
@@ -514,8 +512,7 @@ else
     dnl (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
     dnl     obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
     AC_CACHE_CHECK([whether this iconv is good enough], mutt_cv_iconv_good,
-                   mutt_save_LIBS="$LIBS"
-                   LIBS="$LIBS $LIBICONV"
+                   LIBS="$LIBICONV"
                    AC_TRY_RUN([
 #include <iconv.h>
 int main()
@@ -536,7 +533,7 @@ changequote([, ])dnl
                    mutt_cv_iconv_good=yes,
                    mutt_cv_iconv_good=no,
                    mutt_cv_iconv_good=yes)
-                   LIBS="$mutt_save_LIBS")
+                   LIBS="")
     if test "$mutt_cv_iconv_good" = no; then
         AC_MSG_ERROR(Try using libiconv instead)
     fi
index 038ee1e..b954231 100644 (file)
@@ -15,5 +15,5 @@ cpkg2c: cpkg2c.mll
        $(if $(shell which ocamlopt),ocamlopt -o $@ str.cmxa,ocamlc -o $@ str.cma) $@.ml
        @$(RM) cpkg2c.ml cpkg2c.c* cpkg2c.o
 
-clean:
+distclean clean:
        $(RM) cpkg2c