From: Kay Sievers Date: Sat, 9 Apr 2016 18:44:01 +0000 (+0200) Subject: build: adjust to autotool standards X-Git-Url: http://git.zarvox.org/shortlog/static/widgets.js?a=commitdiff_plain;h=395e8490c50cffe07cfa5a6835972ef1d826bfc2;p=crbtree.git build: adjust to autotool standards https://github.com/bus1/cvariant/commit/9d645c5506148e62483f2870ceb92853899553e6 --- diff --git a/.gitignore b/.gitignore index e9b5e3b..d6c9477 100644 --- a/.gitignore +++ b/.gitignore @@ -21,8 +21,8 @@ /Makefile.in /install-tree -/src/crbtree.pc /libcrbtree.so.0 +/src/crbtree.pc /test-api /test-basic diff --git a/Makefile.am b/Makefile.am index b92aa40..2ba0c28 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,42 +41,46 @@ AM_CFLAGS = $(OUR_CFLAGS) AM_LDFLAGS = $(OUR_LDFLAGS) # ------------------------------------------------------------------------------ -# libcrbtree.a +# library archive noinst_LIBRARIES += \ libcrbtree.a -pkginclude_HEADERS += \ - src/org.bus1/c-rbtree.h - libcrbtree_a_SOURCES = \ src/libcrbtree.sym \ src/c-rbtree-private.h \ - src/c-rbtree.c + src/c-rbtree.c \ + src/org.bus1/c-rbtree.h # ------------------------------------------------------------------------------ -# libcrbtree.so.0 +# shared library built from archive + +all-local: libcrbtree.so.0 + +pkginclude_HEADERS += \ + src/org.bus1/c-rbtree.h libcrbtree.so.0: libcrbtree.a $(top_srcdir)/src/libcrbtree.sym - $(AM_V_CCLD)$(CCLD) $(AM_CFLAGS) $(AM_LDFLAGS) \ - -shared \ + $(AM_V_CCLD)$(LINK) -shared \ -Wl,-soname=$@ \ -Wl,--version-script=$(top_srcdir)/src/libcrbtree.sym \ - -Wl,--whole-archive libcrbtree.a -Wl,--no-whole-archive \ - -o $@ + -Wl,--whole-archive libcrbtree.a -Wl,--no-whole-archive CLEANFILES += \ libcrbtree.so.0 -all-local: libcrbtree.so.0 - -install-exec-hook: - $(MKDIR_P) $(DESTDIR)$(libdir) - cp libcrbtree.so.0 $(DESTDIR)$(libdir) - $(AM_V_LN)ln -sf libcrbtree.so.0 $(DESTDIR)$(libdir)/libcrbtree.so - -uninstall-hook: - rm -f $(DESTDIR)$(libdir)/libcrbtree.so.0 +install-exec-local: + @echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1 + @echo " $(INSTALL) libcrbtree.so.0 '$(DESTDIR)$(libdir)'"; \ + $(INSTALL) libcrbtree.so.0 "$(DESTDIR)$(libdir)" || exit $$? + @echo " $(LN_S) -f libcrbtree.so.0 '$(DESTDIR)$(libdir)/libcrbtree.so'"; \ + $(LN_S) -f libcrbtree.so.0 "$(DESTDIR)$(libdir)/libcrbtree.so" || exit $$? + +uninstall-local: + @test ! -d "$(DESTDIR)$(libdir)" || \ + { echo " ( cd '$(DESTDIR)$(libdir)' && rm -f libcrbtree.so.0 )"; \ + rm -f "$(DESTDIR)$(libdir)/libcrbtree.so.0"; } %.pc: %.pc.in $(AM_V_GEN)$(SED) \ diff --git a/configure.ac b/configure.ac index 38e8c3d..0f61ce8 100644 --- a/configure.ac +++ b/configure.ac @@ -16,8 +16,9 @@ AC_CONFIG_MACRO_DIR([build/m4]) AC_CONFIG_HEADERS([build/config.h]) AC_CONFIG_AUX_DIR([build/build-aux]) -# AC_PROG_CC sets default CFLAGS which conflict with our own configuration +# suppress conflicting defaults CFLAGS=${CFLAGS:-""} +CXXFLAGS=${CXXFLAGS:-""} AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE @@ -29,6 +30,7 @@ AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.]) AC_PROG_CC_C99 AC_PROG_RANLIB AC_PROG_SED +AC_PROG_LN_S m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])