[REPATCH] detect libiconv in IRIX ABI paths

James Peach jpeach at sgi.com
Mon Apr 26 00:06:59 GMT 2004


Hi,

Well the last patch I posted for this could be nicely described as
partial. This issue is a little more complicated than I had thought
since IRIX has an implementation of iconv in libc (so the existence test
always succeeds), but that implementation does not do the conversions
that Samba requires.

The attached patch (against 3.0.3rc1) searches both lib/ and lib32/
suffixes and ignores non-existent paths to avoid spurious matches and
tries the ABI patch first (this won't exist on non-IRIX, so will be
ignored). This avoid a problem where headers from GNU libiconv can be
incorrectly matched with the libc iconv.

Tested by myself and Jason Mader.

-- 
James Peach | jpeach at sgi.com | SGI Australian Software Group
I don't speak for SGI.
-------------- next part --------------
diff -r -u samba-3.0.3rc1-orig/source/configure.in samba-3.0.3rc1/source/configure.in
--- samba-3.0.3rc1-orig/source/configure.in	Wed Apr 21 06:42:58 2004
+++ samba-3.0.3rc1/source/configure.in	Fri Apr 23 16:37:10 2004
@@ -1670,31 +1670,37 @@
   fi
 ])
 
-ICONV_FOUND="no"
-libext=""
 for i in $LOOK_DIRS ; do
     save_LIBS=$LIBS
     save_LDFLAGS=$LDFLAGS
     save_CPPFLAGS=$CPPFLAGS
+    ICONV_FOUND="no"
+    unset libext
     CPPFLAGS="$CPPFLAGS -I$i/include"
 dnl This is here to handle -withval stuff for --with-libiconv
 dnl Perhaps we should always add a -L
 
 dnl Check lib and lib32 library variants to cater for IRIX ABI-specific
-dnl installation paths.
-    for l in "lib" "lib32" ; do
-        LDFLAGS="$LDFLAGS -L$i/$l"
-        LIBS=
-        export LDFLAGS LIBS CPPFLAGS
+dnl installation paths. This gets a little tricky since we might have iconv
+dnl in both libiconv and in libc. In this case the jm_ICONV test will always
+dnl succeed when the header is found. To counter this, make sure the 
+dnl library directory is there and check the ABI directory first (which
+dnl should be harmless on other systems.
+    for l in "lib32" "lib" ; do
+        if test -d "$i/$l" ; then
+                LDFLAGS="$save_LDFLAGS -L$i/$l"
+                LIBS=
+                export LDFLAGS LIBS CPPFLAGS
 dnl Try to find iconv(3)
-        jm_ICONV($i)
-        if test "$ICONV_FOUND" = yes; then
-            libext="$l"
-            break;
+                jm_ICONV($i/$l)
+                if test x"$ICONV_FOUND" = "xyes" ; then
+                    libext="$l"
+                    break;
+                fi
         fi
     done
 
-    if test "$ICONV_FOUND" = yes; then
+    if test x"$ICONV_FOUND" = "xyes" ; then
 	LDFLAGS=$save_LDFLAGS
         LIB_ADD_DIR(LDFLAGS, "$i/$libext")
         CFLAGS_ADD_DIR(CPPFLAGS, "$i/include")
@@ -1708,7 +1714,7 @@
         # check for iconv in libc
         ic_save_LIBS="$LIBS"
         if test x"$ICONV_PATH_SPEC" = "xyes" ; then
-           LIBS="$LIBS -L$ICONV_LOCATION/lib"
+           LIBS="$LIBS -L$ICONV_LOCATION/$libext"
         fi
         if test x"$jm_cv_lib_iconv" != x; then
            LIBS="$LIBS -l$jm_cv_lib_iconv"


More information about the samba-technical mailing list