diff options
| -rw-r--r-- | configure.in | 94 |
1 files changed, 62 insertions, 32 deletions
diff --git a/configure.in b/configure.in index 7ccc9a056..a80f1d5ee 100644 --- a/configure.in +++ b/configure.in @@ -534,47 +534,73 @@ IMAGELIBS="" 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_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_DEFINE(HAVE_LIBJPEG) +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 @@ AC_ARG_ENABLE(localpng, [ --enable-localpng use local PNG library, defaul # 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 @@ if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then 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="" |
