* configure.ac: Check for libgif

* Source/NSBitmapImageRep+GIF.m: Support libgif
* Source/NSBitmapImageRem.m: Idem. (Fixes Bug #12362).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20936 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2005-03-21 16:12:02 +00:00
parent d26851fad0
commit bc6d45f6f7
6 changed files with 304 additions and 63 deletions

View file

@ -1,3 +1,9 @@
2005-03-21 Adam Fedor <fedor@gnu.org>
* configure.ac: Check for libgif
* Source/NSBitmapImageRep+GIF.m: Support libgif
* Source/NSBitmapImageRem.m: Idem. (Fixes Bug #12362).
2005-03-19 Adam Fedor <fedor@gnu.org>
* Headers/AppKit/DPSOperators.h, Headers/AppKit/NSGraphics.h:

View file

@ -9,6 +9,9 @@
/* Define to 1 if you have the <audiofile.h> header file. */
#undef HAVE_AUDIOFILE_H
/* Define to 1 if you have the <cups/cups.h> header file. */
#undef HAVE_CUPS_CUPS_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@ -21,6 +24,9 @@
/* Define to 1 if you have the `audiofile' library (-laudiofile). */
#undef HAVE_LIBAUDIOFILE
/* Define to 1 if you have the `gif' library (-lgif). */
#undef HAVE_LIBGIF
/* Define to 1 if you have the `jpeg' library (-ljpeg). */
#undef HAVE_LIBJPEG

View file

@ -28,7 +28,7 @@
#include "config.h"
#include "NSBitmapImageRep+GIF.h"
#if HAVE_LIBUNGIF
#if HAVE_LIBUNGIF || HAVE_LIBGIF
/*
gif_lib.h (4.1.0b1, possibly other versions) uses Object as the name of an
@ -336,7 +336,7 @@ static void gs_gif_init_input_source(gs_gif_input_src *src, NSData *data)
@end
#else /* !HAVE_LIBUNGIF */
#else /* !HAVE_LIBUNGIF || !HAVE_LIBGIF */
@implementation NSBitmapImageRep (GIFReading)
+ (BOOL) _bitmapIsGIF: (NSData *)imageData
@ -351,5 +351,5 @@ static void gs_gif_init_input_source(gs_gif_input_src *src, NSData *data)
}
@end
#endif /* !HAVE_LIBUNGIF */
#endif /* !HAVE_LIBUNGIF || !HAVE_LIBGIF */

View file

@ -133,7 +133,7 @@ static BOOL supports_lzw_compression = NO;
types = [[NSArray alloc] initWithObjects:
@"tiff", @"tif",
@"pnm", @"ppm",
#if HAVE_LIBUNGIF
#if HAVE_LIBUNGIF || HAVE_LIBGIF
@"gif",
#endif
#if HAVE_LIBJPEG

259
configure vendored
View file

@ -852,6 +852,7 @@ Optional Features:
--disable-jpeg Disable JPEG support
--disable-png Disable PNG support
--disable-ungif Disable libungif-based GIF support
--enable-libgif Enable libgif-based GIF support
--disable-gsnd Disable gsnd server
--disable-cups Disable cups printing support
@ -859,12 +860,12 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-x use the X Window System
--with-include-flags=FLAGS specify all include flags at once
--with-library-flags=FLAGS specify all library flags at once
--with-jpeg-library=DIR JPEG library file are in DIR
--with-jpeg-include=DIR JPEG include files are in DIR
--with-tiff-library=DIR TIFF library file are in DIR
--with-tiff-include=DIR TIFF include files are in DIR
--with-ungif-library=DIR UNGIF library file are in DIR
--with-ungif-include=DIR UNGIF include files are in DIR
--with-audiofile-library=DIR AUDIOFILE library file are in DIR
--with-audiofile-include=DIR AUDIOFILE include files are in DIR
@ -4013,6 +4014,35 @@ fi
done
#--------------------------------------------------------------------
# Simple way to add a bunch of paths to the flags
#--------------------------------------------------------------------
# Check whether --with-include-flags or --without-include-flags was given.
if test "${with_include_flags+set}" = set; then
withval="$with_include_flags"
include_flags="$withval"
else
include_flags="no"
fi;
if test ${include_flags} != "no"; then
CPPFLAGS="$CPPFLAGS ${include_flags}"
ADDITIONAL_INCLUDE_DIRS="$ADDITIONAL_INCLUDE_DIRS ${include_flags}"
fi
# Check whether --with-library-flags or --without-library-flags was given.
if test "${with_library_flags+set}" = set; then
withval="$with_library_flags"
library_flags="$withval"
else
library_flags="no"
fi;
if test ${library_flags} != "no"; then
LDFLAGS="$LDFLAGS ${library_flags}"
ADDITIONAL_LIB_DIRS="$ADDITIONAL_LIB_DIRS ${library_flags}"
fi
#--------------------------------------------------------------------
# Find JPEG
#--------------------------------------------------------------------
@ -4997,38 +5027,18 @@ if test "${enable_ungif+set}" = set; then
else
enable_ungif=yes
fi;
# Check whether --with-ungif_library or --without-ungif_library was given.
if test "${with_ungif_library+set}" = set; then
withval="$with_ungif_library"
# Check whether --enable-libgif or --disable-libgif was given.
if test "${enable_libgif+set}" = set; then
enableval="$enable_libgif"
else
with_ungif_library=
fi;
# Check whether --with-ungif_include or --without-ungif_include was given.
if test "${with_ungif_include+set}" = set; then
withval="$with_ungif_include"
else
with_ungif_include=
enable_libgif=no
fi;
if test "${enable_libgif}" = yes; then
enable_ungif=no
fi
if test "${enable_ungif}" = yes; then
orig_CPPFLAGS="${CPPFLAGS}"
orig_LDFLAGS="${LDFLAGS}"
orig_LIBS="${LIBS}"
if test -n "${with_ungif_library}"; then
with_ungif_library="-L$with_ungif_library"
fi
if test -n "${with_ungif_include}"; then
with_ungif_include="-I$with_ungif_include"
fi
CPPFLAGS="${with_ungif_include} ${CPPFLAGS}"
LDFLAGS="${with_ungif_library} ${LDFLAGS}"
echo "$as_me:$LINENO: checking for DGifOpen in -lungif" >&5
echo $ECHO_N "checking for DGifOpen in -lungif... $ECHO_C" >&6
@ -5105,6 +5115,9 @@ fi
if test "${with_x}" != no && test "${ac_cv_lib_ungif_DGifOpen}" = no; then
orig_CPPFLAGS="${CPPFLAGS}"
orig_LDFLAGS="${LDFLAGS}"
orig_LIBS="${LIBS}"
{ echo "$as_me:$LINENO: Checking if ungif is linked against -lX11" >&5
echo "$as_me: Checking if ungif is linked against -lX11" >&6;}
# This implies either that ungif is not installed at all, or that it
@ -5200,12 +5213,190 @@ fi
# ungif.
{ echo "$as_me:$LINENO: -gui will be linked against -lX11 to support ungif images" >&5
echo "$as_me: -gui will be linked against -lX11 to support ungif images" >&6;}
GRAPHIC_CFLAGS="-I${ac_x_includes} ${with_ungif_include} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="-L${ac_x_libraries} ${with_ungif_library} $GRAPHIC_LFLAGS"
GRAPHIC_CFLAGS="-I${ac_x_includes} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="-L${ac_x_libraries} $GRAPHIC_LFLAGS"
fi
fi
fi
if test "${enable_libgif}" = yes; then
echo "$as_me:$LINENO: checking for DGifOpen in -lgif" >&5
echo $ECHO_N "checking for DGifOpen in -lgif... $ECHO_C" >&6
if test "${ac_cv_lib_gif_DGifOpen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lgif $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char DGifOpen ();
int
main ()
{
DGifOpen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 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); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_gif_DGifOpen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_gif_DGifOpen=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_gif_DGifOpen" >&5
echo "${ECHO_T}$ac_cv_lib_gif_DGifOpen" >&6
if test $ac_cv_lib_gif_DGifOpen = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBGIF 1
_ACEOF
LIBS="-lgif $LIBS"
fi
if test "${with_x}" != no && test "${ac_cv_lib_gif_DGifOpen}" = no; then
orig_CPPFLAGS="${CPPFLAGS}"
orig_LDFLAGS="${LDFLAGS}"
orig_LIBS="${LIBS}"
{ echo "$as_me:$LINENO: Checking if libgif is linked against -lX11" >&5
echo "$as_me: Checking if libgif is linked against -lX11" >&6;}
# This implies either that libgif is not installed at all, or that it
# explicitly refers to the symbols defined in X11. Now see if the latter
# is the case.
CPPFLAGS="${CPPFLAGS} -I${ac_x_includes}"
LDFLAGS="${LDFLAGS} -L${ac_x_libraries}"
LIBS="${LIBS} -lX11"
echo "$as_me:$LINENO: checking for DGifCloseFile in -lgif" >&5
echo $ECHO_N "checking for DGifCloseFile in -lgif... $ECHO_C" >&6
if test "${ac_cv_lib_gif_DGifCloseFile+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lgif $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char DGifCloseFile ();
int
main ()
{
DGifCloseFile ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 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); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_gif_DGifCloseFile=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_gif_DGifCloseFile=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_gif_DGifCloseFile" >&5
echo "${ECHO_T}$ac_cv_lib_gif_DGifCloseFile" >&6
if test $ac_cv_lib_gif_DGifCloseFile = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBGIF 1
_ACEOF
LIBS="-lgif $LIBS"
fi
if test "${ac_cv_lib_gif_DGifCloseFile}" = no; then
# This indicates libgif is not installed at all. The flags reverts to
# the orignal value.
CPPFLAGS="${orig_CPPFLAGS}"
LDFLAGS="${orig_LDFLAGS}"
LIBS="${orig_LIBS}"
else
# This indicates libgif actually refers to the X11's symbols. We modify
# the flags so that -gui gets linked against the X11 library to support
# libgif.
{ echo "$as_me:$LINENO: -gui will be linked against -lX11 to support libgif images" >&5
echo "$as_me: -gui will be linked against -lX11 to support libgif images" >&6;}
GRAPHIC_CFLAGS="-I${ac_x_includes} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="-L${ac_x_libraries} $GRAPHIC_LFLAGS"
fi
else
GRAPHIC_CFLAGS="${with_ungif_include} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="${with_ungif_library} $GRAPHIC_LFLAGS"
fi
fi

View file

@ -84,6 +84,25 @@ AC_PROG_CPP
AC_CHECK_LIB(m, main)
AC_CHECK_FUNCS(rint rintf)
#--------------------------------------------------------------------
# Simple way to add a bunch of paths to the flags
#--------------------------------------------------------------------
AC_ARG_WITH(include-flags,
[ --with-include-flags=FLAGS specify all include flags at once],
include_flags="$withval", include_flags="no")
if test ${include_flags} != "no"; then
CPPFLAGS="$CPPFLAGS ${include_flags}"
ADDITIONAL_INCLUDE_DIRS="$ADDITIONAL_INCLUDE_DIRS ${include_flags}"
fi
AC_ARG_WITH(library-flags,
[ --with-library-flags=FLAGS specify all library flags at once],
library_flags="$withval", library_flags="no")
if test ${library_flags} != "no"; then
LDFLAGS="$LDFLAGS ${library_flags}"
ADDITIONAL_LIB_DIRS="$ADDITIONAL_LIB_DIRS ${library_flags}"
fi
#--------------------------------------------------------------------
# Find JPEG
#--------------------------------------------------------------------
@ -196,31 +215,20 @@ fi
AC_ARG_ENABLE(ungif,
[ --disable-ungif Disable libungif-based GIF support],,
enable_ungif=yes)
AC_ARG_WITH(ungif_library,
[ --with-ungif-library=DIR UNGIF library file are in DIR], ,
with_ungif_library=)
AC_ARG_WITH(ungif_include,
[ --with-ungif-include=DIR UNGIF include files are in DIR], ,
with_ungif_include=)
AC_ARG_ENABLE(libgif,
[ --enable-libgif Enable libgif-based GIF support],,
enable_libgif=no)
if test "${enable_libgif}" = yes; then
enable_ungif=no
fi
if test "${enable_ungif}" = yes; then
orig_CPPFLAGS="${CPPFLAGS}"
orig_LDFLAGS="${LDFLAGS}"
orig_LIBS="${LIBS}"
if test -n "${with_ungif_library}"; then
with_ungif_library="-L$with_ungif_library"
fi
if test -n "${with_ungif_include}"; then
with_ungif_include="-I$with_ungif_include"
fi
CPPFLAGS="${with_ungif_include} ${CPPFLAGS}"
LDFLAGS="${with_ungif_library} ${LDFLAGS}"
AC_CHECK_LIB(ungif, DGifOpen)
if test "${with_x}" != no && test "${ac_cv_lib_ungif_DGifOpen}" = no; then
orig_CPPFLAGS="${CPPFLAGS}"
orig_LDFLAGS="${LDFLAGS}"
orig_LIBS="${LIBS}"
AC_MSG_NOTICE([Checking if ungif is linked against -lX11])
# This implies either that ungif is not installed at all, or that it
# explicitly refers to the symbols defined in X11. Now see if the latter
@ -241,12 +249,42 @@ if test "${enable_ungif}" = yes; then
# the flags so that -gui gets linked against the X11 library to support
# ungif.
AC_MSG_NOTICE([-gui will be linked against -lX11 to support ungif images])
GRAPHIC_CFLAGS="-I${ac_x_includes} ${with_ungif_include} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="-L${ac_x_libraries} ${with_ungif_library} $GRAPHIC_LFLAGS"
GRAPHIC_CFLAGS="-I${ac_x_includes} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="-L${ac_x_libraries} $GRAPHIC_LFLAGS"
fi
fi
fi
if test "${enable_libgif}" = yes; then
AC_CHECK_LIB(gif, DGifOpen)
if test "${with_x}" != no && test "${ac_cv_lib_gif_DGifOpen}" = no; then
orig_CPPFLAGS="${CPPFLAGS}"
orig_LDFLAGS="${LDFLAGS}"
orig_LIBS="${LIBS}"
AC_MSG_NOTICE([Checking if libgif is linked against -lX11])
# This implies either that libgif is not installed at all, or that it
# explicitly refers to the symbols defined in X11. Now see if the latter
# is the case.
CPPFLAGS="${CPPFLAGS} -I${ac_x_includes}"
LDFLAGS="${LDFLAGS} -L${ac_x_libraries}"
LIBS="${LIBS} -lX11"
AC_CHECK_LIB(gif, DGifCloseFile)
if test "${ac_cv_lib_gif_DGifCloseFile}" = no; then
# This indicates libgif is not installed at all. The flags reverts to
# the orignal value.
CPPFLAGS="${orig_CPPFLAGS}"
LDFLAGS="${orig_LDFLAGS}"
LIBS="${orig_LIBS}"
else
# This indicates libgif actually refers to the X11's symbols. We modify
# the flags so that -gui gets linked against the X11 library to support
# libgif.
AC_MSG_NOTICE([-gui will be linked against -lX11 to support libgif images])
GRAPHIC_CFLAGS="-I${ac_x_includes} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="-L${ac_x_libraries} $GRAPHIC_LFLAGS"
fi
else
GRAPHIC_CFLAGS="${with_ungif_include} $GRAPHIC_CFLAGS"
GRAPHIC_LFLAGS="${with_ungif_library} $GRAPHIC_LFLAGS"
fi
fi