Add check for libpng/png.h as well as png.h, and include the appropriate

one as needed...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2106 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-04-24 18:29:06 +00:00
parent f87f7a7b14
commit 7b99f66d03
7 changed files with 59 additions and 27 deletions

View File

@ -1,5 +1,7 @@
CHANGES IN FLTK 1.1.0rc1
- Updated the PNG library check to support both png.h
and libpng/png.h.
- Fixed a recursion bug in tooltips that was causing
random crashes.
- fl_file_chooser() could cause a segfault when passed a

View File

@ -1,5 +1,5 @@
/*
* "$Id: configh.in,v 1.11.2.11.2.9 2002/03/25 21:56:41 easysw Exp $"
* "$Id: configh.in,v 1.11.2.11.2.10 2002/04/24 18:29:05 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
@ -30,7 +30,6 @@
#define FLTK_DOCDIR ""
/*
* BORDER_WIDTH:
*
@ -196,6 +195,13 @@
#undef HAVE_LIBZ
#undef HAVE_LIBJPEG
/*
* Which header file do we include for libpng?
*/
#undef HAVE_PNG_H
#undef HAVE_LIBPNG_PNG_H
/*
* Do we have the png_xyz() functions?
*/
@ -204,7 +210,6 @@
#undef HAVE_PNG_SET_TRNS_TO_ALPHA
#undef HAVE_PNG_READ_DESTROY
/*
* Do we have POSIX threading?
*/
@ -214,5 +219,5 @@
/*
* End of "$Id: configh.in,v 1.11.2.11.2.9 2002/03/25 21:56:41 easysw Exp $".
* End of "$Id: configh.in,v 1.11.2.11.2.10 2002/04/24 18:29:05 easysw Exp $".
*/

View File

@ -1,7 +1,7 @@
dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf"
dnl
dnl "$Id: configure.in,v 1.33.2.31.2.61 2002/04/16 17:11:11 easysw Exp $"
dnl "$Id: configure.in,v 1.33.2.31.2.62 2002/04/24 18:29:05 easysw Exp $"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
@ -285,12 +285,16 @@ AC_CHECK_HEADER(zlib.h,
IMAGELIBS="$IMAGELIBS -lz"
LIBS="$LIBS -lz"))
AC_CHECK_HEADER(png.h,
AC_CHECK_HEADER(png.h, AC_DEFINE(HAVE_PNG_H))
AC_CHECK_HEADER(libpng/png.h, AC_DEFINE(HAVE_LIBPNG_PNG_H))
if test x$ac_cv_header_png_h = xyes -o x$ac_cv_header_libpng_png_h = xyes; then
AC_CHECK_LIB(png, png_read_rows,
AC_DEFINE(HAVE_LIBPNG)
IMAGELIBS="-lpng $IMAGELIBS"
LIBS="-lpng $LIBS"
AC_CHECK_FUNCS(png_get_valid png_set_tRNS_to_alpha png_read_destroy)))
AC_CHECK_FUNCS(png_get_valid png_set_tRNS_to_alpha png_read_destroy))
fi
dnl Restore original LIBS settings...
LIBS="$SAVELIBS"
@ -720,5 +724,5 @@ dnl Make sure the fltk-config script is executable...
chmod +x fltk-config
dnl
dnl End of "$Id: configure.in,v 1.33.2.31.2.61 2002/04/16 17:11:11 easysw Exp $".
dnl End of "$Id: configure.in,v 1.33.2.31.2.62 2002/04/24 18:29:05 easysw Exp $".
dnl

View File

@ -1,5 +1,5 @@
/*
* "$Id: config.mingw,v 1.1.2.3.2.2 2001/10/19 14:04:08 easysw Exp $"
* "$Id: config.mingw,v 1.1.2.3.2.3 2002/04/24 18:29:05 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
*
@ -29,7 +29,6 @@
#define FLTK_DOCDIR "C:/FLTK/DOC"
/*
* BORDER_WIDTH:
*
@ -173,6 +172,13 @@
#undef HAVE_LIBZ
#undef HAVE_LIBJPEG
/*
* Which header file do we include for libpng?
*/
#undef HAVE_PNG_H
#undef HAVE_LIBPNG_PNG_H
/*
* Do we have the png_xyz() functions?
*/
@ -183,5 +189,5 @@
/*
* End of "$Id: config.mingw,v 1.1.2.3.2.2 2001/10/19 14:04:08 easysw Exp $".
* End of "$Id: config.mingw,v 1.1.2.3.2.3 2002/04/24 18:29:05 easysw Exp $".
*/

View File

