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