Use AC_TYPE_OFF_T/HAVE_OFF_T to check for off_t.
[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
17 dnl Internationalization macros.
18 AM_GNU_GETTEXT
19 AM_GNU_GETTEXT_VERSION  dnl Prevents autoreconf complaint.
20
21 dnl Checks for libraries.
22 AC_SYS_LARGEFILE
23 AC_FUNC_FSEEKO
24 AC_CHECK_LIB(m, sin)
25 AC_CHECK_LIB(gmp, mpf_get_str,,
26         AC_CHECK_LIB(gmp, __gmpf_get_str,,
27           AC_MSG_ERROR([You must install libgmp])
28         )
29 )
30
31 AC_CHECK_LIB(gslcblas,main,,AC_MSG_ERROR([You must install libgslcblas]))
32 AC_CHECK_LIB(gsl, gsl_cdf_chisq_Q,,
33         AC_MSG_ERROR([You must install libgsl version 1.4 or later]))
34
35 AC_CHECK_LIB(gnugetopt,getopt_long)
36 AC_CHECK_FUNC(getopt_long,,
37         AC_MSG_ERROR(`This application depends upon getopt_long'))
38
39 AC_ARG_WITH(ncurses,
40 [  --without-ncurses         don't compile in ncurses command line editing])
41
42
43 if test "x$with_ncurses" = x"yes"; then 
44 AC_CHECK_LIB(ncurses, tgetent, LIBS="-lncurses $LIBS" termcap=yes,
45   AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $LIBS" termcap=yes,
46                termcap=no))
47 fi
48
49
50 if test "$termcap" = yes; then
51   AC_CHECK_HEADERS(termcap.h)
52   AC_DEFINE(HAVE_LIBTERMCAP, 1, 
53         [Define if you have the termcap library (-ltermcap).])
54 fi
55
56 AC_CHECK_LIB(readline, readline)
57 if test "$ac_cv_lib_readline_readline" = yes; then
58   AC_CHECK_HEADERS(readline/readline.h)
59   AC_CHECK_LIB(readline, add_history, history=yes,
60     AC_CHECK_LIB(history, add_history, LIBS="-lhistory" history=yes,
61                  history=no))
62   if test "$history" = yes; then
63     AC_CHECK_HEADERS(readline/history.h)
64     AC_DEFINE(HAVE_LIBHISTORY, 1,
65         [Define if you have the history library (-lhistory).])
66   fi
67 fi
68
69 dnl Checks for header files.
70 AC_CHECK_HEADERS([limits.h memory.h sys/stat.h sys/time.h sys/types.h \
71                   fpu_control.h sys/mman.h sys/wait.h ieeefp.h fenv.h \
72                   valgrind/valgrind.h])
73 AC_HEADER_STAT
74 AC_HEADER_STDC
75 AC_HEADER_TIME
76
77 AC_C_CONST
78 AC_C_INLINE
79 AC_TYPE_OFF_T
80 AC_TYPE_SIZE_T
81 AC_STRUCT_TM
82
83 AC_CHECK_SIZEOF(short, 2)
84 AC_CHECK_SIZEOF(int, 4)
85 AC_CHECK_SIZEOF(long, 4)
86 AC_CHECK_SIZEOF(long long, 0)
87 AC_CHECK_SIZEOF(float, 0)
88 AC_CHECK_SIZEOF(double, 8)
89 AC_CHECK_SIZEOF(long double, 0)
90
91 AC_DEFINE(FPREP_IEEE754, 1,
92         [Define for machines that have IEEE 754 floating point arithmetic,
93          the most common format today.])
94
95 AC_C_BIGENDIAN
96
97 BLP_IS_SPRINTF_GOOD
98 BLP_INT_DIGITS
99 BLP_RANDOM
100
101 AC_FUNC_ALLOCA
102 AC_FUNC_MEMCMP
103 AC_FUNC_VPRINTF
104 AC_REPLACE_FUNCS([memmove memset stpcpy strpbrk strerror strtol strtoul \
105                   memchr getline getdelim strcasecmp strncasecmp memmem \
106                   strtok_r])
107 AC_CHECK_FUNCS([gethostname strstr strtod __setfpucw isinf isnan finite \
108                 getpid feholdexcept mkdtemp])
109
110 AC_PROG_LN_S
111
112
113 AH_BOTTOM([#include <pref.h>])
114
115
116 AM_CONDITIONAL(unix, test x"$host_os" != x"msdos" )
117 AM_CONDITIONAL(msdos, test x"$host_os" == x"msdos" )
118
119 dnl This is needed otherwise --with-included-gettext fails
120 AH_BOTTOM([#include <locale.h>])
121
122 AC_ARG_ENABLE(debug, [  --enable-debug          Turn on diagnostic features in the program])
123 if test x"$enable_debug" = x"yes"  ; then
124   AC_DEFINE(DEBUGGING, 1, [Define to 1 if debugging is enabled.])
125 fi
126
127 AC_CONFIG_FILES([Makefile po/Makefile.in m4/Makefile 
128                  lib/Makefile lib/julcal/Makefile lib/misc/Makefile 
129                  doc/Makefile src/Makefile 
130                  config/Makefile tests/Makefile])
131 AC_CONFIG_COMMANDS([pref.h],[
132            # Copy pref.h from pref.h.orig if prudent
133            if test ! -f pref.h; then
134              echo "creating pref.h"
135              cp $ac_given_srcdir/pref.h.orig pref.h
136            elif test "`ls -t pref.h.orig pref.h 2>/dev/null | sed 1q`" = pref.h.orig; then
137              echo "replacing pref.h with newer pref.h.orig"
138              cp $ac_given_srcdir/pref.h.orig pref.h
139            else
140              echo "pref.h exists"
141            fi
142            if test -f pref.h; then touch pref.h; fi
143           ])
144 AC_OUTPUT(intl/Makefile)
145
146 dnl configure.ac ends here