summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 8942d5eb6c4bb98c21b6e9f223aa985497c4c2ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.56)
AC_INIT([Baltisot],[0.1.0],[pixel@nobis-crew.org])
AM_INIT_AUTOMAKE(Baltisot, 0.1.0)
AC_CONFIG_SRCDIR(src/Main.cc)
AM_CONFIG_HEADER(config.h)

AM_MAINTAINER_MODE

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_YACC
AM_PROG_LIBTOOL
AC_C_BIGENDIAN

# Checks for libraries.
AC_CHECK_LIB([c], [printf])
AM_PATH_MYSQL(AC_DEFINE(HAVE_MYSQL, 1, [Have MySQL]))

# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_STDBOOL
AC_HEADER_STAT
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_CHECK_HEADERS([argz.h fcntl.h inttypes.h langinfo.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_STRUCT_TM
AC_C_VOLATILE

# Checks for library functions.
AM_GNU_GETTEXT()
AC_SUBST(USE_INCLUDED_LIBINTL)
ALL_LINGUAS="fr"
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_FUNC_STAT
AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify getcwd gethostbyname memmove mempcpy memset munmap nl_langinfo regcomp setlocale socket stpcpy strcasecmp strchr strcspn strdup strerror strrchr strstr strtoul pipe sleep fcntl vsnprintf gettimeofday asprintf vasprintf])

AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(deflate, z)

if test x$ac_cv_search_deflate != xno ; then
  OLDCPPFLAGS=$CPPFLAGS
  CPPFLAGS="-Werror"
  AC_CACHE_CHECK([for well defined gzwrite in zlib.h], ac_cv_wd_gzwrite,
    AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM(
        [[#include <zlib.h>]],
	[[const char * buf = "Poide"; gzwrite(NULL, buf, 10);]]
      )],
      [AC_DEFINE([HAVE_WD_ZLIB], 1, [Have a well structured ZLIB])
       ac_cv_wd_gzwrite="yes"],[ac_cv_wd_gzwrite="no"
    ])
  )
  CPPFLAGS=$OLDCPPFLAGS
else
  AC_MSG_ERROR([no zlib found in the system.])
fi

if test x$ac_cv_wd_gzwrite != xyes ; then
  AC_MSG_WARN([You have a broken zconf.h.]
              [You should patch this using]
	      [the zconf.h-patch file.]
  	      [Enabling workaround.])
fi

GMP_LIBS="-lm"
AC_LANG_PUSH(C++)

if test "$with_gmp" != "no"; then
  AC_ARG_WITH(gmp-prefix, [  --with-gmp-prefix=DIR   path to GMP],
   [if test "$withval" != "no"; then
      CPPFLAGS="${CPPFLAGS} -I$withval/include"
      LDFLAGS="${LDFLAGS} -L$withval/lib"
    fi],
   dnl debian brain-damage 
   [if test -d /usr/include/gmp2; then
      CPPFLAGS="${CPPFLAGS} -I/usr/include/gmp2"
    fi])

  found_gmp=no
  AC_CHECK_HEADER(gmpxx.h,
    [AC_CHECK_LIB(gmp, mpz_init,
       [GMP_LIBS="-lgmp -lm"; found_gmp=yes],
       [AC_CHECK_LIB(gmp, __gmpz_init,
          [GMP_LIBS="-lgmp -lm"; found_gmp=yes])])])

  if test "$found_gmp" = "yes"; then
    AC_DEFINE([HAVE_GMP], 1, [Have the GMP library])
    AC_CHECK_LIB(gmpxx, main,
	[GMP_LIBS="-lgmp -lm -lgmpxx"])
    LIBS="$LIBS $GMP_LIBS"
    AC_CHECK_FUNC(__gmp_randinit, AC_DEFINE([HAVE_GMP_RANDINIT], 1, [Have the RandInit function]))
#  elif test "$with_gmp" != "no"; then
#    AC_MSG_ERROR([Can't find GMP (--without-gmp for cut-down non-GMP build)])
  fi
fi

AC_LANG_POP(C++)
AC_SUBST(GMP_LIBS)

AC_DEFINE([HOOK_STDS], 1, [Hook the standard input/outputs])

AC_CHECK_FUNCS(gethostbyname)
AC_CHECK_FUNCS(regcomp)
AC_CHECK_FUNCS(socket)

AC_PATH_PROG(gmakepath, gmake)
AC_PATH_PROG(unamepath, uname)
if test "x$unamepath" = x; then
    system="unknown"
else
    AC_MSG_CHECKING(system type)
    system=`$unamepath -s`
    AC_MSG_RESULT($system)
fi

AC_ARG_ENABLE([debug],
              [  --enable-debug          enable verbose debugging],
              AC_DEFINE(DEBUG, 1, [Enable verbose debugging]))

AC_ARG_ENABLE([efence],
              [  --enable-efence         enable compiling with electic-fence],
	      AC_SEARCH_LIBS(EF_Print, efence))

AC_CONFIG_FILES([baltisot-config
                 Makefile
                 doc/Makefile
                 include/Makefile
                 intl/Makefile
                 lib/Makefile
                 m4/Makefile
		 po/Makefile.in
                 src/Makefile
                 src/datas/Makefile], [ chmod +x baltisot-config ])
AC_OUTPUT


echo
echo \-\-\= $PACKAGE $VERSION \=\-\-
echo

echo Build System .................... : $system
echo Build Host ...................... : $host
echo Install Prefix .................. : $prefix
echo

if test _"$gmakepath" = _; then
    echo configure complete, now type \'make\'
else
    echo configure complete, now type \'gmake\'
fi