| 1 |
On glibc systems, argp is provided by libc. However, on
|
| 2 |
uclibc and other systems which lack argp in their C library,
|
| 3 |
argp might be provided by a stand alone library, libargp.
|
| 4 |
This patch adds tests to the build system to find who provides
|
| 5 |
argp.
|
| 6 |
|
| 7 |
X-Gentoo-Bug: 292191
|
| 8 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=292191
|
| 9 |
Reported-by: Ed Wildgoose <gentoo@wildgooses.com>
|
| 10 |
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
|
| 11 |
|
| 12 |
|
| 13 |
--- configure.ac.orig 2012-05-26 22:45:42.753478198 +0000
|
| 14 |
+++ configure.ac 2012-05-27 00:36:23.175844081 +0000
|
| 15 |
@@ -47,6 +47,28 @@
|
| 16 |
dnl Checks for optional library functions
|
| 17 |
dnl -------------------------------------
|
| 18 |
|
| 19 |
+dnl First check if we have argp available from libc
|
| 20 |
+AC_LINK_IFELSE(
|
| 21 |
+ [AC_LANG_PROGRAM(
|
| 22 |
+ [#include <argp.h>],
|
| 23 |
+ [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,argv,0,0,0); return 0;]
|
| 24 |
+ )],
|
| 25 |
+ [libc_has_argp="true"],
|
| 26 |
+ [libc_has_argp="false"]
|
| 27 |
+)
|
| 28 |
+
|
| 29 |
+dnl If libc doesn't provide argp, then test for libargp
|
| 30 |
+if test "$libc_has_argp" = "false" ; then
|
| 31 |
+ AC_MSG_WARN("libc does not have argp")
|
| 32 |
+ AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
|
| 33 |
+
|
| 34 |
+ if test "$have_argp" = "false"; then
|
| 35 |
+ AC_MSG_ERROR("no libargp found")
|
| 36 |
+ else
|
| 37 |
+ LIBS+=" -largp"
|
| 38 |
+ fi
|
| 39 |
+fi
|
| 40 |
+
|
| 41 |
dnl -----------------
|
| 42 |
dnl Configure options
|
| 43 |
dnl -----------------
|