blob: 06d1d943698205878fc56c2472c12e72cdf3b3f4 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 06ba71887f667d45dd231a782a2751f36e8fe025 Mon Sep 17 00:00:00 2001
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05002From: Christopher Larson <chris_larson@mentor.com>
3Date: Mon, 15 Feb 2016 15:59:58 -0700
Brad Bishop19323692019-04-05 15:28:33 -04004Subject: [PATCH 1/4] If the libc is lacking argp, use libargp
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05005
6Patch pulled from Gentoo:
7
8 On glibc systems, argp is provided by libc. However, on
9 uclibc and other systems which lack argp in their C library,
10 argp might be provided by a stand alone library, libargp.
11 This patch adds tests to the build system to find who provides
12 argp.
13
14 X-Gentoo-Bug: 292191
15 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=292191
16 Reported-by: Ed Wildgoose <gentoo@wildgooses.com>
17 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
18
19Upstream-Status: Pending
20Signed-off-by: Christopher Larson <chris_larson@mentor.com>
21---
22 configure.ac | 22 ++++++++++++++++++++++
23 1 file changed, 22 insertions(+)
24
25diff --git a/configure.ac b/configure.ac
Brad Bishop19323692019-04-05 15:28:33 -040026index 4e799dc..c4a5dd8 100644
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050027--- a/configure.ac
28+++ b/configure.ac
Brad Bishop19323692019-04-05 15:28:33 -040029@@ -135,6 +135,28 @@ AS_IF(
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050030 ]
31 )
32
33+dnl First check if we have argp available from libc
34+AC_LINK_IFELSE(
35+ [AC_LANG_PROGRAM(
36+ [#include <argp.h>],
37+ [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,argv,0,0,0); return 0;]
38+ )],
39+ [libc_has_argp="true"],
40+ [libc_has_argp="false"]
41+)
42+
43+dnl If libc doesn't provide argp, then test for libargp
44+if test "$libc_has_argp" = "false" ; then
45+ AC_MSG_WARN("libc does not have argp")
46+ AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
47+
48+ if test "$have_argp" = "false"; then
49+ AC_MSG_ERROR("no libargp found")
50+ else
51+ LIBS+=" -largp"
52+ fi
53+fi
54+
55 dnl -----------------
56 dnl Configure options
57 dnl -----------------
58--
Brad Bishop19323692019-04-05 15:28:33 -0400592.7.4
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050060