Author: fabien
Date: 2008-11-12 04:48:51 -0800 (Wed, 12 Nov 2008)
New Revision: 6519
Log:
Generalized latest PNG configuration configure code to jpeg and zilb. Also 
warning user now if he asked for system lib (jpeg,z,png) that is not found. 
Seems to work fine under OSX, please review.

Modified:
   branches/branch-1.3/configure.in

Modified: branches/branch-1.3/configure.in
===================================================================
--- branches/branch-1.3/configure.in    2008-11-11 22:31:26 UTC (rev 6518)
+++ branches/branch-1.3/configure.in    2008-11-12 12:48:51 UTC (rev 6519)
@@ -534,47 +534,73 @@
 
 AC_SUBST(IMAGELIBS)
 
-AC_ARG_ENABLE(localjpeg, [  --enable-localjpeg      use local JPEG library, 
default=auto],
-    [if test x$enable_localjpeg = xyes; then
-       ac_cv_lib_jpeg_jpeg_CreateCompress=no
-    fi])
-
-AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
+# Handle the JPEG lib linking mode (use fltk local or system lib)
+# If --enable-(resp. --disable-)localjpeg parameter is not set by user
+# Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
+AC_ARG_ENABLE(localjpeg, [  --enable-localjpeg      use local JPEG library, 
default=auto])
+# Check for System lib use if automatic mode or --disable-localjpeg is 
requested
+sysjpeglib_ok=no
+sysjpeginc_ok=no
+if test x$enable_localjpeg != xyes; then
+    AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
+       [AC_CHECK_HEADER(jpeg.h,
+           sysjpeginc_ok=yes)
+           if test x$sysjpeginc_ok = xyes; then
+               sysjpeglib_ok=yes
+               fi])
+fi
+# Now set the jpeg lib and include flags according to the requested mode and 
availability 
+if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
+    JPEGINC="-I../jpeg"
+    JPEG="jpeg"
+    IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
     AC_DEFINE(HAVE_LIBJPEG)
+    ac_cv_lib_jpeg_jpeg_CreateCompress=no # fc: is it still necessary ?
+    # Finally, warn user if system lib was requested but not found
+    if test x$enable_localjpeg = xno; then
+       AC_MSG_WARN(Cannot find system jpeg lib or header: choosing the local 
lib mode.)
+    fi
+else
     JPEGINC=""
     JPEG=""
     IMAGELIBS="-ljpeg $IMAGELIBS",
-    if test x$enable_localjpeg = xno; then
-       JPEGINC=""
-       JPEG=""
-    else
-       AC_DEFINE(HAVE_LIBJPEG)
-       JPEGINC="-I../jpeg"
-       JPEG="jpeg"
-       IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
-    fi)
+    AC_DEFINE(HAVE_LIBJPEG)
+fi
 
-AC_ARG_ENABLE(localzlib, [  --enable-localzlib      use local ZLIB library, 
default=auto],
-    [if test x$enable_localzlib = xyes; then
-       ac_cv_lib_z_gzgets=no
-    fi])
-
-AC_CHECK_LIB(z,gzgets,
+# Handle the ZLIB lib linking mode (use fltk local or system lib)
+# If --enable-(resp. --disable-)localzlib parameter is not set by user
+# Then we check the ZLIB lib usability, with result in syszlib_ok variable
+AC_ARG_ENABLE(localzlib, [  --enable-localzlib      use local ZLIB library, 
default=auto])
+# Check for System lib use if automatic mode or --disable-localzlib is 
requested
+syszlib_ok=no
+syszinc_ok=no
+if test x$enable_localzlib != xyes; then
+    AC_CHECK_LIB(z,gzgets,
+       [AC_CHECK_HEADER(zlib.h, 
+               syszinc_ok=yes)
+       if test x$syszinc_ok = xyes; then
+           syszlib_ok=yes
+           fi])
+fi
+# Now set the Z lib and include flags according to the requested mode and 
availability 
+if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
+    ZLIBINC="-I../zlib"
+    ZLIB="zlib"
+    LIBS="-lfltk_z $LIBS"
+    IMAGELIBS="-lfltk_z $IMAGELIBS"
     AC_DEFINE(HAVE_LIBZ)
+    ac_cv_lib_z_gzgets=no # fc: is still necessary ?
+    # Finally, warn user if system lib was requested but not found
+    if test x$enable_localzlib = xno; then
+       AC_MSG_WARN(Cannot find system z lib or header: choosing the local lib 
mode.)
+    fi
+else
     ZLIBINC=""
     ZLIB=""
     LIBS="-lz $LIBS"
     IMAGELIBS="-lz $IMAGELIBS",
-    if test x$enable_localzlib = xno; then
-       ZLIBINC=""
-       ZLIB=""
-    else
-        AC_DEFINE(HAVE_LIBZ)
-       ZLIBINC="-I../zlib"
-       ZLIB="zlib"
-       LIBS="-lfltk_z $LIBS"
-       IMAGELIBS="-lfltk_z $IMAGELIBS"
-    fi)
+    AC_DEFINE(HAVE_LIBZ)
+fi
 
 # Handle the PNG lib linking mode (use fltk local or system lib)
 # If --enable-(resp. --disable-)localpng parameter is not set by user
@@ -585,7 +611,7 @@
 # but only, if the builtin lib is not requested
 syspnglib_ok=no
 syspnginc_ok=no
-if test x$enable_localpng != xyes ; then
+if test x$enable_localpng != xyes; then
   AC_CHECK_LIB(png, png_read_info, 
     [AC_CHECK_HEADER(png.h, 
        AC_DEFINE(HAVE_PNG_H)
@@ -607,6 +633,10 @@
     AC_DEFINE(HAVE_PNG_H)
     AC_DEFINE(HAVE_PNG_GET_VALID)
     AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)
+    # Finally, warn user if system lib was requested but not found
+    if test x$enable_localpng = xno; then
+       AC_MSG_WARN(Cannot find system png lib or header: choosing the local 
lib mode.)
+    fi
 else
     PNGINC=""
     PNG=""

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to