The external libiconv test in webcit configure was
authorArt Cancro <ajc@citadel.org>
Mon, 11 Feb 2008 18:23:47 +0000 (18:23 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 11 Feb 2008 18:23:47 +0000 (18:23 +0000)
faulty.  It set the -libiconv compiler flag even if no external
libiconv was available.  Fixed this by turning it into an
autoconf builtin test.  Hopefully this fixes FreeBSD.

webcit/configure.ac

index a10a0d9aa98688e1b2f6f1e109769cf85e5bf8cd..4a84bcadf114df7b7271eff455441aad643deed0 100644 (file)
@@ -319,25 +319,21 @@ if test "$ok_nls" != "no"; then
        )
 fi
 
-if test "$ok_iconv" = "no"; then
-       LD_FLAGS_BEFORE=$LDFLAGS
-       LDFLAGS="$LDFLAGS -liconv"
-               AC_TRY_RUN([
-                       #include <iconv.h>
-                       main() {
-                              iconv_t ic = (iconv_t)(-1) ;
-                              ic = iconv_open("UTF-8", "us-ascii");
-                              iconv_close(ic);
-                              exit(0);
-                       }
-                       ],
-                       ok_iconv=yes,
-                       ok_iconv=no
+dnl Check for iconv in external libiconv
+if test "$ok_nls" != "no"; then
+       if test "$ok_nls" == "no" ; then
+               AC_MSG_RESULT(Checking for an external libiconv...)
+               AC_CHECK_HEADER(iconv.h,
+                       [
+                               AC_CHECK_LIB(iconv, iconv_open,
+                                       [
+                                               LIBS="-liconv $LIBS"
+                                               ok_iconv=yes
+                                       ]
+                               )
+                       ]
                )
-               if test "$ok_iconv" != "no"; then
-                  LDFLAGS=$LD_FLAGS_BEFORE 
-                  LIBS="$LIBS -liconv"
-               fi
+       fi
 fi
 
 if test "$ok_iconv" != "no"; then