[mapserver-commits] r10286 - sandbox/mapserver6

svn at osgeo.org svn at osgeo.org
Tue Jul 6 06:18:57 EDT 2010


Author: tbonfort
Date: 2010-07-06 10:18:57 +0000 (Tue, 06 Jul 2010)
New Revision: 10286

Modified:
   sandbox/mapserver6/Makefile.in
   sandbox/mapserver6/configure.in
Log:
add freetype detection


Modified: sandbox/mapserver6/Makefile.in
===================================================================
--- sandbox/mapserver6/Makefile.in	2010-07-06 06:58:57 UTC (rev 10285)
+++ sandbox/mapserver6/Makefile.in	2010-07-06 10:18:57 UTC (rev 10286)
@@ -81,6 +81,10 @@
 FTGL_LIB=  @FTGL_LIB@
 FTGL_INC=  @FTGL_INC@
 
+#Freetype support
+FT_ENABLE=     @FT_ENABLED@
+FT_LIB=  @FT_LIB@
+FT_INC=  @FT_INC@
 
 #
 # Optional Opengl Support.
@@ -237,7 +241,7 @@
 
 DEFINES = $(IGNORE_MISSING_DATA) $(USE_POINT_Z_M) $(STRINGS) @ALL_ENABLED@ $(FRIBIDI) -DDISABLE_CVSID
 
-INCLUDES = $(REGEX_INC) $(PNG_INC) $(GD_INC) $(AGG_INC) $(OGL_INC) $(FTGL_INC) $(PROJ_INC) $(JPEG_INC) $(EGIS_INC) \
+INCLUDES = $(FT_INC) $(REGEX_INC) $(PNG_INC) $(GD_INC) $(AGG_INC) $(OGL_INC) $(FTGL_INC) $(PROJ_INC) $(JPEG_INC) $(EGIS_INC) \
         $(SDE_INC) $(GDAL_INC) $(POSTGIS_INC) $(MYGIS_INC) \
         $(CURL_INC) $(MING_INC) $(ORACLESPATIAL_INC) $(GEOS_INC) $(ICONV_INC) \
         $(FASTCGI_INC) $(ZLIB_INC) $(XML2_INC) $(FRIBIDI_INC) $(CAIRO_INC)
@@ -248,7 +252,7 @@
 CXXFLAGS = @CXXFLAGS@ $(FLAGS)
 
 # Link flags and shared libs only
-SUP_LIBS =  $(GD_LIB) $(AGG_LIB) $(OGL_LIB) $(FTGL_LIB) $(PROJ_LIBS) \
+SUP_LIBS =  $(FT_LIB) $(GD_LIB) $(AGG_LIB) $(OGL_LIB) $(FTGL_LIB) $(PROJ_LIBS) \
           $(JPEG_LIB) $(PNG_LIB) $(SDE_LIB) $(GDAL_LIB) $(MING_LIB) $(POSTGIS_LIB) \
 	  $(MYGIS_LIB) $(CURL_LIB) $(ORACLESPATIAL_LIB) $(GEOS_LIB) \
 	  $(THREAD_LIB) $(ICONV_LIB) $(FASTCGI_LIB) $(XSLT_LIB) $(EXSLT_LIB) \

Modified: sandbox/mapserver6/configure.in
===================================================================
--- sandbox/mapserver6/configure.in	2010-07-06 06:58:57 UTC (rev 10285)
+++ sandbox/mapserver6/configure.in	2010-07-06 10:18:57 UTC (rev 10286)
@@ -130,54 +130,86 @@
                               path to freetype-config program or install dir).],
     FT_DIR=$withval,FT_DIR='')
 
-AC_EXPAND_PATH($FT_DIR, FT_DIR)
-AC_CHECKING(where FreeType 2.x is installed)
-FT_LIB=''
+FT_LDFLAGS=''
+FT_CFLAGS=''
 FT_BIN=''
-FT_TYPE=''
 
