Changed PSPP_LINREG_SVD to PSPP_LINREG_QR
[pspp-builds.git] / acinclude.m4
index 0eb9c1f31a1562b2b1ee6249cbc9547a2b4e6bb7..4201e22b58c67012d73ece9280e538e35a8b79bb 100644 (file)
@@ -40,8 +40,28 @@ AC_DEFUN([PSPP_LIBPLOT],
   AC_ARG_WITH(libplot, [  --without-libplot         don't compile in support of charts (using libplot)])
 
   if test x"$with_libplot" != x"no" ; then 
-    AC_CHECK_LIB(plot, pl_newpl_r,,
-                [PSPP_REQUIRED_PREREQ([libplot (or use --without-libplot)])])
+    # 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
 ])
 
@@ -63,10 +83,10 @@ AC_DEFUN([PSPP_OFF_T],
   `--disable-largefile' or `CFLAGS=-ansi'.])])
 ])
 
-dnl Check whether a warning flag is accepted.
+dnl Check whether a C compiler option is accepted.
 dnl If so, add it to CFLAGS.
-dnl Example: PSPP_ENABLE_WARNING(-Wdeclaration-after-statement)
-AC_DEFUN([PSPP_ENABLE_WARNING],
+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], 
@@ -81,7 +101,7 @@ AC_DEFUN([PSPP_ENABLE_WARNING],
 
 dnl Check for readline and history libraries.
 
-dnl Modified for PSPP by Ben Pfaff, based on readline.m4 serial 3 from
+dnl Modified for PSPP, based on readline.m4 serial 3 from
 dnl gnulib, which was written by Simon Josefsson, with help from Bruno
 dnl Haible and Oskar Liljeblad.
 
@@ -150,4 +170,39 @@ AC_DEFUN([PSPP_READLINE],
   AC_SUBST(LTLIBREADLINE)
 ])
 
+dnl Check for build tools.  Adapted from bfd library.
+
+AC_DEFUN([PSPP_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+  if test "x$cross_compiling" = "xno"; then
+    CC_FOR_BUILD='$(CC)'
+  else
+    CC_FOR_BUILD=cc
+  fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+  EXEEXT_FOR_BUILD='$(EXEEXT)'
+else
+  AC_CACHE_CHECK([for build system executable suffix], pspp_cv_build_exeext,
+    [rm -f conftest*
+     echo 'int main () { return 0; }' > conftest.c
+     pspp_cv_build_exeext=
+     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+     for file in conftest.*; do
+       case $file in # (
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;; # (
+       *) pspp_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+     rm -f conftest*
+     test x"${pspp_cv_build_exeext}" = x && pspp_cv_build_exeext=no])
+  EXEEXT_FOR_BUILD=""
+  test x"${pspp_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${pspp_cv_build_exeex
+t}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])
+
 dnl aclocal.m4 ends here