ref: d113ae2198cca92f0c82f55e1cb792fa66cc6004
parent: 63165e5f84efb734262603fe81633d7d89e18fe8
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Wed Aug 14 12:07:52 EDT 2002
Add a --with-libpng[=prefix] option. This can be used to specify the prefix where libpng is installed (assuming prefix/include, prefix/lib) if it's not on the default search path. It can also be used (as --without-libpng) to explicitely disable the png output option. git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@199 ded80894-8fb9-0310-811b-c03f3676ab4d
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
-AC_REVISION([$Revision: 1.14 $])
+AC_REVISION([$Revision: 1.15 $])
# Checks for programs.
AC_PROG_CC
@@ -14,15 +14,36 @@
AC_PROG_RANLIB
# Checks for libraries.
-dnl libpng requires pow() which may be in libm
-AC_SEARCH_LIBS([pow], [m])
-AC_CHECK_LIB([png], [png_check_sig], [
- AC_CHECK_LIB([z], [deflate], [
- AC_DEFINE(HAVE_LIBPNG, 1, [Define if libpng is available (-lpng)])
- LIBS="$LIBS -lpng -lz"
- AC_LIBOBJ([jbig2_image_png])
+dnl by default we want png support if possible
+AC_ARG_WITH([libpng],
+ AC_HELP_STRING([--with-libpng[=prefix]],
+ [include support for png output (if libpng is available)]),
+ [ac_cv_want_libpng="$withval"], [ac_cv_want_libpng="yes"])
+save_cflags="$CFLAGS"
+save_ldflags="$LDFLAGS"
+have_libpng="no"
+if test "x$ac_cv_want_libpng" != "xno"; then
+ if test "x$ac_cv_want_libpng" != "xyes"; then
+ dnl if it's not yes or no, treat as a prefix
+ CFLAGS="$CFLAGS -I$ac_cv_want_libpng/include"
+ LDFLAGS="$LDFLAGS -L$ac_cv_want_libpng/lib"
+ fi
+ AC_CHECK_LIB([png], [png_check_sig], [
+ dnl libpng requires pow() which may be in libm
+ AC_SEARCH_LIBS([pow], [m])
+ AC_CHECK_LIB([z], [deflate], [
+ AC_DEFINE(HAVE_LIBPNG, 1, [Define if libpng is available (-lpng)])
+ LIBS="$LIBS -lpng -lz"
+ AC_LIBOBJ([jbig2_image_png])
+ have_libpng="yes"
+ ])
])
-])
+fi
+dnl restore (possibly changed) flags if we didn't find working libpng
+if test "x$have_libpng" != "xyes"; then
+ CFLAGS="$save_cflags"
+ LDFLAGS="$save_ldflags"
+fi
# Checks for header files.
AC_HEADER_STDC