From: Dmitry V. Levin Date: Fri, 11 Dec 2020 00:59:40 +0000 (+0300) Subject: configure.ac: simplify argp check X-Git-Tag: elfutils-0.183~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=be084ccb5507e0c092ac4e434026a4d47e9007bf;p=thirdparty%2Felfutils.git 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 --- diff --git a/ChangeLog b/ChangeLog index 563af0d2a..def6279a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2020-12-11 Dmitry V. Levin + * configure.ac: Rewrite argp check. + * configure.ac (AC_MSG_FAILURE): Fix typo. 2020-11-30 Dmitry V. Levin diff --git a/configure.ac b/configure.ac index 6c3e05bfd..392f9155e 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 ], - [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"