@ -1,6 +1,6 @@
/* config.h. Generated automatically by configure. */
/*
* "$Id: config.os2x,v 1.1.2.4.2.4 2002/03/26 18:47:01 easysw Exp $"
* "$Id: config.os2x,v 1.1.2.4.2.5 2002/04/24 18:29:05 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@
@ -31,7 +31,6 @@
#define FLTK_DOCDIR "/usr/local/share/doc/fltk"
/*
* BORDER_WIDTH:
*
@ -197,6 +196,13 @@
#define HAVE_LIBZ 1
#define HAVE_LIBJPEG 1
/*
* Which header file do we include for libpng?
*/
#define HAVE_PNG_H
#undef HAVE_LIBPNG_PNG_H
/*
* Do we have the png_xyz() functions?
*/
@ -205,7 +211,6 @@
/* #undef HAVE_PNG_SET_TRNS_TO_ALPHA */
#define HAVE_PNG_READ_DESTROY 1
/*
* Do we have POSIX threading?
*/
@ -215,5 +220,5 @@
/*
* End of "$Id: config.os2x,v 1.1.2.4.2.4 2002/03/26 18:47:01 easysw Exp $".
* End of "$Id: config.os2x,v 1.1.2.4.2.5 2002/04/24 18:29:05 easysw Exp $".
*/

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_PNG_Image.cxx,v 1.1.2.4 2002/01/01 15:11:31 easysw Exp $"
// "$Id: Fl_PNG_Image.cxx,v 1.1.2.5 2002/04/24 18:29:05 easysw Exp $"
//
// Fl_PNG_Image routines.
//
@ -39,10 +39,14 @@
extern "C"
{
#ifdef HAVE_LIBPNG
#if defined(HAVE_LIBPNG) && defined(HAVE_LIBZ)
# include <zlib.h>
# include <png.h>
#endif // HAVE_LIBPNG
# ifdef HAVE_PNG_H
# include <png.h>
# else
# include <libpng/png.h>
# endif // HAVE_PNG_H
#endif // HAVE_LIBPNG ** HAVE_LIBZ
}
@ -52,7 +56,7 @@ extern "C"
Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
: Fl_RGB_Image(0,0,0) {
#ifdef HAVE_LIBPNG
#if defined(HAVE_LIBPNG) && defined(HAVE_LIBZ)
int i; // Looping var
FILE *fp; // File pointer
int channels; // Number of color channels
@ -97,11 +101,11 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
else if (info->bit_depth == 16)
png_set_strip_16(pp);
#if defined(HAVE_PNG_GET_VALID) && defined(HAVE_SET_TRNS_TO_ALPHA)
# if defined(HAVE_PNG_GET_VALID) && defined(HAVE_SET_TRNS_TO_ALPHA)
// Handle transparency...
if (png_get_valid(pp, info, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(pp);
#endif // HAVE_PNG_GET_VALID && HAVE_SET_TRNS_TO_ALPHA
# endif // HAVE_PNG_GET_VALID && HAVE_SET_TRNS_TO_ALPHA
array = new uchar[w() * h() * d()];
@ -126,10 +130,10 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read
# endif // HAVE_PNG_READ_DESTROY
fclose(fp);
#endif // HAVE_LIBPNG
#endif // HAVE_LIBPNG && HAVE_LIBZ
}
//
// End of "$Id: Fl_PNG_Image.cxx,v 1.1.2.4 2002/01/01 15:11:31 easysw Exp $".
// End of "$Id: Fl_PNG_Image.cxx,v 1.1.2.5 2002/04/24 18:29:05 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
/*
* "$Id: config.h,v 1.5.2.5.2.5 2002/01/01 15:11:33 easysw Exp $"
* "$Id: config.h,v 1.5.2.5.2.6 2002/04/24 18:29:06 easysw Exp $"
*
* Configuration file for the Fast Light Tool Kit (FLTK) for Visual C++.
*
@ -29,7 +29,6 @@
#define FLTK_DOCDIR "C:/FLTK/DOC"
/*
* BORDER_WIDTH:
*
@ -167,6 +166,13 @@
#undef HAVE_LIBZ
#undef HAVE_LIBJPEG
/*
* Which header file do we include for libpng?
*/
#undef HAVE_PNG_H
#undef HAVE_LIBPNG_PNG_H
/*
* Do we have the png_xyz() functions?
*/
@ -176,5 +182,5 @@
/*
* End of "$Id: config.h,v 1.5.2.5.2.5 2002/01/01 15:11:33 easysw Exp $".
* End of "$Id: config.h,v 1.5.2.5.2.6 2002/04/24 18:29:06 easysw Exp $".
*/