diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2020-12-11 03:59:40 +0300 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2020-12-11 12:30:09 +0100 |
commit | be084ccb5507e0c092ac4e434026a4d47e9007bf (patch) | |
tree | a8632b5ae78fa59f183269808545ab6de14a5cdc /configure.ac | |
parent | 8ffada54afb4a9624a45eb71a60a9c1a401580d9 (diff) | |
download | elfutils-be084ccb5507e0c092ac4e434026a4d47e9007bf.tar.gz |
configure.ac: simplify argp check
Rewrite argp check using the same AC_SEARCH_LIBS based method used
earlier in the fts check.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac index 6c3e05bf..392f9155 100644 --- a/configure.ac +++ b/configure.ac @@ -520,29 +520,14 @@ if test "$ac_cv_implicit_fallthrough" = "yes"; then [Defined if __attribute__((fallthrough)) is supported]) fi -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 +saved_LIBS="$LIBS" +AC_SEARCH_LIBS([argp_parse], [argp]) +LIBS="$saved_LIBS" +case "$ac_cv_search_argp_parse" in + no) AC_MSG_FAILURE([failed to find argp_parse]) ;; + -l*) argp_LDADD="$ac_cv_search_argp_parse" ;; + *) argp_LDADD= ;; +esac AC_SUBST([argp_LDADD]) saved_LIBS="$LIBS" |