Beginning of VFM cleanup.
[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_FUNC(getopt_long,,
29         AC_MSG_ERROR(`This application depends upon getopt_long'))
30
31   
32 AC_CHECK_LIB(ncurses, tgetent, LIBS="-lncurses $LIBS" termcap=yes,
33   AC_CHECK_LIB(termcap, tgetent, LIBS="-ltermcap $LIBS" termcap=yes,
34                termcap=no))
35 if test "$termcap" = yes; then
36   AC_CHECK_HEADERS(termcap.h)
37   AC_DEFINE(HAVE_LIBTERMCAP, 1, 
38         [Define if you have the termcap library (-ltermcap).])
39 fi
40
41 AC_CHECK_LIB(readline, readline)
42 if test "$ac_cv_lib_readline_readline" = yes; then
43   AC_CHECK_HEADERS(readline/readline.h)
44   AC_CHECK_LIB(readline, add_history, history=yes,
45     AC_CHECK_LIB(history, add_history, LIBS="-lhistory" history=yes,
46                  history=no))
47   if test "$history" = yes; then
48     AC_CHECK_HEADERS(readline/history.h)
49     AC_DEFINE(HAVE_LIBHISTORY, 1,
50         [Define if you have the history library (-lhistory).])
51   fi
52 fi
53
54 dnl Checks for header files.
55 AC_CHECK_HEADERS([limits.h memory.h sys/stat.h sys/time.h sys/types.h \
56                   fpu_control.h sys/mman.h sys/wait.h ieeefp.h fenv.h])
57 AC_HEADER_STAT
58 AC_HEADER_STDC
59 AC_HEADER_TIME
60
61 AC_C_CONST
62 AC_C_INLINE
63 AC_TYPE_SIZE_T
64 AC_STRUCT_TM
65
66 AC_CHECK_SIZEOF(short, 2)
67 AC_CHECK_SIZEOF(int, 4)
68 AC_CHECK_SIZEOF(long, 4)
69 AC_CHECK_SIZEOF(long long, 0)
70 AC_CHECK_SIZEOF(float, 0)
71 AC_CHECK_SIZEOF(double, 8)
72 AC_CHECK_SIZEOF(long double, 0)
73
74 AC_DEFINE(FPREP_IEEE754, 1,
75         [Define for machines that have IEEE 754 floating point arithmetic,
76          the most common format today.])
77
78 AC_C_BIGENDIAN
79
80 BLP_IS_SPRINTF_GOOD
81 BLP_INT_DIGITS
82 BLP_RANDOM
83
84 AC_FUNC_ALLOCA
85 AC_FUNC_MEMCMP
86 AC_FUNC_VPRINTF
87 AC_REPLACE_FUNCS([memmove memset stpcpy strpbrk strerror strtol strtoul \
88                   memchr getline getdelim strcasecmp strncasecmp memmem \
89                   strtok_r])
90 AC_CHECK_FUNCS([gethostname strstr strtod __setfpucw isinf isnan finite \
91                 getpid feholdexcept mkdtemp])
92
93 AC_PROG_LN_S
94
95
96
97 AH_BOTTOM([#include <pref.h>])
98
99 dnl This is needed otherwise --with-included-gettext fails
100 AH_BOTTOM([#include <locale.h>])
101
102 AC_ARG_ENABLE(debug, [  --enable-debug          Turn on diagnostic features in the program])
103 if test x"$enable_debug" = x"yes"  ; then
104   AC_DEFINE(DEBUGGING, 1, [Define to 1 if debugging is enabled.])
105 fi
106
107 AC_CONFIG_FILES([Makefile po/Makefile.in m4/Makefile 
108                  lib/Makefile lib/julcal/Makefile lib/misc/Makefile 
109                  lib/dcdflib/Makefile doc/Makefile src/Makefile 
110                  config/Makefile tests/Makefile])
111 AC_CONFIG_COMMANDS([pref.h],[
112            # Copy pref.h from pref.h.orig if prudent
113            if test ! -f pref.h; then
114              echo "creating pref.h"
115              cp $ac_given_srcdir/pref.h.orig pref.h
116            elif test "`ls -t pref.h.orig pref.h 2>/dev/null | sed 1q`" = pref.h.orig; then
117              echo "replacing pref.h with newer pref.h.orig"
118              cp $ac_given_srcdir/pref.h.orig pref.h
119            else
120              echo "pref.h exists"
121            fi
122            if test -f pref.h; then touch pref.h; fi
123           ])
124 AC_OUTPUT(intl/Makefile)
125
126 dnl configure.ac ends here