From 7fb3890977b9b71f64db6ce8d1519695aa9d143f Mon Sep 17 00:00:00 2001 From: fedor Date: Mon, 16 Feb 2009 23:23:41 +0000 Subject: [PATCH] Look for location of png.h git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27894 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 + Headers/Additions/GNUstepGUI/config.h.in | 9 +- Source/NSBitmapImageRep+PNG.m | 4 + configure | 142 ++++++++++++++++++++++- configure.ac | 1 + 5 files changed, 157 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49385ba8e..58c507599 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-02-16 Adam Fedor + + * configure.ac: Look for libpng/png.h + * Source/NSBitmapImageRep+PNG.m: Use found loction of png.h + 2009-02-16 Riccardo Mottola * Source/NSCell.m (-setStringValue): Try to fix bugs in last change. diff --git a/Headers/Additions/GNUstepGUI/config.h.in b/Headers/Additions/GNUstepGUI/config.h.in index e3b2adca0..f50e21b24 100644 --- a/Headers/Additions/GNUstepGUI/config.h.in +++ b/Headers/Additions/GNUstepGUI/config.h.in @@ -30,6 +30,9 @@ /* Define to 1 if you have the `gif' library (-lgif). */ #undef HAVE_LIBGIF +/* Define to 1 if you have the `icns' library (-licns). */ +#undef HAVE_LIBICNS + /* Define to 1 if you have the `jpeg' library (-ljpeg). */ #undef HAVE_LIBJPEG @@ -39,15 +42,15 @@ /* Define to 1 if you have the `png' library (-lpng). */ #undef HAVE_LIBPNG +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBPNG_PNG_H + /* Define to 1 if you have the `tiff' library (-ltiff). */ #undef HAVE_LIBTIFF /* Define to 1 if you have the `ungif' library (-lungif). */ #undef HAVE_LIBUNGIF -/* Define to 1 if you have the `icns' library (-licns). */ -#undef HAVE_LIBICNS - /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ diff --git a/Source/NSBitmapImageRep+PNG.m b/Source/NSBitmapImageRep+PNG.m index 59e6761ed..b91d95917 100644 --- a/Source/NSBitmapImageRep+PNG.m +++ b/Source/NSBitmapImageRep+PNG.m @@ -32,7 +32,11 @@ #if HAVE_LIBPNG +#ifdef HAVE_LIBPNG_PNG_H +#include +#else #include +#endif #include #include diff --git a/configure b/configure index d1da1b196..cf39003d8 100755 --- a/configure +++ b/configure @@ -5404,7 +5404,7 @@ if test "$ac_res" != no; then ac_cv_func_getmntent=yes cat >>confdefs.h <<\_ACEOF -#define HAVE_GETMNTENT 1 +#define HAVE_GETMNTENT _ACEOF else @@ -6119,6 +6119,146 @@ _ACEOF fi +for ac_header in libpng/png.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + if test "$ac_cv_lib_png_png_sig_cmp" = no; then echo "GNUstep requires libpng to support PNG images, but this library" echo "can't be found. If you really want to compile GNUstep without" diff --git a/configure.ac b/configure.ac index f3b84ff17..0049e472d 100644 --- a/configure.ac +++ b/configure.ac @@ -236,6 +236,7 @@ AC_ARG_ENABLE(png, if test $enable_png = yes; then AC_CHECK_LIB(png, png_sig_cmp) + AC_CHECK_HEADERS(libpng/png.h) if test "$ac_cv_lib_png_png_sig_cmp" = no; then echo "GNUstep requires libpng to support PNG images, but this library"