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.
This commit is contained in:
Guillem Jover 2014-07-20 01:48:20 +02:00
parent faa005cb32
commit e8d3d04177
5 changed files with 23 additions and 7 deletions

View 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])

View 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

1
test/.gitignore vendored
View File

@ -4,4 +4,5 @@ funopen
headers
humanize
overlay
proctitle-init
proctitle

View 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 \

View File

@ -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);