diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2015-05-04 02:25:39 +0300 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2015-05-04 15:56:13 +0200 |
commit | 1ab3c2befeedf5bd891cfbe17cfef79c06e5079a (patch) | |
tree | e34cd57c43b8c4cb5e97bd3bb31096f29806814b /configure.ac | |
parent | 1ce4a45932cd01f0e8096f636adaa684b6f5c7cb (diff) | |
download | elfutils-1ab3c2befeedf5bd891cfbe17cfef79c06e5079a.tar.gz |
Link against standalone argp library
argp is not part of POSIX standards and not provided by uClibc or
some other standard C libraries. However, it is possible to link
against a breakout argp library. One is provided at
http://www.lysator.liu.se/~nisse/misc/
This patch tests if libc provides argp otherwise it adds the linker
flag -largp where needed in the build system.
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 7ba4d115..68b7f5b5 100644 --- a/configure.ac +++ b/configure.ac @@ -253,6 +253,31 @@ AS_IF([test "x$enable_symbol_versioning" = "xno"], [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.]) enable_symbol_versioning=no],[enable_symbol_versioning=yes]) +dnl Check if we have argp available from our libc +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include <argp.h>], + [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,argv,0,0,0); return 0;] + )], + [libc_has_argp="true"], + [libc_has_argp="false"] +) + +dnl If our libc doesn't provide argp, then test for libargp +if test "$libc_has_argp" = "false" ; then + AC_MSG_WARN("libc does not have argp") + AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"]) + + if test "$have_argp" = "false"; then + AC_MSG_ERROR("no libargp found") + else + argp_LDADD="-largp" + fi +else + argp_LDADD="" +fi +AC_SUBST([argp_LDADD]) + dnl The directories with content. dnl Documentation. |