libbsd: Branch 'master'
Guillem Jover
guillem at kemper.freedesktop.org
Sat Jul 19 17:14:01 PDT 2014
configure.ac | 5 ++---
src/Makefile.am | 9 +++++++--
test/.gitignore | 1 +
test/Makefile.am | 9 ++++++++-
test/proctitle.c | 6 +++++-
5 files changed, 23 insertions(+), 7 deletions(-)
New commits:
commit e8d3d04177c8718f1e7f583cbcca15f8e0b9602e
Author: Guillem Jover <guillem at hadrons.org>
Date: Sun Jul 20 01:48:20 2014 +0200
build: Remove hard requirement for GNU .init_array section support
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.
diff --git a/configure.ac b/configure.ac
index 1c1b962..c1da7d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/src/Makefile.am b/src/Makefile.am
index b9ff0bc..3f3a0f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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
diff --git a/test/.gitignore b/test/.gitignore
index 60e0e69..e351ab1 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -4,4 +4,5 @@ funopen
headers
humanize
overlay
+proctitle-init
proctitle
diff --git a/test/Makefile.am b/test/Makefile.am
index 6ace5a6..c6e2daa 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -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 \
diff --git a/test/proctitle.c b/test/proctitle.c
index 56ea863..5f546c7 100644
--- a/test/proctitle.c
+++ b/test/proctitle.c
@@ -31,12 +31,16 @@
#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);
More information about the libbsd
mailing list