Skip to content
This repository
Browse code

Configure: When configuring examples, make sure we have popt-devel

Add a check for configure that we do have popt-devel available
if --enable-examples is specified.
  • Loading branch information...
commit b9813d24cad356446542ea31e6ccaf40745a0603 1 parent b140627
Ronnie Sahlberg authored

Showing 1 changed file with 35 additions and 0 deletions. Show diff stats Hide diff stats

  1. 35  configure.ac
35  configure.ac
@@ -33,11 +33,46 @@ AC_ARG_ENABLE([examples],
33 33
 	      [ENABLE_EXAMPLES=$enableval],
34 34
 	      [ENABLE_EXAMPLES="no"])
35 35
 
  36
+# We need popt to compile the examples
36 37
 if test x$ENABLE_EXAMPLES = xyes; then
  38
+AC_MSG_CHECKING(whether libpopt is available)
  39
+ac_save_CFLAGS="$CFLAGS"
  40
+ac_save_LIBS="$LIBS"
  41
+CFLAGS="$CFLAGS $GLIB_CFLAGS"
  42
+LIBS="$GLIB_LIBS $LIBS -lpopt"
  43
+AC_TRY_RUN([
  44
+/*
  45
+ * Just see if we can compile/link with popt
  46
+ */
  47
+#include <popt.h>
  48
+
  49
+int main(int argc, const char *argv[])
  50
+{
  51
+	struct poptOption popt_options[] = {
  52
+		POPT_TABLEEND
  53
+	};
  54
+	poptGetContext(argv[0], argc, argv, popt_options, POPT_CONTEXT_KEEP_FIRST);
  55
+
  56
+	return 0;
  57
+}
  58
+], ac_cv_have_popt=yes, ac_cv_have_popt=no,
  59
+   [echo $ac_n "compile with POPT. Assuming OK... $ac_c"
  60
+    ac_cv_have_popt=yes])
  61
+CFLAGS="$ac_save_CFLAGS"
  62
+LIBS="$ac_save_LIBS"
  63
+if test "$ac_cv_have_popt" = yes ; then
  64
+  AC_MSG_RESULT(yes)
37 65
   MAYBE_EXAMPLES="examples"
  66
+else
  67
+  AC_MSG_RESULT(no)
  68
+  AC_MSG_NOTICE(You need libpopt to compile the sample libnfs clients.)
  69
+  AC_MSG_NOTICE(Only the library will be compiled and installed.)
38 70
 fi
  71
+fi
  72
+
39 73
 AC_SUBST(MAYBE_EXAMPLES)
40 74
 
  75
+
41 76
 AC_ARG_ENABLE(tirpc,
42 77
   	[AC_HELP_STRING([--enable-tirpc],
43 78
   			[enable use of TI-RPC @<:@default=no@:>@])],

0 notes on commit b9813d2

Please sign in to comment.
Something went wrong with that request. Please try again.