]> granicus.if.org Git - postgis/commitdiff
Add --with-libiconv argument to configure, to allow third-party iconv libraries to...
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 15 Dec 2009 18:44:09 +0000 (18:44 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 15 Dec 2009 18:44:09 +0000 (18:44 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5004 b70326c6-7e19-0410-871a-916f4a2858ee

configure.ac
loader/Makefile.in
loader/shp2pgsql-gui.c

index 48ca952dd6b02795754b89fcdafaacd54ea8021e..3f57e1b9e9e28006b9a0656ba86bb896d23d32ba 100644 (file)
@@ -189,19 +189,37 @@ dnl Detect iconv if it is installed (used for shp2pgsql encoding conversion
 dnl if available)
 dnl ===========================================================================
 
+ICONV_CFLAGS=""
+ICONV_LDFLAGS=""
+
+AC_ARG_WITH([libiconv], 
+       [AS_HELP_STRING([--with-libiconv=PATH], [specify a path to non-default libiconv installation])], 
+       [LIBICONV_PATH="$withval"], [LIBICONV_PATH=""])
+
+LDFLAGS_SAVE="$LDFLAGS"
+CFLAGS_SAVE="$CFLAGS"
+
+if test "x$LIBICONV_PATH" != "x"; then
+       AC_MSG_RESULT([checking user-specified libiconv location: $LIBICONV_PATH])
+       ICONV_CFLAGS="-I$LIBICONV_PATH/include"
+       ICONV_LDFLAGS="-L$LIBICONV_PATH/lib"
+       LDFLAGS="$ICONV_LDFLAGS $LDFLAGS"
+       CFLAGS="$ICONV_CFLAGS $CFLAGS"
+fi
+
 HAVE_ICONV_H=0
 AC_CHECK_HEADER([iconv.h], [HAVE_ICONV_H=1], [])
 
 dnl If we find the header file, try and link against the library
-if test "x$HAVE_ICONV_H" != "x0"; then
+if test "x$HAVE_ICONV_H" = "x1"; then
        dnl libconv defines iconv_open to libiconv_open, so we'll check that directly
-       AC_CHECK_LIB([iconv], [libiconv_open], [ICONV_LDFLAGS=-liconv HAVE_ICONV=1], [])
+       AC_CHECK_LIB([iconv], [libiconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -liconv" HAVE_ICONV=1], [])
        if test "x$HAVE_ICONV" = "x"; then
                dnl Check for iconv included as part of libc, using iconv_open
-               AC_CHECK_LIB([c], [iconv_open], [ICONV_LDFLAGS=-lc HAVE_ICONV=1], [])
+               AC_CHECK_LIB([c], [iconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -lc" HAVE_ICONV=1], [])
                if test "x$HAVE_ICONV" = "x"; then
                        dnl But it's possible this implementation of libiconv doesn't have a libiconv_* define
-                       AC_CHECK_LIB([iconv], [iconv_open], [ICONV_LDFLAGS=-liconv HAVE_ICONV=1], [])
+                       AC_CHECK_LIB([iconv], [iconv_open], [ICONV_LDFLAGS="$ICONV_LDFLAGS -liconv" HAVE_ICONV=1], [])
                        if test "x$HAVE_ICONV" = "x"; then
                                dnl No iconv library was found; issue a warning to the console
                                AC_MSG_WARN([could not find iconv library: no support for encoding conversion will be included])
@@ -213,6 +231,8 @@ else
        AC_MSG_WARN([could not find iconv.h header: no support for encoding conversion will be included])
 fi
 
+LDFLAGS="$LDFLAGS_SAVE"
+CFLAGS="$CFLAGS_SAVE"
 
 dnl Only define HAVE_ICONV in postgis_config.h if we detect iconv sucessfully
 if test "x$HAVE_ICONV" != "x"; then
@@ -220,6 +240,7 @@ if test "x$HAVE_ICONV" != "x"; then
 fi
 
 AC_SUBST([ICONV_LDFLAGS])
+AC_SUBST([ICONV_CFLAGS])
 
 
 dnl ===========================================================================
@@ -528,7 +549,7 @@ AC_ARG_WITH([gui],
 if test "x$GUI" = "xyes"; then
        AC_MSG_RESULT([GUI: Build requested, checking for dependencies (GKT+2.0)])
        case $host in
-               *apple*)
+               *darwin10.1*)
                        for frmwrk [ in Cairo GLib Gtk ]; do
                                if test -d /Library/Frameworks/${frmwrk}.framework; then
                                        GTK_CFLAGS="$GTK_CFLAGS -I/Library/Frameworks/${frmwrk}.framework/Headers" 
index deaeab013fbc07965f3c092977d70b63f21362b9..17a7466a78f55b0d6e3d4167a82769c7523ea981 100644 (file)
@@ -36,6 +36,7 @@ PGSQL_FE_LDFLAGS=@PGSQL_FE_LDFLAGS@
 
 # iconv flags
 ICONV_LDFLAGS=@ICONV_LDFLAGS@
+ICONV_CFLAGS=@ICONV_CFLAGS@
 
 # liblwgeom
 LIBLWGEOM=../liblwgeom/liblwgeom.a
@@ -64,8 +65,11 @@ gui: $(SHP2PGSQL-GUI) $(SHP2PGSQL-CLI)
 $(LIBLWGEOM):
        make -C ../liblwgeom
 
+shp2pgsql-core.o: shp2pgsql-core.c
+       $(CC) $(CFLAGS) $(ICONV_CFLAGS) -c $<
+
 pgsql2shp.o: pgsql2shp.c
-       $(CC) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $<
+       $(CC) $(CFLAGS) $(ICONV_CFLAGS) $(PGSQL_FE_CPPFLAGS) -c $<
 
 $(PGSQL2SHP): shpopen.o dbfopen.o getopt.o pgsql2shp.o $(LIBLWGEOM) 
        $(CC) $(CFLAGS) $^ $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm -o $@ 
@@ -74,7 +78,7 @@ $(SHP2PGSQL-CLI): stringbuffer.o shpopen.o dbfopen.o getopt.o shp2pgsql-core.o s
        $(CC) $(CFLAGS) $^ -o $@ $(ICONV_LDFLAGS) -lm 
 
 shp2pgsql-gui.o: shp2pgsql-gui.c
-       $(CC) $(PGSQL_FE_CPPFLAGS) $(CFLAGS) $(GTK_CFLAGS) -o $@ -c shp2pgsql-gui.c
+       $(CC) $(CFLAGS) $(PGSQL_FE_CPPFLAGS) $(GTK_CFLAGS) -o $@ -c shp2pgsql-gui.c
 
 $(SHP2PGSQL-GUI): stringbuffer.o shpopen.o dbfopen.o shp2pgsql-core.o shp2pgsql-gui.o $(LIBLWGEOM) 
        $(CC) $(CFLAGS) $^ -o $@ $(GTK_LIBS) $(ICONV_LDFLAGS) $(PGSQL_FE_LDFLAGS) -lm 
index cba9a1313e6934ef9b6e9d57d0a033076d33d48e..5e78630623644f05f3b3b7ce679d22f3109f7697 100644 (file)
@@ -353,7 +353,6 @@ pgui_copy_write(const char *line)
        }
 
        return 1;
-
 }
 
 /*