-AC_ARG_WITH([examples],
- [ --without-examples Disable build of examples],
- [ENABLE_EXAMPLES="no"],
- [ENABLE_EXAMPLES="yes"]
- )
-AC_SUBST(ENABLE_EXAMPLES)
+# We always want 64 bit file offsets
+CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
+
+#option: examples
+AC_ARG_ENABLE([examples],
+ [AC_HELP_STRING([--enable-examples],
+ [Build example programs])],
+ [ENABLE_EXAMPLES=$enableval],
+ [ENABLE_EXAMPLES="no"])
+
+# We need popt to compile the examples
+if test x$ENABLE_EXAMPLES = xyes; then
+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 <popt.h>