From b86dd0b19b188c30c804dfee8372b1222d54f378 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sun, 29 Dec 2013 19:09:48 -0600 Subject: [PATCH] [libpng15] Allow unversioned links created on install to be disabled in configure. In configure builds 'make install' changes/adds links like png.h and libpng.a to point to the newly installed, versioned, files (e.g. libpng17/png.h and libpng17.a). Three new configure options and some rearrangement of Makefile.am allow creation of these links to be disabled. --- ANNOUNCE | 5 +++ CHANGES | 5 +++ Makefile.am | 97 ++++++++++++++++++++++++++++++++++------------------ configure.ac | 39 +++++++++++++++++++++ 4 files changed, 113 insertions(+), 33 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index f70299f79..c6322def3 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -58,6 +58,11 @@ Version 1.5.18beta03 [December 30, 2013] system pnglibconf.h. Rebuilt configure scripts with automake 1.14.1 and autoconf-2.69. Require automake-1.13 and enable automake "subdirs" feature in autoconf.ac. + Allow unversioned links created on install to be disabled in configure. + In configure builds 'make install' changes/adds links like png.h + and libpng.a to point to the newly installed, versioned, files (e.g. + libpng17/png.h and libpng17.a). Three new configure options and some + rearrangement of Makefile.am allow creation of these links to be disabled. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 526de0e37..5d426c2f7 100644 --- a/CHANGES +++ b/CHANGES @@ -4182,6 +4182,11 @@ Version 1.5.18beta03 [December 30, 2013] system pnglibconf.h. Rebuilt configure scripts with automake 1.14.1 and autoconf-2.69. Require automake-1.13 and enable automake "subdirs" feature in autoconf.ac + Allow unversioned links created on install to be disabled in configure. + In configure builds 'make install' changes/adds links like png.h + and libpng.a to point to the newly installed, versioned, files (e.g. + libpng17/png.h and libpng17.a). Three new configure options and some + rearrangement of Makefile.am allow creation of these links to be disabled. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/Makefile.am b/Makefile.am index 8fe2eeb73..d1a125429 100644 --- a/Makefile.am +++ b/Makefile.am @@ -193,43 +193,74 @@ check: scripts/symbols.chk dist-hook: cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES) -# install the .../include headers as links to the new ones -install-data-hook: - cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h - cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/png.h png.h - cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \ - pngconf.h - cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \ - pnglibconf.h - cd '$(DESTDIR)$(pkgconfigdir)'; rm -f libpng.pc - cd '$(DESTDIR)$(pkgconfigdir)'; $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc +# Make links between installed files with release-specific names and the generic +# file names. If this install rule is run the generic names will be deleted and +# recreated - this has obvious issues for systems with multiple installations. -# do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used -install-exec-hook: - cd '$(DESTDIR)$(bindir)'; rm -f libpng-config - cd '$(DESTDIR)$(bindir)';\ - $(LN_S) $(PNGLIB_BASENAME)-config libpng-config - @set -x;\ - cd '$(DESTDIR)$(libdir)';\ - for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@\ - sl dylib dll.a; do\ - rm -f libpng.$$ext;\ - if test -f $(PNGLIB_BASENAME).$$ext; then\ - $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\ - fi;\ +install-header-links: + @set -ex; cd '$(DESTDIR)$(includedir)'; for f in $(HEADERS); do \ + rm -f "$$f"; $(LN_S) "$(PNGLIB_BASENAME)/$$f" "$$f"; done + +uninstall-header-links: + cd '$(DESTDIR)$(includedir)'; rm -f $(HEADERS) + +install-libpng-pc: + @set -ex; cd '$(DESTDIR)$(pkgconfigdir)'; rm -f libpng.pc; \ + $(LN_S) '$(PNGLIB_BASENAME).pc' libpng.pc + +uninstall-libpng-pc: + rm -f '$(DESTDIR)$(pkgconfigdir)/libpng.pc' + +# EXT_LIST is a list of the possibly library directory extensions, this exists +# because we can't find a good way of discovering the file extensions that are +# actually installed on a given system, so instead we check for every extension +# we have seen. + +EXT_LIST = a dll.a so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ la sl dylib + +install-library-links: + @set -x; cd '$(DESTDIR)$(libdir)';\ + for ext in $(EXT_LIST); do\ + rm -f "libpng.$$ext";\ + if test -f "$(PNGLIB_BASENAME).$$ext"; then\ + $(LN_S) "$(PNGLIB_BASENAME).$$ext" "libpng.$$ext" || exit 1;\ + fi;\ done -uninstall-hook: - cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h - rm -f '$(DESTDIR)$(pkgconfigdir)/libpng.pc' +uninstall-library-links: + @set -x; cd '$(DESTDIR)$(libdir)'; for ext in $(EXT_LIST); do\ + rm -f "libpng.$$ext"; done + +install-libpng-config: + @set -ex; cd '$(DESTDIR)$(bindir)'; rm -f libpng-config; \ + $(LN_S) '$(PNGLIB_BASENAME)-config' libpng-config + +uninstall-libpng-config: rm -f '$(DESTDIR)$(bindir)/libpng-config' - rm -f '$(DESTDIR)$(libdir)/libpng.a' - rm -f '$(DESTDIR)$(libdir)/libpng.la' - rm -f '$(DESTDIR)$(libdir)/libpng.so' - rm -f '$(DESTDIR)$(libdir)/libpng.so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@' - rm -f '$(DESTDIR)$(libdir)/libpng.sl' - rm -f '$(DESTDIR)$(libdir)/libpng.dylib' - rm -f '$(DESTDIR)$(libdir)/libpng.dll.a' + +if DO_INSTALL_LINKS +# If --enable-unversioned-links is specified the header and lib file links +# will be automatically made on a 'make install': + +install-data-hook: install-header-links +uninstall-hook: uninstall-header-links +install-exec-hook: install-library-links +uninstall-hook: uninstall-library-links +endif + +if DO_INSTALL_LIBPNG_PC +# Likewise, --install-pc causes libpng.pc to be constructed: + +install-data-hook: install-libpng-pc +uninstall-hook: uninstall-libpng-pc +endif + +if DO_INSTALL_LIBPNG_CONFIG +# And --install-config: + +install-exec-hook: install-libpng-config +uninstall-hook: uninstall-libpng-config +endif # The following addition ensures that 'make all' always builds the test programs # too. It used to, but some change either in libpng or configure stopped this diff --git a/configure.ac b/configure.ac index e9e0011f0..4a3b8978e 100644 --- a/configure.ac +++ b/configure.ac @@ -166,6 +166,45 @@ AC_ARG_WITH(binconfigs, [binconfigs='${binconfigs}']) AC_SUBST([binconfigs]) +# Control over what links are made for installed files. Versioned files are +# always installed, when the following options are turned on corresponding +# unversioned links are also created (normally as symbolic links): +AC_ARG_ENABLE([unversioned-links], + AS_HELP_STRING([[[--enable-unversioned-links]]], + [Installed libpng header files are placed in a versioned subdirectory] + [and installed libpng library (including DLL) files are versioned.] + [If this option is enabled unversioned links will be created pointing to] + [the corresponding installed files. If you use libpng.pc or] + [libpng-config for all builds you do not need these links, but if you] + [compile programs directly they will typically #include and] + [link with -lpng; in that case you need the links.] + [The links can be installed manually using 'make install-header-links'] + [and 'make install-library-links' and can be removed using the] + [corresponding uninstall- targets. If you do enable this option every] + [libpng 'make install' will recreate the links to point to the just] + [installed version of libpng. The default is to create the links;] + [use --disable-unversioned-links to change this])) + +# The AM_CONDITIONAL test is written so that the default is enabled; +# --disable-unversioned-links must be given to turn the option off. +AM_CONDITIONAL([DO_INSTALL_LINKS],[test "$enable_unversioned_links" != "no"]) + +AC_ARG_ENABLE([unversioned-libpng-pc], + AS_HELP_STRING([[[--enable-unversioned-libpng-pc]]], + [Install the configuration file 'libpng.pc' as a link to the versioned] + [version. This is done by default - use --disable-unversioned-libpng-pc] + [to change this.])) +AM_CONDITIONAL([DO_INSTALL_LIBPNG_PC], + [test "$enable_unversioned_libpng_pc" != "no"]) + +AC_ARG_ENABLE([unversioned-libpng-config], + AS_HELP_STRING([[[--enable-unversioned-libpng-config]]], + [Install the configuration file 'libpng-config' as a link to the] + [versioned version. This is done by default - use] + [--disable-unversioned-libpng-config to change this.])) +AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG], + [test "$enable_unversioned_libpng_config" != "no"]) + # HOST SPECIFIC OPTIONS # ===================== #