--- configure.ac.orig 2012-05-26 22:45:42.753478198 +0000 +++ configure.ac.orig 2012-05-27 00:36:23.175844081 +0000 @@ -47,6 +47,28 @@ dnl Checks for optional library functions dnl ------------------------------------- +dnl First check if we have argp available from 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 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 + LIBS+=" -largp" + fi +fi + dnl ----------------- dnl Configure options dnl -----------------