X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=acinclude.m4;h=cbf927aad0cf60cec556282c0f52b9c562ad81fc;hb=51010fcf5cc308367c1fe3fafa785a3d2216b03d;hp=6fc3085c031e29db893a02746899c545a6aa8d29;hpb=480a0746507ce73d26f528b56dc3ed80195096e0;p=pspp-builds.git diff --git a/acinclude.m4 b/acinclude.m4 index 6fc3085c..cbf927aa 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -37,36 +37,41 @@ AC_DEFUN([PSPP_PERL], dnl Check that libplot is available. AC_DEFUN([PSPP_LIBPLOT], [ - AC_ARG_WITH(libplot, [ --without-libplot don't compile in support of charts (using libplot)]) + AC_ARG_WITH( + libplot, + [AS_HELP_STRING([--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)])]) - fi -]) + # Check whether we can link against libplot without any extra libraries. + AC_CHECK_LIB(plot, pl_newpl_r, [LIBPLOT_LIBS="-lplot"]) -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 - #include - 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'.])]) + # 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 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], @@ -98,7 +103,7 @@ AC_DEFUN([PSPP_READLINE], dnl Add $INCREADLINE to CPPFLAGS before performing the following checks, dnl because if the user has installed libreadline and not disabled its use - dnl via --without-libreadline-prefix, he wants to use it. The AC_TRY_LINK + dnl via --without-libreadline-prefix, he wants to use it. The AC_LINK_IFELSE dnl will then succeed. am_save_CPPFLAGS="$CPPFLAGS" AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCREADLINE $INCHISTORY]) @@ -116,11 +121,9 @@ AC_DEFUN([PSPP_READLINE], if test -n "$extra_lib"; then LIBS="$LIBS -l$extra_lib" fi - AC_TRY_LINK([#include + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include #include -#include ], - [readline((char*)0); add_history((char*)0);], - gl_cv_lib_readline=yes) +#include ]], [[readline((char*)0); add_history((char*)0);]])],[gl_cv_lib_readline=yes],[]) if test "$gl_cv_lib_readline" = yes; then if test -n "$extra_lib"; then LIBREADLINE="$LIBREADLINE $LIBHISTORY -l$extra_lib" @@ -150,4 +153,56 @@ AC_DEFUN([PSPP_READLINE], AC_SUBST(LTLIBREADLINE) ]) -dnl aclocal.m4 ends here +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 Check for LC_PAPER, _NL_PAPER_WIDTH, _NL_PAPER_HEIGHT. +AC_DEFUN([PSPP_LC_PAPER], +[AC_CACHE_CHECK(for LC_PAPER, pspp_cv_lc_paper, [ + pspp_cv_lc_paper=no + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include +#include +], + [(void) LC_PAPER; (void) _NL_PAPER_WIDTH; (void) _NL_PAPER_HEIGHT])], + [pspp_cv_lc_paper=yes]) + ]) + if test "$pspp_cv_lc_paper" = yes; then + AC_DEFINE(HAVE_LC_PAPER, 1, [Define if you have LC_PAPER.]) + fi +]) + +dnl acinclude.m4 ends here