r15870: Improve detection of iconv - should prevent HAVE_ICONV_H being
authorJelmer Vernooij <jelmer@samba.org>
Wed, 24 May 2006 17:57:54 +0000 (17:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:35 +0000 (14:08 -0500)
defined when the installed iconv library doesn't match our criteria as
well as some other minor fixes.
(This used to be commit 7937932615434a59c84d8a1b81e368f6a5f8e429)

source4/include/system/iconv.h
source4/lib/charset/config.m4

index 96500dbfacd1ffab0399392dd7598d15e734e8ce..d5cbe84d8fe42831e67c3eb649617e3f8ac75a49 100644 (file)
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#ifdef HAVE_NATIVE_ICONV
 #ifdef HAVE_ICONV_H
 #include <iconv.h>
 #endif
 #ifdef HAVE_GICONV_H
 #include <giconv.h>
 #endif
+#endif
 
 /* needed for some systems without iconv. Doesn't really matter
    what error code we use */
index 9fcea97add0dee0b633bdbc197d07a0e1e86a359..2e20f7ab3791d94904a7433fae5e92c5ba16024e 100644 (file)
@@ -1,14 +1,7 @@
 dnl SMB_CHECK_ICONV(action-if-found,action-if-not-found)
 AC_DEFUN(SMB_CHECK_ICONV,[
-  AC_CHECK_HEADERS(iconv.h giconv.h)
-
   AC_TRY_RUN([#include <stdlib.h>
-#ifdef HAVE_GICONV_H
-#include <giconv.h>
-#endif
-#ifdef HAVE_ICONV_H
-#include <iconv.h>
-#endif
+#include <$1>
 
 int main()
 {
@@ -16,29 +9,24 @@ int main()
    if (cd == 0 || cd == (iconv_t)-1) return -1;
    return 0;
 } 
-   ],[$1],[$2])
+   ],[$2],[$3])
 ])
 
 dnl SMB_CHECK_ICONV_DIR(dir,action-if-found,action-if-not-found)
 AC_DEFUN(SMB_CHECK_ICONV_DIR,
 [
-    if test -f "$1/include/iconv.h" -o -f "$1/include/giconv.h"; then
        CPPFLAGS="-I$1/include"
        LDFLAGS="-L$1/lib"
        LIBS=-liconv
 
-       SMB_CHECK_ICONV([$2], 
-       [
-            LIBS=-lgiconv
-            SMB_CHECK_ICONV([$2],[$3])
+       SMB_CHECK_ICONV(iconv.h,[ AC_DEFINE(HAVE_ICONV_H,1,[Whether iconv.h is present]) $2 ], [
+        LIBS=-lgiconv
+        SMB_CHECK_ICONV(giconv.h,[AC_DEFINE(HAVE_GICONV_H,1,[Whether giconv.h is present]) $2],[$3])
        ])
 
        CPPFLAGS=$save_CPPFLAGS
        LDFLAGS=$save_LDFLAGS
        LIBS=$save_LIBS
-    else
-       $2
-    fi
 ])
 
 ICONV_FOUND=no
@@ -61,7 +49,7 @@ AC_ARG_WITH(libiconv,
 ])
 
 if test x$ICONV_FOUND = xno; then
-       SMB_CHECK_ICONV([ICONV_FOUND=yes])
+       SMB_CHECK_ICONV(iconv.h,[ICONV_FOUND=yes])
 fi
 
 for i in $LOOK_DIRS ; do