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.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6519 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Fabien Costantini 2008-11-12 12:48:51 +00:00
parent 29ff9d8936
commit e458232cc1

View File

@ -534,47 +534,73 @@ IMAGELIBS=""
AC_SUBST(IMAGELIBS) AC_SUBST(IMAGELIBS)
AC_ARG_ENABLE(localjpeg, [ --enable-localjpeg use local JPEG library, default=auto], # Handle the JPEG lib linking mode (use fltk local or system lib)
[if test x$enable_localjpeg = xyes; then # If --enable-(resp. --disable-)localjpeg parameter is not set by user
ac_cv_lib_jpeg_jpeg_CreateCompress=no # Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
fi]) 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
AC_CHECK_LIB(jpeg,jpeg_CreateCompress, 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_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="" JPEGINC=""
JPEG="" JPEG=""
IMAGELIBS="-ljpeg $IMAGELIBS", IMAGELIBS="-ljpeg $IMAGELIBS",
if test x$enable_localjpeg = xno; then AC_DEFINE(HAVE_LIBJPEG)
JPEGINC="" fi
JPEG=""
else
AC_DEFINE(HAVE_LIBJPEG)
JPEGINC="-I../jpeg"
JPEG="jpeg"
IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
fi)
AC_ARG_ENABLE(localzlib, [ --enable-localzlib use local ZLIB library, default=auto], # Handle the ZLIB lib linking mode (use fltk local or system lib)
[if test x$enable_localzlib = xyes; then # If --enable-(resp. --disable-)localzlib parameter is not set by user
ac_cv_lib_z_gzgets=no # Then we check the ZLIB lib usability, with result in syszlib_ok variable
fi]) 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
AC_CHECK_LIB(z,gzgets, 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_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="" ZLIBINC=""
ZLIB="" ZLIB=""
LIBS="-lz $LIBS" LIBS="-lz $LIBS"
IMAGELIBS="-lz $IMAGELIBS", IMAGELIBS="-lz $IMAGELIBS",
if test x$enable_localzlib = xno; then AC_DEFINE(HAVE_LIBZ)
ZLIBINC="" fi
ZLIB=""
else
AC_DEFINE(HAVE_LIBZ)
ZLIBINC="-I../zlib"
ZLIB="zlib"
LIBS="-lfltk_z $LIBS"
IMAGELIBS="-lfltk_z $IMAGELIBS"
fi)
# Handle the PNG lib linking mode (use fltk local or system lib) # Handle the PNG lib linking mode (use fltk local or system lib)
# If --enable-(resp. --disable-)localpng parameter is not set by user # If --enable-(resp. --disable-)localpng parameter is not set by user
@ -585,7 +611,7 @@ AC_ARG_ENABLE(localpng, [ --enable-localpng use local PNG library, defaul
# but only, if the builtin lib is not requested # but only, if the builtin lib is not requested
syspnglib_ok=no syspnglib_ok=no
syspnginc_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_LIB(png, png_read_info,
[AC_CHECK_HEADER(png.h, [AC_CHECK_HEADER(png.h,
AC_DEFINE(HAVE_PNG_H) AC_DEFINE(HAVE_PNG_H)
@ -607,6 +633,10 @@ if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
AC_DEFINE(HAVE_PNG_H) AC_DEFINE(HAVE_PNG_H)
AC_DEFINE(HAVE_PNG_GET_VALID) AC_DEFINE(HAVE_PNG_GET_VALID)
AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA) 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 else
PNGINC="" PNGINC=""
PNG="" PNG=""