-test -x "$FT_DIR" -a "freetype-config" = "`basename $FT_DIR ''`" && FT_BIN="$FT_DIR"
-test -x "$FT_DIR/freetype-config" && FT_BIN="$FT_DIR/freetype-config"
-test -x "$FT_DIR/bin/freetype-config" && FT_BIN="$FT_DIR/bin/freetype-config"
+if test "x$FT_DIR" = "xno" ; then
+    AC_MSG_ERROR([Freetype support disabled but is now mandatory. Rerun without --without-freetype or --with-freetype=no])
+fi
 
-if test "$with_freetype" = "yes" ; then
- AC_PATH_PROG(FT_BIN, freetype-config, no)
+     
+if test -z "$FT_DIR" -o "$FT_DIR" = "yes" ; then
+    dnl no supplied argument
+    AC_PATH_PROG(FT_BIN, freetype-config, "")
+    if test "x$FT_BIN" = "xno" ; then
+        dnl freetype-config not found, check system locations
+        AC_MSG_CHECKING([for Freetype2.x in system locations])
+        test -f /usr/include/ft2build.h -a -d /usr/include/freetype2 && FT_CFLAGS=-I/usr/include/freetype2
+        test -f /usr/local/include/ft2build.h -a -d /usr/local/include/freetype2 && FT_CFLAGS=-I/usr/local/include -I/usr/local/include/freetype2
+        FT_LDFLAGS="-lfreetype -lz"  
+    dnl else freetype-config found, will test further down
+    fi
+else
+    AC_EXPAND_PATH($FT_DIR, FT_DIR)
+    AC_MSG_CHECKING(for Freetype2.x in $FT_DIR)
+    test -x "$FT_DIR" -a "freetype-config" = "`basename $FT_DIR ''`" && FT_BIN="$FT_DIR"
+    test -x "$FT_DIR/freetype-config" && FT_BIN="$FT_DIR/freetype-config"
+    test -x "$FT_DIR/bin/freetype-config" && FT_BIN="$FT_DIR/bin/freetype-config"
+    if test "x$FT_BIN" = "x"; then
+        test -f $FT_DIR/ft2build.h -a -d $FT_DIR/freetype2 && FT_CFLAGS="-I$FT_DIR -I$FT_DIR/freetype2"
+        test -f $FT_DIR/include/ft2build.h -a -d $FT_DIR/include/freetype2 && FT_CFLAGS="-I$FT_DIR/include -I$FT_DIR/include/freetype2"
+        test -f $FT_DIR/lib/libfreetype.a -o -f $FT_DIR/lib/libfreetype.so -o -f $FT_DIR/lib/libfreetype.sl -o -f $FT_DIR/lib/libfreetype.dylib && FT_LDFLAGS="-L$FT_DIR/lib"
+        test -f $FT_DIR/lib64/libfreetype.a -o -f $FT_DIR/lib64/libfreetype.so -o -f $FT_DIR/lib64/libfreetype.sl && FT_LDFLAGS="-L$FT_DIR/lib64"
+        test -f $FT_DIR/libfreetype.a -o -f $FT_DIR/libfreetype.so -o -f $FT_DIR/libfreetype.sl -o -f $FT_DIR/libfreetype.dylib && FT_LDFLAGS="-L$FT_DIR"
+    dnl else freetype-config found, will test further down
+    fi
 fi
 
-if test -n "$FT_BIN" ; then
-  dnl we have freetype-config program, use its values
-  FT_LIB=`$FT_BIN --libs`
-  FT_LIBDIR="`$FT_BIN --exec-prefix`/lib"
-  AC_MSG_RESULT([        using libfreetype from $FT_LIB])
-  AC_ADD_RUNPATH("$FT_LIBDIR")
-
+if test "x$FT_BIN" = "x" ; then
+    if test -z "$FT_CFLAGS" ; then
+        if test -z "$FT_LDFLAGS"; then
+            AC_MSG_RESULT([trying no compiler flags for freetype2.x])
+        else
+            AC_MSG_RESULT([using $FT_LDFLAGS])
+        fi
+    else
+        if test -z "$FT_LDFLAGS"; then
+            AC_MSG_RESULT([using $FT_CFLAGS])
+        else
+            AC_MSG_RESULT([using $FT_CFLAGS and $FT_LDFLAGS])
+        fi
+    fi
 else
