summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: 9533bffb1870311d844cd1d19ef4e052e0b57687 (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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT(muchsync, 5)
AM_INIT_AUTOMAKE([-Wall])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])

dnl On arch, clang++ is not compatible with all libraries
dnl AC_PROG_CXX([clang++ eg++ g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC])
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
: ${WFLAGS=-Wall}
CXXFLAGS="$CXXFLAGS $WFLAGS"
dnl AC_USE_SYSTEM_EXTENSIONS
AC_LANG(C++)
# -pthread Seems to be required by g++ -stc=c++11
AX_APPEND_COMPILE_FLAGS([-pthread])

AC_CHECK_FUNCS(openat)
AC_CHECK_FUNCS(fdopendir)

PKG_CHECK_MODULES([sqlite3], [sqlite3])
PKG_CHECK_MODULES([libcrypto], [libcrypto])

AC_PATH_PROG(XAPIAN_CONFIG, xapian-config)
test -n "$XAPIAN_CONFIG" || AC_MSG_ERROR(Cannot find xapian-config)
if ! xapian_CPPFLAGS=$($XAPIAN_CONFIG --cxxflags) \
   || ! xapian_LIBS=$($XAPIAN_CONFIG --libs); then
   AC_MSG_ERROR(Error running $XAPIAN_CONFIG)
fi
AC_SUBST(xapian_CPPFLAGS)
AC_SUBST(xapian_LIBS)

AC_MSG_CHECKING(For st_mtim in struct stat)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <time.h>
#include <sys/time.h>
#include <sys/stat.h>],
[return sizeof(stat::st_mtim) > 0;])],
have_st_mtim=yes, have_st_mtim=no)
AC_MSG_RESULT($have_st_mtim)

if test yes = "$have_st_mtim"; then
   ST_MTIM=st_mtim
else
   AC_MSG_CHECKING(For st_mtimespec in struct stat)
   AC_COMPILE_IFELSE(
   [AC_LANG_PROGRAM([#include <time.h>
#include <sys/time.h>
#include <sys/stat.h>],
   [int sz = sizeof(stat::st_mtimespec);])],
   have_st_mtimespec=yes, have_st_mtimespec=no)
   AC_MSG_RESULT($have_st_mtimespec)
   if test yes = "$have_st_mtimespec"; then
      ST_MTIM=st_mtimespec
   else
	AC_MSG_ERROR(Cannot find nanoseconds mtime in stat struct)
   fi
fi
AC_DEFINE_UNQUOTED(ST_MTIM, $ST_MTIM,
Name of timespec modification time field in stat structure)

AC_CONFIG_FILES([Makefile])
AC_OUTPUT