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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
|
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.58)
AC_INIT(monotone, 0.18, monotone-devel@nongnu.org)
AM_INIT_AUTOMAKE(1.7.1)
AC_CONFIG_SRCDIR([app_state.cc])
AC_CONFIG_TESTDIR([tests])
AM_CONFIG_HEADER([config.h])
# we have some sse2 code in cryptopp
# currently gcc does some surprising things here, so we disable it
# completely.
# AC_CHECK_HEADERS(emmintrin.h, [CXXFLAGS_MSSE2="-msse2"])
# autoconf turns on -g by default unless a user overrides. this is
# nice for smallish programs but it makes build times insane for
# spirit-based programs. we turn it off here unless the user turned it
# on themselves.
test "z$CXXFLAGS" = "z" && CXXFLAGS="-O2 -fno-strict-aliasing"
test "z$CFLAGS" = "z" && CFLAGS="-O2 -fno-strict-aliasing"
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB
AC_LANG(C++)
# check to see how to make objects in subdirs
AM_PROG_CC_C_O
# intl / gettext
# the AM_GNU_GETTEXT macro test won't compile with g++
AC_LANG_PUSH(C)
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.12.1)
AM_ICONV
AC_LANG_POP()
# Checks for idna stuff
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h errno.h)
AC_CACHE_CHECK([if setlocale() and nl_langinfo() works],
ac_cv_locale_works, [
AC_TRY_RUN([
#include <locale.h>
#include <langinfo.h>
int main ()
{
char* cs;
setlocale(LC_CTYPE, "");
cs = nl_langinfo(CODESET);
return !cs;
}
],
ac_cv_locale_works=yes,
ac_cv_locale_works=no,
ac_cv_locale_works=no)
])
if test "$ac_cv_locale_works" = "yes"; then
AC_DEFINE(LOCALE_WORKS, 1, [Define if setlocale() and nl_langinfo() works.])
fi
# check various C++ libs which confuse autoconf
# We don't use threads, but some Boost libraries make locking calls
# anyway. So we need to ensure that these symbols are available. But
# It's okay if they're just stubs.
AC_CHECK_FUNC([pthread_mutex_lock], [],
# But if there isn't even a stub, find the real threading library...
[ACX_PTHREAD(
# ...and if it exists, use it:
[LIBS="$PTHREAD_LIBS $LIBS"
CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"],
# ...but if it doesn't, oh well, maybe things will work out anyway:
[])])
# This is technically incorrect if Boost is for some reason compiled
# without threads on a system that does provide threads; we'll end up
# compiling monotone with thread support for no reason.
# Boost libraries have a string suffix that identifies the compiler
# they were built with, among other details. For example, it can be
# '-gcc', '-gcc-mt', '-gcc-mt-1_31', and many other combinations
# depending on the build system.
# Some systems provide symlinks that hide these suffixes, avoiding
# this mess. However, other systems don't; we have to provide a way
# to let the user manually specify a suffix. Guessing can be very
# difficult, given the variety of possibilities.
AC_ARG_VAR(BOOST_SUFFIX,
[String suffix that identifies Boost libraries (empty by default)])
AC_SUBST(BOOST_SUFFIX)
# Now check for Boost libraries proper.
found=no
suffixes=${BOOST_SUFFIX:-"none -gcc -mipspro -sunpro"}
for BOOST_SUFFIX in ${suffixes}
do
test "x${BOOST_SUFFIX}" = "xnone" && BOOST_SUFFIX=
LIBS="-lboost_unit_test_framework${BOOST_SUFFIX} $OLD_LIBS"
AC_MSG_CHECKING(for the libboost_unit_test_framework${BOOST_SUFFIX} library)
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <boost/test/unit_test_suite.hpp>
#include <boost/test/test_tools.hpp>
using boost::unit_test_framework::test_suite;
test_suite * init_unit_test_suite(int argc, char * argv[])
{ return NULL; }
]])],
[AC_MSG_RESULT([yes])
found=yes],
[AC_MSG_RESULT([no])])
LIBS=$OLD_LIBS
test "x${found}" = "xyes" && break
done
if test "x${found}" = "xno"; then
AC_MSG_FAILURE([libboost_unit_test_framework failure])
fi
LIBS="-lboost_filesystem${BOOST_SUFFIX} $LIBS"
AC_MSG_CHECKING(for the libboost_filesystem${BOOST_SUFFIX} library)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
using namespace boost::filesystem;
]],
[[exists(path("/boot"));]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libboost_filesystem failure])])
LIBS="-lboost_date_time${BOOST_SUFFIX} $LIBS"
AC_MSG_CHECKING(for the libboost_date_time${BOOST_SUFFIX} library)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
using namespace boost::posix_time;
]],
[[std::cout << to_iso_extended_string(second_clock::universal_time());]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libboost_date_time failure])])
LIBS="-lboost_regex${BOOST_SUFFIX} $LIBS"
AC_MSG_CHECKING(for the libboost_regex${BOOST_SUFFIX} library)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <boost/regex.hpp>
using namespace boost;
]],
[[regex expr("foo");]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_FAILURE([libboost_regex failure])])
# check for static boost option
AC_ARG_ENABLE(static-boost,
AS_HELP_STRING([--enable-static-boost@<:@=prefix@:>@],
[use static libs from boost]))
AM_CONDITIONAL(STATIC_BOOST, test "x${enable_static_boost}" != x)
if test "x${enable_static_boost}" != x
then
if echo "${enable_static_boost}" | grep '^/' >/dev/null
then
static_boost_prefixes="${enable_static_boost}"
else
static_boost_prefixes="/ /usr /opt /usr/local"
fi
AC_MSG_CHECKING([location of static boost libraries])
for i in ${static_boost_prefixes}
do
if test -e $i/lib64/libboost_regex${BOOST_SUFFIX}.a
then
BOOST_LIBDIR=$i/lib64
fi
if test -e $i/lib/libboost_regex${BOOST_SUFFIX}.a
then
BOOST_LIBDIR=$i/lib
fi
done
if test "x${BOOST_LIBDIR}" = x
then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([cannot find boost libraries for static link])
else
AC_MSG_RESULT([${BOOST_LIBDIR}])
LIBS=`echo ${LIBS} | tr ' ' '\n' | grep -v boost | tr '\n' ' '`
AC_SUBST(BOOST_LIBDIR)
fi
fi
AC_CACHE_CHECK([if this is Windows],
ac_win32, [
AC_TRY_RUN([
#ifdef WIN32
#include <windows.h>
int main(void)
{
return 0;
}
#else
__wont_compile_
#endif
],
AM_CONDITIONAL(WIN32_PLATFORM, true),
AM_CONDITIONAL(WIN32_PLATFORM, false),
AM_CONDITIONAL(WIN32_PLATFORM, false)
)])
# Check for IPv6. Let the user enable or disable it manually using a
# three-state (yes|no|auto) --enable argument.
AC_ARG_ENABLE(ipv6,
AS_HELP_STRING([--enable-ipv6],[enable IPv6 support (default=auto)]), ,
enable_ipv6=auto
)
AC_CACHE_CHECK([presence of IPv6],
ac_inet6,
[
ac_inet6=no
if test x"${enable_ipv6}" = x"auto" || test x"${enable_ipv6}" = x"yes"
then
AC_TRY_RUN([
#if defined(WIN32)
# include <winsock2.h>
#else
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
#endif
int main(void)
{
sockaddr_in6 sa_in6;
}
],
ac_inet6=yes
)
if test x"${enable_ipv6}" = x"yes" && test x"${ac_inet6}" = x"no"
then
AC_MSG_ERROR([IPv6 explicitly requested but it could not be found])
fi
fi
]
)
AM_CONDITIONAL(MISSING_INET6, test x"${ac_inet6}" = x"no")
# simple library checks
AC_SEARCH_LIBS([dlsym], [dl], AC_DEFINE(USE_DLOPEN))
AH_TEMPLATE([USE_DLOPEN], [For LUA: use dlopen for loadlib])
AC_SEARCH_LIBS([inet_aton], [resolv])
AC_SEARCH_LIBS([accept], [socket])
AC_SEARCH_LIBS([inet_ntoa], [nsl])
##########
# Checks for external lua library, revert to bundled version if not found or
# user gives --with-bundled-lua.
AC_ARG_WITH([bundled-lua],
AS_HELP_STRING(
[--with-bundled-lua],
[Force use of bundled version of lua (default=yes)]
), [bundled_lua="$withval"], [bundled_lua=yes]
)
if test "x$bundled_lua" = "xno" ; then
bundled_lua=yes
AC_CHECK_HEADERS([lua.h lualib.h],
AC_CHECK_LIB([lua], [lua_open],
AC_CHECK_LIB([lualib], [luaopen_base],
[LIBS="$LIBS -llua -llualib" ; bundled_lua=no], , [-llua]
)
)
)
fi
AM_CONDITIONAL(BUNDLED_LUA, test "x$bundled_lua" != "xno")
##########
# Checks for external sqlite library, revert to bundled version if not found or
# user gives --with-bundled-sqlite.
AC_ARG_WITH([bundled-sqlite],
AS_HELP_STRING(
[--with-bundled-sqlite],
[Force use of bundled version of sqlite (default=yes)]
), [bundled_sqlite="$withval"], [bundled_sqlite=yes]
)
if test "x$bundled_sqlite" = "xno" ; then
bundled_sqlite=yes
AC_CHECK_HEADER([sqlite3.h],
AC_CHECK_LIB([sqlite3], [sqlite3_open],
[LIBS="$LIBS -lsqlite3" ; bundled_sqlite=no]
)
)
fi
AM_CONDITIONAL(BUNDLED_SQLITE, test "x$bundled_sqlite" != "xno")
# Now let the user specify whether he wants large file support or not in
# sqlite.
AC_ARG_ENABLE([large-file],
AS_HELP_STRING(
[--disable-large-file],
[Disable large file support in builtin sqlite]
), , enable_large_file=yes
)
if test "x$enable_large_file" = "xno"; then
if test "x$bundled_sqlite" = "xno"; then
AC_MSG_WARN(--disable-large-file has no effect when using the bundled sqlite)
else
SQLITE_CPPFLAGS="$SQLITE_CPPFLAGS -DSQLITE_DISABLE_LFS"
fi
fi
AC_SUBST(SQLITE_CPPFLAGS)
##########
# Checks for bundled popt. We use it unconditionally, because the external
# one has serious bugs that we can't live with. Maybe some time in the
# future...
# The following was simply taken from the configure.in that comes with popt.
#AC_LANG_PUSH(C)
AC_CHECK_HEADERS([alloca.h float.h libintl.h mcheck.h])
AC_MSG_CHECKING(for /usr/ucblib in LIBS)
if test -d /usr/ucblib ; then
if test "$build" = "mips-sni-sysv4" ; then
addlib /usr/ccs/lib -lc
fi
addlib /usr/ucblib
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_CHECK_FUNCS(strerror mtrace getuid geteuid)
AC_CHECK_FUNC(setreuid, [], [
AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
])
POPT_SOURCE_PATH="`pwd`"
AC_DEFINE_UNQUOTED(POPT_SOURCE_PATH, "$POPT_SOURCE_PATH",
[Full path to popt top_sourcedir.])
AC_SUBST(POPT_SOURCE_PATH)
#AC_LANG_POP()
##########
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/file.h sys/socket.h sys/time.h termios.h unistd.h])
AX_CREATE_STDINT_H(mt-stdint.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HAVE_INADDR_NONE
AC_CHECK_MEMBERS([struct stat.st_ctim.tv_nsec, struct stat.st_mtim.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_ctimespec.tv_nsec, struct stat.st_mtimespec.tv_nsec])
AC_CHECK_MEMBERS([struct stat.st_ctimensec, struct stat.st_mtimensec])
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_STAT
AC_CHECK_FUNCS([atexit gethostbyaddr gethostbyname inet_ntoa memset mkstemp setenv socket])
AC_CHECK_FUNC(inet_pton, [AM_CONDITIONAL(MISSING_INET_PTON, false)],
[AM_CONDITIONAL(MISSING_INET_PTON, true)])
AC_CHECK_FUNC(inet_ntop, [AM_CONDITIONAL(MISSING_INET_NTOP, false)],
[AM_CONDITIONAL(MISSING_INET_NTOP, true)])
AC_CHECK_FUNC(getaddrinfo, [AM_CONDITIONAL(MISSING_GETADDRINFO, false)],
[AM_CONDITIONAL(MISSING_GETADDRINFO, true)])
AC_CONFIG_FILES([Makefile tests/atlocal po/Makefile.in])
AC_OUTPUT
|