]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
build: Remove hard requirement for GNU .init_array section support
authorGuillem Jover <guillem@hadrons.org>
Sat, 19 Jul 2014 23:48:20 +0000 (01:48 +0200)
committerGuillem Jover <guillem@hadrons.org>
Sun, 20 Jul 2014 00:09:20 +0000 (02:09 +0200)
In case the support is not available, just stop building the
libbsd-ctor.a library, which is a nice to have thing, but should not
have been a hard requirement from the start. This should allow to
build libbsd on non-glibc based systems using another libc.

configure.ac
src/Makefile.am
test/.gitignore
test/Makefile.am
test/proctitle.c

index 1c1b9622c46fbe0fcd728f5c3a41bcf0c7cdb3fd..c1da7d41e37c90cfe963b7c75eb0dd5b4f63f2d7 100644 (file)
@@ -101,9 +101,8 @@ int main() { return rc; }
                ]
        )]
 )
-if test "$libbsd_cv_gnu_init_array_support" = no; then
-       AC_MSG_ERROR([missing required GNU .init_array section support])
-fi
+AM_CONDITIONAL([BUILD_LIBBSD_CTOR],
+               [test "$libbsd_cv_gnu_init_array_support" = yes])
 
 # Checks for library functions.
 AC_MSG_CHECKING([for program_invocation_short_name])
index b9ff0bc84ba9d31deb49f5cc16fb0fe5f775bd64..3f3a0f6f55d4971332421599f8f12b02e8c02732 100644 (file)
@@ -22,12 +22,17 @@ CLEANFILES = \
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = \
        libbsd.pc \
-       libbsd-ctor.pc \
        libbsd-overlay.pc \
        $(nil)
 
 lib_LTLIBRARIES = libbsd.la
-lib_LIBRARIES = libbsd-ctor.a
+lib_LIBRARIES =
+
+if BUILD_LIBBSD_CTOR
+pkgconfig_DATA += libbsd-ctor.pc
+
+lib_LIBRARIES += libbsd-ctor.a
+endif
 
 hash/md5hl.c: $(srcdir)/hash/helper.c
        $(AM_V_at) $(MKDIR_P) hash
index 60e0e695e0397094f27f4f39d49e3572f17bdd32..e351ab124c47ff94b676774345d43c190fc7d6da 100644 (file)
@@ -4,4 +4,5 @@ funopen
 headers
 humanize
 overlay
+proctitle-init
 proctitle
index 6ace5a686ff8a5ceabd5a1b24ed8e1f8f766a53e..c6e2daa9e15d4525262c2df8ee947b3b210e2a22 100644 (file)
@@ -14,12 +14,19 @@ check_PROGRAMS = \
        humanize \
        fgetln \
        funopen \
-       proctitle \
+       proctitle-init \
        $(nil)
 
+if BUILD_LIBBSD_CTOR
+check_PROGRAMS += proctitle
+endif
+
 humanize_LDFLAGS = $(top_builddir)/src/libbsd.la
 fgetln_LDFLAGS = $(top_builddir)/src/libbsd.la
 funopen_LDFLAGS = $(top_builddir)/src/libbsd.la
+proctitle_init_SOURCES = proctitle.c
+proctitle_init_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_USE_SETPROCTITLE_INIT=1
+proctitle_init_LDFLAGS = $(top_builddir)/src/libbsd.la
 proctitle_LDFLAGS = \
        -Wl,-u,libbsd_init_func \
        $(top_builddir)/src/libbsd-ctor.a \
index 56ea863981d8d2a1a658ad12d3731d169a931f36..5f546c79fb4977286ab3f37cf7d8f7cefdc1d6eb 100644 (file)
 #include <string.h>
 
 int
-main(int argc, char **argv)
+main(int argc, char **argv, char **envp)
 {
        const char newtitle_base[] = "test arg1 arg2";
        char *newtitle_full;
        char *envvar;
 
+#ifdef TEST_USE_SETPROCTITLE_INIT
+       setproctitle_init(argc, argv, envp);
+#endif
+
        setproctitle("-test %s arg2", "arg1");
        assert(strcmp(argv[0], newtitle_base) == 0);