From 3fcf096870bffa7d21fceecb56ba26e925073ecb Mon Sep 17 00:00:00 2001 From: John Ellson Date: Tue, 14 Jun 2016 01:18:18 -0400 Subject: [PATCH] use gdlib.pc, if abvailable, and thereby supress deprecated warnings during configure --- .gitignore | 1 + configure.ac | 109 ++++++++++++++++++++---------------- contrib/diffimg/Makefile.am | 4 +- plugin/gd/Makefile.am | 4 +- tclpkg/gdtclft/Makefile.am | 4 +- tclpkg/tcldot/Makefile.am | 4 +- 6 files changed, 70 insertions(+), 56 deletions(-) diff --git a/.gitignore b/.gitignore index c4ef8f9b9..8e321452e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ syntax: glob *.a graphviz*.tar.gz* rtest*.tar.gz* +*.ih *.la *.lai *.lo diff --git a/configure.ac b/configure.ac index 7afaa0950..34664d15e 100644 --- a/configure.ac +++ b/configure.ac @@ -2677,15 +2677,52 @@ if test "x$with_libgd" != "xyes"; then fi if test "x$use_gd" = "x"; then + PKG_CHECK_MODULES(GTK, [gdlib >= 2.0.33],[ + have_gdlib=1 +# FIXME - why no features in the gdlib.pc? + GD_FEATURES="GD_PNG GD_JPEG GD_XPM GD_FONTCONFIG GD_FREETYPE GD_GIF GD_GIFANIM GD_OPENPOLYGON" + ],[ AC_PATH_PROG(GDLIB_CONFIG,gdlib-config) if test -n "$GDLIB_CONFIG"; then - GD_INCLUDES=`$GDLIB_CONFIG --includes` - GD_LDFLAGS=`$GDLIB_CONFIG --ldflags | sed 's/-xarch=[^ ]* //'` - GD_LIBS=`$GDLIB_CONFIG --libs` - GD_MAJORVERSION=`$GDLIB_CONFIG --majorversion` - GD_MINORVERSION=`$GDLIB_CONFIG --minorversion` - GD_REVISION=`$GDLIB_CONFIG --revision` - for f in `$GDLIB_CONFIG --features` ; do + have_gdlib=1 + GDLIB_CFLAGS=`$GDLIB_CONFIG --includes` + GDLIB_LIBS=`$GDLIB_CONFIG --libs` + GDLIB_VERSION=`$GDLIB_CONFIG --version 2>/dev/null` + GD_LDFLAGS=`$GDLIB_CONFIG --ldflags | sed 's/-xarch=[^ ]* //'` + GD_FEATURES=`$GDLIB_CONFIG --features` + + # GD version check >= 2.0.33 -- centos-5.8 has gd-2.0.33 + GDLIB_VERSION_MAJOR=`echo $GDLIB_VERSION | cut -d '.' -f 1` + GDLIB_VERSION_MINOR=`echo $GDLIB_VERSION | cut -d '.' -f 2` + GDLIB_VERSION_MICRO=`echo $GDLIB_VERSION | cut -d '.' -f 3` + REQ_GDLIB_VERSION_MAJOR=2 + REQ_GDLIB_VERSION_MINOR=0 + REQ_GDLIB_VERSION_MICRO=33 + if test $GDLIB_VERSION_MAJOR -lt $REQ_GDLIB_VERSION_MAJOR; then + use_gd="No (major version too old)" + else + if test $GDLIB_VERSION_MAJOR -eq $REQ_GDLIB_VERSION_MAJOR; then + if test $GDLIB_VERSION_MINOR -lt $REQ_GDLIB_VERSION_MINOR; then + use_gd="No (minor version too old)" + else + if test $GDLIB_VERSION_MINOR -eq $REQ_GDLIB_VERSION_MINOR; then + if test $GDLIB_VERSION_MICRO -lt $REQ_GDLIB_VERSION_MICRO; then + use_gd="No (revision too old)" + fi + fi + fi + fi + fi + if test "x$use_gd" != "x"; then + AC_MSG_WARN(GD library version $GDLIB_VERSION_MAJOR.$GDLIB_VERSION_MINOR.$GDLIB_VERSION_MICRO < $REQ_GDLIB_VERSION_MAJOR.$REQ_GDLIB_VERSION_MINOR.$REQ_GDLIB_VERSION_MICRO) + fi + else + AC_MSG_WARN(GD neither gdlib pkgconfig nor gdlib-config was found) + fi + ]) + if test "x$have_gdlib" != "x"; then + AC_DEFINE_UNQUOTED(HAVE_GDLIB,1,[Define if you have the gdlib library]) + for f in $GD_FEATURES ; do if test "$f" = "GD_PNG"; then AC_DEFINE_UNQUOTED(HAVE_GD_PNG,1,[Define if the GD library supports PNG]) fi @@ -2696,12 +2733,12 @@ if test "x$use_gd" = "x"; then AC_DEFINE_UNQUOTED(HAVE_GD_XPM,1,[Define if the GD library supports XPM]) fi if test "$f" = "GD_FONTCONFIG"; then - HAVE_GD_FONTCONFIG=1 AC_DEFINE_UNQUOTED(HAVE_GD_FONTCONFIG,1,[Define if the GD library supports FONTCONFIG]) + have_gd_fontconfig=1 fi if test "$f" = "GD_FREETYPE"; then - HAVE_GD_FREETYPE=1 AC_DEFINE_UNQUOTED(HAVE_GD_FREETYPE,1,[Define if the GD library supports FREETYPE]) + have_gd_freetype=1 fi if test "$f" = "GD_GIF"; then AC_DEFINE_UNQUOTED(HAVE_GD_GIF,1,[Define if the GD library supports GIF]) @@ -2712,43 +2749,19 @@ if test "x$use_gd" = "x"; then if test "$f" = "GD_OPENPOLYGON"; then AC_DEFINE_UNQUOTED(HAVE_GD_OPENPOLYGON,1,[Define if the GD library supports OPENPOLYGON]) fi - done + done - if test "x$HAVE_GD_FONTCONFIG" = "x"; then - AC_MSG_WARN(Your libgd was not built with freetype support. This may result in problems displaying fonts.) + if test "x$have_gd_fontconfig" = "x"; then + AC_MSG_WARN(Your libgd was not built with fontconfig support. This may result in problems displaying fonts.) fi - if test "x$HAVE_GD_FREETYPE" = "x"; then - AC_MSG_WARN(Your libgd was not built with fontconfig support. This may result in problems resolving fonts.) - fi + if test "x$have_gd_freetype" = "x"; then + AC_MSG_WARN(Your libgd was not built with freetype support. This may result in problems resolving fonts.) + fi + fi - # GD version check >= 2.0.33 -- centos-5.8 has gd-2.0.33 - REQ_GD_MAJORVERSION=2 - REQ_GD_MINORVERSION=0 - REQ_GD_REVISION=33 - if test $GD_MAJORVERSION -lt $REQ_GD_MAJORVERSION; then - use_gd="No (major version too old)" - else - if test $GD_MAJORVERSION -eq $REQ_GD_MAJORVERSION; then - if test $GD_MINORVERSION -lt $REQ_GD_MINORVERSION; then - use_gd="No (minor version too old)" - else - if test $GD_MINORVERSION -eq $REQ_GD_MINORVERSION; then - if test $GD_REVISION -lt $REQ_GD_REVISION; then - use_gd="No (revision too old)" - fi - fi - fi - fi - fi - if test "x$use_gd" != "x"; then - AC_MSG_WARN(GD library version < $REQ_GD_MAJORVERSION.$REQ_GD_MINORVERSION.$REQ_GD_REVISION) - fi - else - AC_MSG_WARN(GD gdlib-config not found) - fi # prevent explicit use of -I/usr/include as it breaks mingw cross-compiles - if test "x$GD_INCLUDES" = "x-I/usr/include"; then - GD_INCLUDES=""; + if test "x$GDLIB_CFLAGS" = "x-I/usr/include"; then + GDLIB_CFLAGS=""; fi # prevent explicit use of -L/usr/lib or -L/usr/lib64, unnecessary clutter if test "x$GD_LDFLAGS" = "x-L/usr/lib"; then @@ -2765,13 +2778,13 @@ if test "x$use_gd" = "x"; then save_LDFLAGS=$LDFLAGS AC_ARG_WITH(gdincludedir, [AS_HELP_STRING([--with-gdincludedir=DIR],[use GD includes from DIR])], - GD_INCLUDES="-I$withval") - CPPFLAGS="$CPPFLAGS $GD_INCLUDES" + GDLIB_CFLAGS="-I$withval") + CPPFLAGS="$CPPFLAGS $GDLIB_CFLAGS" AC_ARG_WITH(gdlibdir, [AS_HELP_STRING([--with-gdlibdir=DIR],[use GD libraries from DIR])], [GD_LDFLAGS="-L$withval"]) - GD_LIBS="$GD_LDFLAGS -lgd $GD_LIBS" - LDFLAGS="$LDFLAGS $GD_LIBS" + GDLIB_LIBS="$GD_LDFLAGS -lgd $GDLIB_LIBS" + LDFLAGS="$LDFLAGS $GDLIB_LIBS" AC_CHECK_HEADER(gd.h,,[ AC_MSG_WARN(Optional GD library not available - no gd.h) use_gd="No (gd headers not found)" @@ -2791,8 +2804,8 @@ if test "x$use_gd" = "x"; then CPPFLAGS=$save_CPPFLAGS fi fi - AC_SUBST([GD_INCLUDES]) - AC_SUBST([GD_LIBS]) + AC_SUBST([GDLIB_CFLAGS]) + AC_SUBST([GDLIB_LIBS]) fi AM_CONDITIONAL(WITH_LIBGD, [test "x$with_libgd" = "xyes"]) diff --git a/contrib/diffimg/Makefile.am b/contrib/diffimg/Makefile.am index 4db8970dd..cc3969279 100644 --- a/contrib/diffimg/Makefile.am +++ b/contrib/diffimg/Makefile.am @@ -3,7 +3,7 @@ VERSION=0.2 -AM_CPPFLAGS = @GD_INCLUDES@ +AM_CPPFLAGS = @GDLIB_CFLAGS@ pdfdir = $(pkgdatadir)/doc/pdf @@ -16,7 +16,7 @@ endif diffimg_SOURCES = diffimg.c -diffimg_LDADD = @GD_LIBS@ @MATH_LIBS@ +diffimg_LDADD = @GDLIB_LIBS@ @MATH_LIBS@ diffimg.1.pdf: $(srcdir)/diffimg.1 - $(GROFF) -Tps -man $(srcdir)/diffimg.1 | $(PS2PDF) - - >diffimg.1.pdf diff --git a/plugin/gd/Makefile.am b/plugin/gd/Makefile.am index 97e0e1a99..6f76f12e3 100644 --- a/plugin/gd/Makefile.am +++ b/plugin/gd/Makefile.am @@ -8,7 +8,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/gvc \ -I$(top_srcdir)/lib/cgraph \ -I$(top_srcdir)/lib/cdt \ - $(PANGOCAIRO_CFLAGS) $(GD_INCLUDES) $(LIBGVC_CFLAGS) + $(PANGOCAIRO_CFLAGS) $(GDLIB_CFLAGS) $(LIBGVC_CFLAGS) if WITH_LIBGD noinst_LTLIBRARIES = libgvplugin_gd_C.la @@ -35,7 +35,7 @@ if WITH_LIBGD libgvplugin_gd_la_LIBADD = \ $(top_builddir)/lib/gvc/libgvc.la \ $(top_builddir)/lib/cgraph/libcgraph.la \ - $(top_builddir)/lib/cdt/libcdt.la @PANGOCAIRO_LIBS@ @GD_LIBS@ @MATH_LIBS@ + $(top_builddir)/lib/cdt/libcdt.la @PANGOCAIRO_LIBS@ @GDLIB_LIBS@ @MATH_LIBS@ libgvplugin_gd_la_DEPENDENCIES = $(top_builddir)/lib/gvc/libgvc.la if WITH_WIN32 diff --git a/tclpkg/gdtclft/Makefile.am b/tclpkg/gdtclft/Makefile.am index 279f20ea7..0eb06c390 100644 --- a/tclpkg/gdtclft/Makefile.am +++ b/tclpkg/gdtclft/Makefile.am @@ -8,7 +8,7 @@ pkgtcldir = $(pkglibdir)/tcl AM_CPPFLAGS = \ -I$(top_srcdir) \ - @GD_INCLUDES@ @TCL_INCLUDES@ + @GDLIB_CFLAGS@ @TCL_INCLUDES@ LIBS = @LIBS@ -lc @@ -32,7 +32,7 @@ libgdtclft_la_LDFLAGS = -no-undefined if WITH_LIBGD libgdtclft_la_LIBADD = \ $(top_builddir)/tclpkg/tclstubs/libtclstubs_C.la \ - $(GD_LIBS) + $(GDLIB_LIBS) if WITH_TCL all-local: pkgIndex.tcl diff --git a/tclpkg/tcldot/Makefile.am b/tclpkg/tcldot/Makefile.am index 3dc3ae48d..c61536142 100644 --- a/tclpkg/tcldot/Makefile.am +++ b/tclpkg/tcldot/Makefile.am @@ -18,7 +18,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/lib/common \ -I$(top_srcdir)/lib/cgraph \ -I$(top_srcdir)/lib/cdt \ - -I$(top_srcdir)/lib/pathplan $(TCLHANDLE_INCLUDES) $(GD_INCLUDES) $(TCL_INCLUDES) + -I$(top_srcdir)/lib/pathplan $(TCLHANDLE_INCLUDES) $(GDLIB_CFLAGS) $(TCL_INCLUDES) LIBS = -lc @@ -64,7 +64,7 @@ libtcldot_la_DEPENDENCIES = $(top_builddir)/lib/gvc/libgvc.la # GDTCLFT requires gd libs to be builtin if WITH_LIBGD -libtcldot_la_LIBADD += $(GD_LIBS) +libtcldot_la_LIBADD += $(GDLIB_LIBS) endif libtcldot_la_LIBADD += $(LIBGEN_LIBS) $(MATH_LIBS) -- 2.50.1