summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2014-07-20 01:48:20 +0200
committerGuillem Jover <guillem@hadrons.org>2014-07-20 02:09:20 +0200
commite8d3d04177c8718f1e7f583cbcca15f8e0b9602e (patch)
tree63bf56d74c3f5066a454306f83cd97b98646f3eb /test
parentfaa005cb3209239bdbdf001e387cbcf9f088b12c (diff)
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.
Diffstat (limited to 'test')
-rw-r--r--test/.gitignore1
-rw-r--r--test/Makefile.am9
-rw-r--r--test/proctitle.c6
3 files changed, 14 insertions, 2 deletions
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);