Hi, In the past few days, I've added an 'installcheck' Makefile target to GNU libiconv, GNU libunistring, GNU gettext, and GNU libsigsegv. And that uncovered a couple of bugs. Therefore I think such an 'installcheck' target is a good practice to have.
This 'installcheck' needs an piece of information that comes from libtool: The shlibpath_var. It needs to be used in a particular way when running programs that reference the just-installed libraries. Therefore, I would propose to add to GNU libtool a documentation section and an Autoconf macro. The documentation section would read roughly like this: ================================================================================ Support for the 'installcheck' target The GNU Coding Standards <https://www.gnu.org/prep/standards/html_node/Standard-Targets.html> specify a Makefile target 'installcheck' that is useful for a sanity check of the installed binaries after "make install". For libraries, such a sanity check can uncover a number of installation bugs: - A missing include file. - An include file that is not self-contained (i.e. requires other includes file to be included first). - An include file that, on native Windows, does not declare the variables with '__declspec (dllimport)'. - A missing library. - A library that lacks execute permissions; this matters on HP-UX and on native Windows in a Cygwin-based build environment. - A library that does not export the symbols declared in the include files. - A library that depends on other libraries, but these libraries cannot be found without additional -L options. - A library that, on macOS, depends on frameworks, but these frameworks require additional link options. The typical structure of 'installcheck' support for a library consists of the following elements: * It's a separate directory. This is needed so that the include file(s) in build tree are not visible during the compilation of a test program. When compiling a test program for 'installcheck', *only* the installed include files should be visible; however, many compilers look for an include file in the current directory by default. * In this directory, you add a file that tests part of the API. Let's call it 'test-api.c'. The part of the API to be tested should include APIs that make use of dependency libraries, so as to catch the case of installation problems with regard to the dependencies. * In this directory, you add a file 'Makefile.am'. In the simplest case of a public library installed in $(libdir), it has a rule that compiles test-api.c and links it with 'libfoo': installcheck: $(CC) -I$(includedir) -L$(libdir) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o test-api $(srcdir)/test-api.c -lfoo @AUGMENT_SHLIBPATH@ ./test-api rm -rf test-api test-api$(EXEEXT) Here AUGMENT_SHLIBPATH is an Autoconf variable that extends the shared library lookup path variable so that it contains $(libdir). On Windows platforms (including Cygwin), the shared library lookup path variable is PATH; in this case it is augmented to contain $(bindir), not $(libdir), because that's where shared libraries on Windows are supposed to be installed. AUGMENT_SHLIBPATH is provided by invoking the Autoconf macro LT_PREP_INSTALLCHECK. Put an invocation of this macros into your configure.ac file, after the invocation of LT_INIT. Or: AUGMENT_SHLIBPATH is provided by the LT_INIT invocation, when it contains the flag 'installcheck'. For a non-public library, that gets installed in a subdirectory of $(libdir), you need to create an analogon of AUGMENT_SHLIBPATH, based on the 'shlibpath_var' variable that is set by LT_INIT. ================================================================================ And the Autoconf macro LT_PREP_INSTALLCHECK would contain this code: ================================================================================ if test -n "${shlibpath_var}"; then if test "${shlibpath_var}" = PATH; then AUGMENT_SHLIBPATH="PATH='\$(bindir)'${PATH_SEPARATOR}\"\$\$PATH\";" else AUGMENT_SHLIBPATH="${shlibpath_var}='\$(libdir)':\"\$\$${shlibpath_var}\"; export ${shlibpath_var};" fi else AUGMENT_SHLIBPATH= fi AC_SUBST([AUGMENT_SHLIBPATH]) ================================================================================ I can provide a patch, if the idea meets agreement. Bruno