Check for posix_fadvise, update TODO.
[pspp-builds.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl Initialize.
4 AX_PREREQ(2.57)
5 AC_INIT(pspp, 0.3.1,bug-gnu-pspp@gnu.org)
6 AC_CONFIG_HEADERS([config.h])
7 AM_INIT_AUTOMAKE
8
9 dnl Checks for programs.
10 AC_GNU_SOURCE
11 AC_PROG_CC
12
13 AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )
14
15
16 dnl Internationalization macros.
17 AM_GNU_GETTEXT
18 AM_GNU_GETTEXT_VERSION  dnl Prevents autoreconf complaint.
19
20 dnl Checks for libraries.
21 AC_CHECK_LIB(m, sin)
22 AC_CHECK_LIB(gmp, mpf_get_str,,
23         AC_CHECK_LIB(gmp, __gmpf_get_str,,
24           AC_MSG_ERROR([You must install libgmp])
25         )
26 )
27
28 AC_CHECK_LIB(gslcblas,main,,AC_MSG_ERROR([You must install libgslcblas]))
29 AC_CHECK_LIB(gsl,gsl_set_error_handler,,AC_MSG_ERROR([You must install libgsl]))
30
31 AC_CHECK_FUNC(getopt_long,,
32         AC_MSG_ERROR(`This application depends upon getopt_long'))
33
34 AC_CHECK_LIB(ncurses, tgetent, LIBS="-lncurses $LIBS" termcap=yes,
35   AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $LIBS" termcap=yes,
36                termcap=no))
37 if test "$termcap" = yes; then
38   AC_CHECK_HEADERS(termcap.h)
39   AC_DEFINE(HAVE_LIBTERMCAP, 1, 
40         [Define if you have the termcap library (-ltermcap).])
41 fi
42
43 AC_CHECK_LIB(readline, readline)
44 if test "$ac_cv_lib_readline_readline" = yes; then
45   AC_CHECK_HEADERS(readline/readline.h)
46   AC_CHECK_LIB(readline, add_history, history=yes,
47     AC_CHECK_LIB(history, add_history, LIBS="-lhistory" history=yes,
48                  history=no))
49   if test "$history" = yes; then
50     AC_CHECK_HEADERS(readline/history.h)
51     AC_DEFINE(HAVE_LIBHISTORY, 1,
52         [Define if you have the history library (-lhistory).])
53   fi
54 fi
55
56 dnl Checks for header files.
57 AC_CHECK_HEADERS([limits.h memory.h sys/stat.h sys/time.h sys/types.h \
58                   fpu_control.h sys/mman.h sys/wait.h ieeefp.h fenv.h])
59 AC_HEADER_STAT
60 AC_HEADER_STDC
61 AC_HEADER_TIME
62
63 AC_C_CONST
64 AC_C_INLINE
65 AC_TYPE_SIZE_T
66 AC_STRUCT_TM
67
68 AC_CHECK_SIZEOF(short, 2)
69 AC_CHECK_SIZEOF(int, 4)
70 AC_CHECK_SIZEOF(long, 4)
71 AC_CHECK_SIZEOF(long long, 0)
72 AC_CHECK_SIZEOF(float, 0)
73 AC_CHECK_SIZEOF(double, 8)
74 AC_CHECK_SIZEOF(long double, 0)
75
76 AC_DEFINE(FPREP_IEEE754, 1,
77         [Define for machines that have IEEE 754 floating point arithmetic,
78          the most common format today.])
79
80 AC_C_BIGENDIAN
81
82 BLP_IS_SPRINTF_GOOD
83 BLP_INT_DIGITS
84 BLP_RANDOM
85
86 AC_FUNC_ALLOCA
87 AC_FUNC_MEMCMP
88 AC_FUNC_VPRINTF
89 AC_REPLACE_FUNCS([memmove memset stpcpy strpbrk strerror strtol strtoul \
90                   memchr getline getdelim strcasecmp strncasecmp memmem \
91                   strtok_r])
92 AC_CHECK_FUNCS([gethostname strstr strtod __setfpucw isinf isnan finite \
93                 getpid feholdexcept mkdtemp posix_fadvise])
94
95 AC_PROG_LN_S
96
97
98
99 AH_BOTTOM([#include <pref.h>])
100
101 dnl This is needed otherwise --with-included-gettext fails
102 AH_BOTTOM([#include <locale.h>])
103
104 AC_ARG_ENABLE(debug, [  --enable-debug          Turn on diagnostic features in the program])
105 if test x"$enable_debug" = x"yes"  ; then
106   AC_DEFINE(DEBUGGING, 1, [Define to 1 if debugging is enabled.])
107 fi
108
109 AC_CONFIG_FILES([Makefile po/Makefile.in m4/Makefile 
110                  lib/Makefile lib/julcal/Makefile lib/misc/Makefile 
111                  doc/Makefile src/Makefile 
112                  config/Makefile tests/Makefile])
113 AC_CONFIG_COMMANDS([pref.h],[
114            # Copy pref.h from pref.h.orig if prudent
115            if test ! -f pref.h; then
116              echo "creating pref.h"
117              cp $ac_given_srcdir/pref.h.orig pref.h
118            elif test "`ls -t pref.h.orig pref.h 2>/dev/null | sed 1q`" = pref.h.orig; then
119              echo "replacing pref.h with newer pref.h.orig"
120              cp $ac_given_srcdir/pref.h.orig pref.h
121            else
122              echo "pref.h exists"
123            fi
124            if test -f pref.h; then touch pref.h; fi
125           ])
126 AC_OUTPUT(intl/Makefile)
127
128 dnl configure.ac ends here