only build loaders if headres/libs are found - chheck for libs and note them

minimum requirements are jpeg, png and db loaders.


SVN revision: 3415
This commit is contained in:
Carsten Haitzler 2000-09-12 19:30:37 +00:00
parent 1efa0c37ea
commit 74c2136de5
3 changed files with 215 additions and 20 deletions

View File

@ -143,6 +143,201 @@ fi
AC_CHECK_LIB(dl, dlopen, dlopen_libs=-ldl, [
], -ldl)
EXTRA_LIBS="-L/usr/local/lib -L/usr/X11R6/lib"
# Test for libjpeg
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
jpeg_ok=yes,
jpeg_ok=no
AC_MSG_WARN(*** Native JPEG support will not be built (JPEG library not found) ***), $EXTAR_LIBS)
if test "$jpeg_ok" = yes; then
AC_MSG_CHECKING([for jpeglib.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#include <jpeglib.h>],
jpeg_ok=yes,
jpeg_ok=no)
AC_MSG_RESULT($jpeg_ok)
if test "$jpeg_ok" = yes; then
JPEGLIBS="-ljpeg"
else
AC_MSG_WARN(*** Native JPEG support will not be built (JPEG header file not found) ***)
fi
fi
# Test for libpng
AC_CHECK_LIB(png, png_read_info,
png_ok=yes,
png_ok=no
AC_MSG_WARN(*** Native PNG support will not be built (PNG library not found) ***), $EXTRA_LIBS -lz -lm)
if test "$png_ok" = yes; then
AC_MSG_CHECKING([for png.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#include <png.h>],
png_ok=yes,
png_ok=no)
AC_MSG_RESULT($png_ok)
if test "$png_ok" = yes; then
PNGLIBS="-lpng -lz -lm"
else
AC_MSG_WARN(*** Native PNG support will not be built (PNG header file not found) ***)
fi
fi
# Test for libedb
AC_CHECK_LIB(edb, e_db_open,
edb_ok=yes,
edb_ok=no
AC_MSG_WARN(*** Native EDB support will not be built (EDB library not found) ***), $EXTRA_LIBS -lz)
if test "$edb_ok" = yes; then
AC_MSG_CHECKING([for Edb.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#include <Edb.h>],
edb_ok=yes,
edb_ok=no)
AC_MSG_RESULT($edb_ok)
if test "$edb_ok" = yes; then
PNGLIBS="-ledb"
else
AC_MSG_WARN(*** Native EDB support will not be built (EDB header file not found) ***)
fi
fi
# Test for libtiff
AC_CHECK_LIB(tiff, TIFFReadScanline,
tiff_libs="-ltiff"
tiff_ok=yes,
AC_CHECK_LIB(tiff, TIFFWriteScanline,
tiff_libs="-ltiff -ljpeg -lz -lm"
tiff_ok=yes,
AC_CHECK_LIB(tiff34, TIFFFlushData,
tiff_libs="-ltiff -ljpeg -lz -lm"
tiff_ok=yes,
tiff_ok=no
AC_MSG_WARN(*** Native TIFF support will not be built (TIFF library not found) ***),
$EXTRA_LIBS -ljpeg -lz -lm),
$EXTRA_LIBS -ljpeg -lz -lm),
$EXTRA_LIBS)
if test "$tiff_ok" = yes; then
AC_MSG_CHECKING([for tiffio.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#include <tiffio.h>],
tiff_ok=yes,
tiff_ok=no)
AC_MSG_RESULT($tiff_ok)
if test "$tiff_ok" = yes; then
TIFFLIBS=$tiff_libs
else
AC_MSG_WARN(*** Native TIFF support will not be built (TIFF header file not found) ***)
fi
fi
# Test for libungif
AC_CHECK_LIB(ungif, DGifOpenFileName,
gif_libs="-lungif"
gif_ok=yes,
gif_ok=no
$EXTRA_LIBS)
if test "$gif_ok" = yes; then
AC_MSG_CHECKING([for gif_lib.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#include <gif_lib.h>],
gif_ok=yes,
gif_ok=no)
AC_MSG_RESULT($gif_ok)
if test "$gif_ok" = yes; then
GIFLIBS=$gif_libs
fi
fi
# Test for libgif
if test "$gif_ok" = no; then
AC_CHECK_LIB(gif, DGifOpenFileName,
gif_libs="-lgif"
gif_ok=yes,
gif_ok=no
AC_MSG_WARN(*** Native GIF support will not be built (GIF library not found) ***), $EXTRA_LIBS)
if test "$gif_ok" = yes; then
AC_MSG_CHECKING([for gif_lib.h])
AC_TRY_CPP(
[#include <stdio.h>
#undef PACKAGE
#undef VERSION
#include <gif_lib.h>],
gif_ok=yes,
gif_ok=no)
AC_MSG_RESULT($gif_ok)
if test "$gif_ok" = yes; then
GIFLIBS=$gif_libs
else
AC_MSG_WARN(*** Native GIF support will not be built (GIF header file not found) ***)
fi
fi
fi
if test "$jpeg_ok" = no; then
AC_MSG_ERROR([
Fatal Error: No JPEG Headers AND Library detected.
This is a minimum requirement
(at least a JPEG, PNG and DB loader need to be built)
All other loaders are optional])
fi
if test "$png_ok" = no; then
AC_MSG_ERROR([
Fatal Error: No PNG Headers AND Library detected.
This is a minimum requirement
(at least a JPEG, PNG and DB loader need to be built)
All other loaders are optional])
fi
if test "$edb_ok" = no; then
AC_MSG_ERROR([
Fatal Error: No EDB Headers AND Library detected.
This is a minimum requirement
(at least a JPEG, PNG and DB loader need to be built)
All other loaders are optional])
fi
if test "$jpeg_ok" = yes; then
JPEG_LA=loader_jpeg.c
fi
if test "$png_ok" = yes; then
PNG_LA=loader_png.c
fi
if test "$edb_ok" = yes; then
EDB_LA=loader_db.c
fi
if test "$tiff_ok" = yes; then
TIFF_LA=loader_tiff.c
fi
if test "$gif_ok" = yes; then
GIF_LA=loader_gif.c
fi
AC_SUBST(JPEG_LA)
AC_SUBST(PNG_LA)
AC_SUBST(EDB_LA)
AC_SUBST(TIFF_LA)
AC_SUBST(GIF_LA)
AC_SUBST(JPEGLIBS)
AC_SUBST(PNGLIBS)
AC_SUBST(EDBLIBS)
AC_SUBST(TIFFLIBS)
AC_SUBST(GIFLIBS)
AC_SUBST(x_cflags)
AC_SUBST(x_includes)
AC_SUBST(x_ldflags)

View File

@ -117,7 +117,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc README COPYING ChangeLog TODO
%doc README COPYING ChangeLog TODO doc/*
%attr(755,root,root) %{prefix}/lib/lib*.so.*
%attr(755,root,root) %{prefix}/lib/loaders
%{prefix}/bin/*

View File

@ -5,26 +5,34 @@ AUTOMAKE_OPTIONS = 1.4 foreign
# A list of all the files in the current directory which can be regenerated
MAINTAINERCLEANFILES = Makefile.in
LDFLAGS = -L/usr/local/BerkeleyDB/lib -L/usr/X11R6/lib
INCLUDES = -I/usr/local/BerkeleyDB/include -I/usr/X11R6/include -I$(top_srcdir)/libltdl \
LDFLAGS = -L/usr/X11R6/lib
INCLUDES = -I/usr/X11R6/include -I$(top_srcdir)/libltdl \
$(X_CFLAGS) -I$(prefix)/include -I$(includedir) \
-I. -I$(top_srcdir) -I$(top_srcdir)/src \
-I$(top_srcdir)/loaders
pkgdir = $(libdir)/loaders/image
pkg_LTLIBRARIES = png.la jpeg.la gif.la pnm.la argb.la tiff.la bmp.la xpm.la tga.la db.la #xcf.la
pkg_LTLIBRARIES = jpeg.la png.la db.la gif.la tiff.la pnm.la argb.la bmp.la xpm.la tga.la #xcf.la
png_la_SOURCES = loader_png.c
png_la_LDFLAGS = -no-undefined -module -avoid-version
png_la_LIBADD = -lpng -lz
jpeg_la_SOURCES = loader_jpeg.c
jpeg_la_SOURCES = @JPEG_LA@
jpeg_la_LDFLAGS = -no-undefined -module -avoid-version
jpeg_la_LIBADD = -ljpeg
jpeg_la_LIBADD = @JPEGLIBS@
gif_la_SOURCES = loader_gif.c
png_la_SOURCES = @PNG_LA@
png_la_LDFLAGS = -no-undefined -module -avoid-version
png_la_LIBADD = @PNGLIBS@
db_la_SOURCES = @EDB_LA@
db_la_LDFLAGS = -no-undefined -module -avoid-version
db_la_LIBADD = @EDBLIBS@ -lz
tiff_la_SOURCES = @TIFF_LA@
tiff_la_LDFLAGS = -no-undefined -module -avoid-version
tiff_la_LIBADD = @TIFFLIBS@
gif_la_SOURCES = @GIF_LA@
gif_la_LDFLAGS = -no-undefined -module -avoid-version
gif_la_LIBADD = -lgif
gif_la_LIBADD = @GIFLIBS@
pnm_la_SOURCES = loader_pnm.c
pnm_la_LDFLAGS = -no-undefined -module -avoid-version
@ -34,10 +42,6 @@ argb_la_SOURCES = loader_argb.c
argb_la_LDFLAGS = -no-undefined -module -avoid-version
argb_la_LIBADD =
tiff_la_SOURCES = loader_tiff.c
tiff_la_LDFLAGS = -no-undefined -module -avoid-version
tiff_la_LIBADD = -ltiff
bmp_la_SOURCES = loader_bmp.c
bmp_la_LDFLAGS = -no-undefined -module -avoid-version
bmp_la_LIBADD =
@ -50,10 +54,6 @@ tga_la_SOURCES = loader_tga.c
tga_la_LDFLAGS = -no-undefined -module -avoid-version
tga_la_LIBADD =
db_la_SOURCES = loader_db.c
db_la_LDFLAGS = -no-undefined -module -avoid-version
db_la_LIBADD = -ledb -lz
#xcf_la_SOURCES = loader_xcf.c loader_xcf_pixelfuncs.c
#xcf_la_LDFLAGS = -no-undefined -module -avoid-version
#xcf_la_LIBADD =