|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Patch: Add configure options to force using system librariesHi,
attached is a patch which adds configure options to force using system libraries for some of Ghostscript's dependencies. This is done to make it easier for package maintainers of Linux distributions to use the system's shipped libraries. The new options are: --with-system-zlib --with-system-libjpeg --with-system-libpng The corresponding --without-* options are also available, in which case the use of the local (in-source) versions of the libs are used. There is also a new default behavior when the options are not given: Whichever library (system or local) is newer will be used, according to the version numbers in the respective header files. Except for libjpeg, which still defaults to using the local version because of the MAX_BLOCKS_IN_MCU patch. Hope you like it ;) Lars [system-libs.patch] Index: base/configure.ac =================================================================== --- base/configure.ac (revision 10092) +++ base/configure.ac (working copy) @@ -322,35 +322,60 @@ AC_CHECK_LIB(dl, dlopen) + +AC_ARG_WITH([system-libjpeg], AC_HELP_STRING([--with-system-libjpeg], + [Force using the system's libjpeg]), + [], [with_system_libjpeg=check]) + AC_MSG_CHECKING([for local jpeg library source]) -dnl At present, we give the local source priority over the shared -dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied. -dnl A more sophisticated approach would be to test the shared lib -dnl to see whether it has already been patched. -LIBJPEGDIR=src if test -f jpeg/jpeglib.h; then AC_MSG_RESULT([jpeg]) - SHARE_LIBJPEG=0 LIBJPEGDIR=jpeg elif test -f jpeg-6b/jpeglib.h; then AC_MSG_RESULT([jpeg-6b]) - SHARE_LIBJPEG=0 LIBJPEGDIR=jpeg-6b else AC_MSG_RESULT([no]) - AC_CHECK_LIB(jpeg, jpeg_set_defaults, [ - AC_CHECK_HEADERS([jpeglib.h], [SHARE_LIBJPEG=1]) - ]) fi -if test -z "$SHARE_LIBJPEG"; then - AC_MSG_ERROR([I wasn't able to find a copy - of the jpeg library. This is required for compiling - ghostscript. Please download a copy of the source, - e.g. from http://www.ijg.org/, unpack it at the - top level of the gs source tree, and rename - the directory to 'jpeg'. - ]) -fi + +case "x$with_system_libjpeg" in + xcheck) + dnl At present, we give the local source priority over the shared + dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied. + dnl A more sophisticated approach would be to test the shared lib + dnl to see whether it has already been patched. + AC_CHECK_LIB(jpeg, jpeg_set_defaults, [AC_CHECK_HEADERS([jpeglib.h], [HAVE_SYSTEM_LIBJPEG=1])]) + if test ! -z $LIBJPEGDIR; then + SHARE_LIBJPEG=0 + elif test "x$HAVE_SYSTEM_LIBJPEG" != x; then + SHARE_LIBJPEG=1 + else + AC_MSG_ERROR([I wasn't able to find a copy of the jpeg library. +This is required for compiling ghostscript. Please download a copy of the +source, e.g. from http://www.ijg.org/, unpack it at the top level of the gs +source tree, and rename the directory to 'jpeg'.]) + fi + ;; + xyes) + AC_CHECK_LIB(jpeg, jpeg_set_defaults, [AC_CHECK_HEADERS([jpeglib.h], [HAVE_SYSTEM_LIBJPEG=1])]) + if test "x$HAVE_SYSTEM_LIBJPEG" != x; then + SHARE_LIBJPEG=1 + else + AC_MSG_ERROR([Could not find libjpeg on your system. Please either +install it, or call configure with --without-system-libjpeg to use the local +version.]) + fi + ;; + xno) + if test ! -z $LIBJPEGDIR; then + SHARE_LIBJPEG=0 + else + AC_MSG_ERROR([Could not find local copy of libjpeg. Please unpack a +copy in a local directory named jpeg, or call configure with +--with-system-libjpeg to use the system's version.]) + fi + ;; +esac AC_SUBST(SHARE_LIBJPEG) AC_SUBST(LIBJPEGDIR) dnl check for the internal jpeg memory header @@ -365,57 +390,122 @@ dnl these are technically optional -AC_MSG_CHECKING([for local zlib source]) + dnl zlib is needed for language level 3, and libpng # we must define ZLIBDIR regardless because libpng.mak does a -I$(ZLIBDIR) # this seems a harmless default -ZLIBDIR=src -if test -d zlib; then - AC_MSG_RESULT([yes]) - SHARE_ZLIB=0 - ZLIBDIR=zlib -else - AC_MSG_RESULT([no]) - AC_CHECK_LIB(z, deflate, [ - AC_CHECK_HEADERS(zlib.h, [SHARE_ZLIB=1]) - ]) -fi -if test -z "$SHARE_ZLIB"; then - AC_MSG_ERROR([I did not find a copy of zlib on your system. - Please either install it, or unpack a copy of the source in a - local directory named 'zlib'. See http://www.gzip.org/zlib/ - for more information. - ]) -fi +AC_ARG_WITH([system-zlib], AC_HELP_STRING([--with-system-zlib], + [Force using the system's zlib]), + [], [with_system_zlib=check]) +case "x$with_system_zlib" in + xcheck) + AC_CHECK_LIB(z, deflate, [AC_CHECK_HEADERS(zlib.h, [HAVE_SYSTEM_ZLIB=1])]) + if test "x$HAVE_SYSTEM_ZLIB" != x; then + SYSTEM_ZLIB_VERSION=`sed -n -r 's/^#define ZLIB_VERSION \"(.*)\"/\1/p' /usr/include/zlib.h` + fi + if test -d zlib; then + ZLIBDIR=zlib + LOCAL_ZLIB_VERSION=`sed -n -r 's/^#define ZLIB_VERSION \"(.*)\"/\1/p' $ZLIBDIR/zlib.h` + fi + if test -z $LOCAL_ZLIB_VERSION && test -z $SYSTEM_ZLIB_VERSION; then + AC_MSG_ERROR([Could not find a copy of zlib on your system. +Please either install it, or unpack a copy of the source in a local directory +named 'zlib'. See http://www.gzip.org/zlib/ for more information.]) + else + AS_VERSION_COMPARE($SYSTEM_ZLIB_VERSION, $LOCAL_ZLIB_VERSION, + [SHARE_ZLIB=0], + [SHARE_ZLIB=1], + [SHARE_ZLIB=1]) + fi + ;; + xyes) + AC_CHECK_LIB(z, deflate, [AC_CHECK_HEADERS(zlib.h, [HAVE_SYSTEM_ZLIB=1])]) + if test "x$HAVE_SYSTEM_ZLIB" != x; then + SHARE_ZLIB=1 + else + AC_MSG_ERROR([Could not find zlib on your system. Please either +install it, or call configure with --without-system-zlib to use the local +version.]) + fi + ;; + xno) + AC_MSG_CHECKING([for local zlib source]) + if test -d zlib; then + AC_MSG_RESULT([yes]) + ZLIBDIR=zlib + SHARE_ZLIB=0 + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Could not find local copy of zlib. Please unpack a +copy in a local directory named zlib, or call configure with --with-system-zlib +to use the system's version.]) + fi + ;; +esac AC_SUBST(SHARE_ZLIB) AC_SUBST(ZLIBDIR) + dnl png for the png output device; it also requires zlib -LIBPNGDIR=src +AC_ARG_WITH([system-libpng], AC_HELP_STRING([--with-system-libpng], + [Force using the system's libpng]), + [], [with_system_libpng=check]) PNGDEVS='' PNGDEVS_ALL='$(DD)png48.dev $(DD)png16m.dev $(DD)pnggray.dev $(DD)pngmono.dev $(DD)png256.dev $(DD)png16.dev $(DD)pngalpha.dev' -AC_MSG_CHECKING([for local png library source]) -if test -f libpng/pngread.c; then - AC_MSG_RESULT([yes]) - SHARE_LIBPNG=0 - LIBPNGDIR=libpng - PNGDEVS="$PNGDEVS_ALL" -else - AC_MSG_RESULT([no]) - AC_CHECK_LIB(png, png_check_sig, [ - AC_CHECK_HEADERS(png.h, [ - SHARE_LIBPNG=1 - PNGDEVS="$PNGDEVS_ALL" - ], [SHARE_LIBPNG=0]) - ], [SHARE_LIBPNG=0], [-lz]) -fi -if test -z "$PNGDEVS"; then - AC_MSG_NOTICE([disabling png output devices]) -fi +case "x$with_system_libpng" in + xcheck) + AC_CHECK_LIB(png, png_check_sig, + [AC_CHECK_HEADERS(png.h, [HAVE_SYSTEM_LIBPNG=1])], + [], [-lz]) + if test "x$HAVE_SYSTEM_LIBPNG" != x; then + SYSTEM_LIBPNG_VERSION=`sed -n -r 's/^#define PNG_LIBPNG_VER_STRING\s+\"(.*)\"/\1/p' /usr/include/png.h` + fi + if test -d libpng; then + LIBPNGDIR=libpng + LOCAL_LIBPNG_VERSION=`sed -n -r 's/^#define PNG_LIBPNG_VER_STRING\s+\"(.*)\"/\1/p' $LIBPNGDIR/png.h` + fi + if test -z $LOCAL_LIBPNG_VERSION && test -z $SYSTEM_LIBPNG_VERSION; then + AC_MSG_NOTICE([Could not find a copy of libpng on your system. +Disabling png output devices.]) + else + PNGDEVS="$PNGDEVS_ALL" + AS_VERSION_COMPARE($SYSTEM_LIBPNG_VERSION, $LOCAL_LIBPNG_VERSION, + [SHARE_LIBPNG=0], + [SHARE_LIBPNG=1], + [SHARE_LIBPNG=1]) + fi + ;; + xyes) + AC_CHECK_LIB(png, png_check_sig, + [AC_CHECK_HEADERS(png.h, [HAVE_SYSTEM_LIBPNG=1])], + [], [-lz]) + if test "x$HAVE_SYSTEM_LIBPNG" != x; then + SHARE_LIBPNG=1 + PNGDEVS="$PNGDEVS_ALL" + else + AC_MSG_NOTICE([Could not find a copy of libpng on your system. +Disabling png output devices.]) + fi + ;; + xno) + AC_MSG_CHECKING([for local libpng source]) + if test -d libpng; then + AC_MSG_RESULT([yes]) + LIBPNGDIR=libpng + SHARE_LIBPNG=0 + PNGDEVS="$PNGDEVS_ALL" + else + AC_MSG_RESULT([no]) + AC_MSG_NOTICE([Could not find local copy of libpng. +Disabling png output devices.]) + fi + ;; +esac AC_SUBST(SHARE_LIBPNG) AC_SUBST(LIBPNGDIR) AC_SUBST(PNGDEVS) + dnl look for CUPS... AC_ARG_ENABLE([cups], AC_HELP_STRING([--disable-cups], [Don't include CUPS support])) _______________________________________________ gs-devel mailing list gs-devel@... http://www.ghostscript.com/mailman/listinfo/gs-devel |
|
|
Re: Patch: Add configure options to force using system librariesHi,
attached is a new version of the patch. It doesn't assume that the system headers are in /usr/include anymore. Lars [system-libs.patch] Index: base/configure.ac =================================================================== --- base/configure.ac (revision 10101) +++ base/configure.ac (working copy) @@ -322,35 +322,60 @@ AC_CHECK_LIB(dl, dlopen) + +AC_ARG_WITH([system-libjpeg], AC_HELP_STRING([--with-system-libjpeg], + [Force using the system's libjpeg]), + [], [with_system_libjpeg=check]) + AC_MSG_CHECKING([for local jpeg library source]) -dnl At present, we give the local source priority over the shared -dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied. -dnl A more sophisticated approach would be to test the shared lib -dnl to see whether it has already been patched. -LIBJPEGDIR=src if test -f jpeg/jpeglib.h; then AC_MSG_RESULT([jpeg]) - SHARE_LIBJPEG=0 LIBJPEGDIR=jpeg elif test -f jpeg-6b/jpeglib.h; then AC_MSG_RESULT([jpeg-6b]) - SHARE_LIBJPEG=0 LIBJPEGDIR=jpeg-6b else AC_MSG_RESULT([no]) - AC_CHECK_LIB(jpeg, jpeg_set_defaults, [ - AC_CHECK_HEADERS([jpeglib.h], [SHARE_LIBJPEG=1]) - ]) fi -if test -z "$SHARE_LIBJPEG"; then - AC_MSG_ERROR([I wasn't able to find a copy - of the jpeg library. This is required for compiling - ghostscript. Please download a copy of the source, - e.g. from http://www.ijg.org/, unpack it at the - top level of the gs source tree, and rename - the directory to 'jpeg'. - ]) -fi + +case "x$with_system_libjpeg" in + xcheck) + dnl At present, we give the local source priority over the shared + dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied. + dnl A more sophisticated approach would be to test the shared lib + dnl to see whether it has already been patched. + AC_CHECK_LIB(jpeg, jpeg_set_defaults, [AC_CHECK_HEADERS([jpeglib.h], [HAVE_SYSTEM_LIBJPEG=1])]) + if test ! -z $LIBJPEGDIR; then + SHARE_LIBJPEG=0 + elif test "x$HAVE_SYSTEM_LIBJPEG" != x; then + SHARE_LIBJPEG=1 + else + AC_MSG_ERROR([I wasn't able to find a copy of the jpeg library. +This is required for compiling ghostscript. Please download a copy of the +source, e.g. from http://www.ijg.org/, unpack it at the top level of the gs +source tree, and rename the directory to 'jpeg'.]) + fi + ;; + xyes) + AC_CHECK_LIB(jpeg, jpeg_set_defaults, [AC_CHECK_HEADERS([jpeglib.h], [HAVE_SYSTEM_LIBJPEG=1])]) + if test "x$HAVE_SYSTEM_LIBJPEG" != x; then + SHARE_LIBJPEG=1 + else + AC_MSG_ERROR([Could not find libjpeg on your system. Please either +install it, or call configure with --without-system-libjpeg to use the local +version.]) + fi + ;; + xno) + if test ! -z $LIBJPEGDIR; then + SHARE_LIBJPEG=0 + else + AC_MSG_ERROR([Could not find local copy of libjpeg. Please unpack a +copy in a local directory named jpeg, or call configure with +--with-system-libjpeg to use the system's version.]) + fi + ;; +esac AC_SUBST(SHARE_LIBJPEG) AC_SUBST(LIBJPEGDIR) dnl check for the internal jpeg memory header @@ -365,53 +390,118 @@ dnl these are technically optional -AC_MSG_CHECKING([for local zlib source]) + dnl zlib is needed for language level 3, and libpng # we must define ZLIBDIR regardless because libpng.mak does a -I$(ZLIBDIR) # this seems a harmless default -ZLIBDIR=src -if test -d zlib; then - AC_MSG_RESULT([yes]) - SHARE_ZLIB=0 - ZLIBDIR=zlib -else - AC_MSG_RESULT([no]) - AC_CHECK_LIB(z, deflate, [ - AC_CHECK_HEADERS(zlib.h, [SHARE_ZLIB=1]) - ]) -fi -if test -z "$SHARE_ZLIB"; then - AC_MSG_ERROR([I did not find a copy of zlib on your system. - Please either install it, or unpack a copy of the source in a - local directory named 'zlib'. See http://www.gzip.org/zlib/ - for more information. - ]) -fi +AC_ARG_WITH([system-zlib], AC_HELP_STRING([--with-system-zlib], + [Force using the system's zlib]), + [], [with_system_zlib=check]) +case "x$with_system_zlib" in + xcheck) + if test -d zlib; then + ZLIBDIR=zlib + LOCAL_ZLIB_VERNUM=`sed -n -r 's/^#define ZLIB_VERNUM\s+(.*)\s*/\1/p' $ZLIBDIR/zlib.h` + SHARE_ZLIB=0 + fi + AC_CHECK_LIB(z, deflate, [AC_CHECK_HEADERS(zlib.h, [HAVE_SYSTEM_ZLIB=1; SHARE_ZLIB=1])]) + if test -z $LOCAL_ZLIB_VERNUM && test "x$HAVE_SYSTEM_ZLIB" == x; then + AC_MSG_ERROR([Could not find a copy of zlib on your system. +Please either install it, or unpack a copy of the source in a local directory +named 'zlib'. See http://www.gzip.org/zlib/ for more information.]) + fi + if test ! -z $LOCAL_ZLIB_VERNUM && test "x$HAVE_SYSTEM_ZLIB" != x; then + AC_TRY_COMPILE([#include <zlib.h> + #if ZLIB_VERNUM < $LOCAL_ZLIB_VERNUM + #error system zlib is older + #endif], [], + [SHARE_ZLIB=1], [SHARE_ZLIB=0]) + fi + ;; + xyes) + AC_CHECK_LIB(z, deflate, [AC_CHECK_HEADERS(zlib.h, [HAVE_SYSTEM_ZLIB=1])]) + if test "x$HAVE_SYSTEM_ZLIB" != x; then + SHARE_ZLIB=1 + else + AC_MSG_ERROR([Could not find zlib on your system. Please either +install it, or call configure with --without-system-zlib to use the local +version.]) + fi + ;; + xno) + AC_MSG_CHECKING([for local zlib source]) + if test -d zlib; then + AC_MSG_RESULT([yes]) + ZLIBDIR=zlib + SHARE_ZLIB=0 + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Could not find local copy of zlib. Please unpack a +copy in a local directory named zlib, or call configure with --with-system-zlib +to use the system's version.]) + fi + ;; +esac AC_SUBST(SHARE_ZLIB) AC_SUBST(ZLIBDIR) + dnl png for the png output device; it also requires zlib -LIBPNGDIR=src +AC_ARG_WITH([system-libpng], AC_HELP_STRING([--with-system-libpng], + [Force using the system's libpng]), + [], [with_system_libpng=check]) PNGDEVS='' PNGDEVS_ALL='$(DD)png48.dev $(DD)png16m.dev $(DD)pnggray.dev $(DD)pngmono.dev $(DD)png256.dev $(DD)png16.dev $(DD)pngalpha.dev' -AC_MSG_CHECKING([for local png library source]) -if test -f libpng/pngread.c; then - AC_MSG_RESULT([yes]) - SHARE_LIBPNG=0 - LIBPNGDIR=libpng - PNGDEVS="$PNGDEVS_ALL" -else - AC_MSG_RESULT([no]) - AC_CHECK_LIB(png, png_check_sig, [ - AC_CHECK_HEADERS(png.h, [ - SHARE_LIBPNG=1 - PNGDEVS="$PNGDEVS_ALL" - ], [SHARE_LIBPNG=0]) - ], [SHARE_LIBPNG=0], [-lz]) -fi -if test -z "$PNGDEVS"; then - AC_MSG_NOTICE([disabling png output devices]) -fi +case "x$with_system_libpng" in + xcheck) + if test -d libpng; then + LIBPNGDIR=libpng + LOCAL_LIBPNG_VERNUM=`sed -n -r 's/^#define PNG_LIBPNG_VER\s+([0-9]+)\s*.*$$/\1/p' $LIBPNGDIR/png.h` + SHARE_LIBPNG=0 + fi + AC_CHECK_LIB(png, png_check_sig, + [AC_CHECK_HEADERS(png.h, [HAVE_SYSTEM_LIBPNG=1;SHARE_LIBPNG=1])], + [], [-lz]) + if test -z $LOCAL_LIBPNG_VERNUM && test "x$HAVE_SYSTEM_LIBPNG" == x; then + AC_MSG_NOTICE([Could not find a copy of libpng on your system. +Disabling png output devices.]) + else + PNGDEVS="$PNGDEVS_ALL" + fi + if test ! -z $LOCAL_LIBPNG_VERNUM && test "x$HAVE_SYSTEM_LIBPNG" != x; then + AC_TRY_COMPILE([#include <png.h> + #if PNG_LIBPNG_VER < $LOCAL_LIBPNG_VERNUM + #error system libpng is older + #endif], [], + [SHARE_LIBPNG=1], [SHARE_LIBPNG=0]) + fi + ;; + xyes) + AC_CHECK_LIB(png, png_check_sig, + [AC_CHECK_HEADERS(png.h, [HAVE_SYSTEM_LIBPNG=1])], + [], [-lz]) + if test "x$HAVE_SYSTEM_LIBPNG" != x; then + SHARE_LIBPNG=1 + PNGDEVS="$PNGDEVS_ALL" + else + AC_MSG_NOTICE([Could not find a copy of libpng on your system. +Disabling png output devices.]) + fi + ;; + xno) + AC_MSG_CHECKING([for local libpng source]) + if test -d libpng; then + AC_MSG_RESULT([yes]) + LIBPNGDIR=libpng + SHARE_LIBPNG=0 + PNGDEVS="$PNGDEVS_ALL" + else + AC_MSG_RESULT([no]) + AC_MSG_NOTICE([Could not find local copy of libpng. +Disabling png output devices.]) + fi + ;; +esac AC_SUBST(SHARE_LIBPNG) AC_SUBST(LIBPNGDIR) AC_SUBST(PNGDEVS) _______________________________________________ gs-devel mailing list gs-devel@... http://www.ghostscript.com/mailman/listinfo/gs-devel |
| Free embeddable forum powered by Nabble | Forum Help |