-  dnl try freetype 2.x install lib name
-  test -f $FT_DIR/lib/libfreetype.a -o -f $FT_DIR/lib/libfreetype.so -o -f $FT_DIR/lib/libfreetype.sl -o -f $FT_DIR/lib/libfreetype.dylib && FT_LIBDIR="$FT_DIR/lib"
-  test -f $FT_DIR/lib64/libfreetype.a -o -f $FT_DIR/lib64/libfreetype.so -o -f $FT_DIR/lib64/libfreetype.sl && FT_LIBDIR="$FT_DIR/lib64"
-  test -f $FT_DIR/libfreetype.a -o -f $FT_DIR/libfreetype.so -o -f $FT_DIR/libfreetype.sl -o -f $FT_DIR/libfreetype.dylib && FT_LIBDIR="$FT_DIR"
-
-  if test -n "$FT_LIBDIR" ; then
-     FT_TYPE="-lfreetype"  
-  fi
+        AC_MSG_RESULT([using $FT_BIN])
+        FT_LDFLAGS=`$FT_BIN --libs`
+        FT_CFLAGS=`$FT_BIN --cflags`
+        AC_MSG_RESULT([using $FT_CFLAGS and $FT_LDFLAGS])
 fi
 
-if test -n "$FT_LIBDIR" -a -z "$FT_BIN" ; then
-  FT_LIB="-L$FT_LIBDIR $FT_TYPE"
-  AC_MSG_RESULT([        using libfreetype from $FT_LIB])
-  AC_ADD_RUNPATH("$FT_LIB")
-elif test -z "$FT_LIBDIR" -a -z "$FT_BIN" ; then dnl replaced else by elif
-  dnl check for lib in system libs  
-  AC_CHECK_LIB(freetype, FT_Init_FreeType, FT_LIB="-lfreetype",,)
 
-  if test -n "$FT_LIB" ; then
-    AC_MSG_RESULT([        using libfreetype $FT_LIB from system libs.])
-  else
-    AC_MSG_RESULT([        freetype-config or libfreetype cannot be found, possibly needed for GD])
-  fi
-fi
+_cppflags="$CPPFLAGS"
+_ldflags="$LDFLAGS"
+CPPFLAGS="$FT_CFLAGS $CPPFLAGS"
+LDFLAGS="$FT_LDFLAGS $LDFLAGS"
 
+AC_CHECK_LIB(freetype,FT_Init_FreeType,,
+             AC_MSG_ERROR([unable to link - reconfigure with correct --with-freetype=dir ]))
 
+AC_CHECK_HEADERS(ft2build.h,,
+                 AC_MSG_ERROR([ft2build.h header not found - reconfigure with correct --with-freetype=dir ]))
+
+CPPFLAGS=$_cppflags
+LDFLAGS=$_ldflags
+FT_ENABLED="-DUSE_FREETYPE"
+AC_SUBST(FT_ENABLED,$FT_ENABLED)
+AC_SUBST(FT_INC,$FT_CFLAGS)
+AC_SUBST(FT_LIB,$FT_LDFLAGS)
+ALL_ENABLED="$FT_ENABLED $ALL_ENABLED"
+ALL_INC="$FT_CFLAGS $ALL_INC"
+ALL_LIB="$FT_LDFLAGS $ALL_LIB"
+
+
 dnl ---------------------------------------------------------------------
 dnl Check where zlib is installed (used by libpng and by ZVG compressed output)
 dnl ---------------------------------------------------------------------



More information about the mapserver-commits mailing list