-AC_MSG_CHECKING(random number generator)
-AC_CACHE_VAL(blp_random_good,
- AC_TRY_COMPILE([#include <stdlib.h>], [int x=RAND_MAX;],
- blp_random_good=yes, blp_random_good=no))
-if test "$blp_random_good" = yes; then
- AC_DEFINE([HAVE_GOOD_RANDOM], 1,
- [Define if rand() and company work according to ANSI.])
- AC_MSG_RESULT(good)
-else
- AC_MSG_RESULT(bad)
-fi
-])dnl
+ AC_ARG_WITH(libplot, [ --without-libplot don't compile in support of charts (using libplot)])
+
+ if test x"$with_libplot" != x"no" ; then
+ # Check whether we can link against libplot without any extra libraries.
+ AC_CHECK_LIB(plot, pl_newpl_r, [LIBPLOT_LIBS="-lplot"])
+
+ # Check whether we can link against libplot if we also link X.
+ if test x"$LIBPLOT_LIBS" = x""; then
+ AC_PATH_XTRA
+ extra_libs="-lXaw -lXmu -lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS -lm"
+ AC_CHECK_LIB(plot, pl_newpl_r,
+ [LIBPLOT_LIBS="-lplot $extra_libs"
+ LDFLAGS="$LDFLAGS $X_LIBS"],,
+ [$extra_libs])
+ fi
+
+ # Still can't link?
+ if test x"$LIBPLOT_LIBS" = x""; then
+ PSPP_REQUIRED_PREREQ([libplot (or use --without-libplot)])
+ fi
+
+ # Set up to make everything work.
+ LIBS="$LIBPLOT_LIBS $LIBS"
+ AC_DEFINE(HAVE_LIBPLOT, 1,
+ [Define to 1 if you have the `libplot' library (-lplot).])
+ fi
+])
+
+dnl Check that off_t is defined as an integer type.
+dnl Solaris sometimes declares it as a struct, if it
+dnl thinks that the compiler does not support `long long'.
+AC_DEFUN([PSPP_OFF_T],
+[
+ AC_COMPILE_IFELSE([#include <sys/types.h>
+ #include <unistd.h>
+ off_t x = 0;
+ int main (void)
+ {
+ lseek (0, 1, 2);
+ return 0;
+ }], [], [AC_MSG_ERROR(
+ [Your system's definition of off_t is broken. You are probably
+ using Solaris. You can probably fix the problem with
+ `--disable-largefile' or `CFLAGS=-ansi'.])])
+])
+
+dnl Check whether a C compiler option is accepted.
+dnl If so, add it to CFLAGS.
+dnl Example: PSPP_ENABLE_OPTION(-Wdeclaration-after-statement)
+AC_DEFUN([PSPP_ENABLE_OPTION],
+[
+ m4_define([pspp_cv_name], [pspp_cv_[]m4_translit([$1], [-], [_])])dnl
+ AC_CACHE_CHECK([whether $CC accepts $1], [pspp_cv_name],
+ [pspp_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [pspp_cv_name[]=yes], [pspp_cv_name[]=no])
+ CFLAGS="$pspp_save_CFLAGS"])
+ if test $pspp_cv_name = yes; then
+ CFLAGS="$CFLAGS $1"
+ fi
+])