From 4e5fb3a60b4832b2213d902d399572a1e621789f Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 5 Dec 2010 14:48:34 +1100 Subject: [PATCH] We need libpopt-dev to compile the utilities. Add a test to configure to verify popt development libraries are available and print an error and exit otherwise. --- configure.ac | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/configure.ac b/configure.ac index b928c3c..a98cce4 100644 --- a/configure.ac +++ b/configure.ac @@ -54,6 +54,40 @@ if test x"$libiscsi_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property]) fi +AC_MSG_CHECKING(whether libpopt is available) +ac_save_CFLAGS="$CFLAGS" +ac_save_LIBS="$LIBS" +CFLAGS="$CFLAGS $GLIB_CFLAGS" +LIBS="$GLIB_LIBS $LIBS -lpopt" +AC_TRY_RUN([ +/* + * Just see if we can compile/link with popt + */ +#include + +int main(int argc, const char *argv[]) +{ + struct poptOption popt_options[] = { + POPT_TABLEEND + }; + poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST); + + return 0; +} +], ac_cv_have_popt=yes, ac_cv_have_popt=no, + [echo $ac_n "compile with POPT. Assuming OK... $ac_c" + ac_cv_have_popt=yes]) +CFLAGS="$ac_save_CFLAGS" +LIBS="$ac_save_LIBS" +if test "$ac_cv_have_popt" = yes ; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + AC_MSG_NOTICE(You need libpopt to compile libiscsi. Install the libpopt-dev package.) + exit +fi + + AC_SUBST(libdir) #AC_SUBST(LIBISCSI_LDFLAGS)