1AC_INIT([ClamFS], [1.1.0], [krzysztof@burghardt.pl], [clamfs])
2AC_CONFIG_AUX_DIR(build)
3AC_CONFIG_SRCDIR(src/clamfs.cxx)
4AM_CONFIG_HEADER(config.h)
5AM_INIT_AUTOMAKE
6AM_CONDITIONAL([DOT_GIT], [test -d .git])
7
8# Checks for programs
9AC_PROG_CXX
10AC_PROG_CC
11
12# Set language to C++
13AC_LANG_CPLUSPLUS
14
15# Checks for header files
16AC_HEADER_DIRENT
17AC_HEADER_STDC
18AC_CHECK_HEADERS([fcntl.h string.h unistd.h stdlib.h malloc.h])
19
20# Checks for typedefs, structures, and compiler characteristics
21AC_HEADER_STDBOOL
22AC_C_CONST
23AC_TYPE_UID_T
24AC_C_INLINE
25AC_TYPE_MODE_T
26AC_TYPE_OFF_T
27AC_TYPE_SIZE_T
28
29# Check for functions
30AC_FUNC_CLOSEDIR_VOID
31AC_FUNC_LSTAT
32AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
33AC_FUNC_UTIME_NULL
34AC_CHECK_FUNCS([fchdir fdatasync fork ftruncate lchown memset mkdir mkfifo rmdir setxattr strdup strerror utime mallinfo])
35
36# Set initial CPPFLAGS
37CPPFLAGS="$CPPFLAGS -Wall -Wextra"
38
39# Checks for boost
40AX_BOOST_BASE(1.33)
41CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
42LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
43
44# Checks for libfuse
45CPPFLAGS="$CPPFLAGS -pthread -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
46AC_CHECK_HEADER(fuse.h,,AC_MSG_ERROR([fuse.h not found!]))
47AC_CHECK_LIB(fuse,fuse_main,LIBS="$LIBS -lfuse",AC_MSG_ERROR([libfuse not found!]))
48
49# Check for librlog
50CPPFLAGS="$CPPFLAGS -DRLOG_COMPONENT=clamfs"
51AC_CHECK_HEADER(rlog/rlog.h,,AC_MSG_ERROR([rlog/rlog.h not found!]))
52AC_CHECK_LIB(rlog,RLogVersion,LIBS="$LIBS -lrlog",AC_MSG_ERROR([librlog not found!]))
53
54# Check for libpoco
55AC_CHECK_HEADER(Poco/Exception.h,,AC_MSG_ERROR([Poco/Exception.h]))
56AC_CHECK_HEADER(Poco/ExpireLRUCache.h,,AC_MSG_ERROR([Poco/ExpireLRUCache.h not found!]))
57AC_CHECK_HEADER(Poco/Net/MailMessage.h,,AC_MSG_ERROR([Poco/Net/MailMessage.h]))
58AC_CHECK_HEADER(Poco/Net/MailRecipient.h,,AC_MSG_ERROR([Poco/Net/MailRecipient.h]))
59AC_CHECK_HEADER(Poco/Net/SMTPClientSession.h,,AC_MSG_ERROR([Poco/Net/SMTPClientSession.h]))
60AC_CHECK_HEADER(Poco/SAX/SAXParser.h,,AC_MSG_ERROR([Poco/SAX/SAXParser.h]))
61AC_CHECK_HEADER(Poco/SAX/ContentHandler.h,,AC_MSG_ERROR([Poco/SAX/ContentHandler.h]))
62AC_CHECK_HEADER(Poco/SAX/LexicalHandler.h,,AC_MSG_ERROR([Poco/SAX/LexicalHandler.h]))
63AC_CHECK_HEADER(Poco/SAX/Attributes.h,,AC_MSG_ERROR([Poco/SAX/Attributes.h]))
64AC_CHECK_HEADER(Poco/SAX/Locator.h,,AC_MSG_ERROR([Poco/SAX/Locator.h]))
65AC_CHECK_LIB(PocoFoundation,_start,LIBS="$LIBS -lPocoFoundation",AC_MSG_ERROR([libPocoFoundation not found!]))
66AC_CHECK_LIB(PocoNet,_start,LIBS="$LIBS -lPocoNet",AC_MSG_ERROR([libPocoNet not found!]))
67AC_CHECK_LIB(PocoXML,_start,LIBS="$LIBS -lPocoXML",AC_MSG_ERROR([libPocoXML not found!]))
68
69dnl Use option --enable-gcc-debug to enable GCC debug code.
70AC_ARG_ENABLE(gcc-debug,
71AC_HELP_STRING([--enable-gcc-debug],
72        [enable GCC DEBUG code]),
73        [enable_gcc_debug=yes],
74        [enable_gcc_debug=no])
75if test "$enable_gcc_debug" = "yes" && (test "$GXX" = "yes"); then
76 CPPFLAGS="$CPPFLAGS -O0 -ggdb"
77 AC_MSG_RESULT([Enabling GCC debug...])
78else
79 CPPFLAGS="$CPPFLAGS -O2 -DNDEBUG"
80fi
81
82dnl Use option --enable-clang-flags to enable CLANG flags.
83AC_ARG_ENABLE(clang-flags,
84AC_HELP_STRING([--enable-clang-flags],
85        [enable enable CLANG flags]),
86        [enable_clang_flags=yes],
87        [enable_clang_flags=no])
88if test "$enable_clang_flags" = "yes" && (test "$GXX" = "yes"); then
89 CPPFLAGS="$CPPFLAGS -Wfour-char-constants -Wpointer-arith -Wwrite-strings -Wcast-align"
90 CPPFLAGS="$CPPFLAGS -Wconversion -Wfloat-equal -Wformat=2 -Wimplicit-atomic-properties"
91 CPPFLAGS="$CPPFLAGS -Wmissing-declarations -Wmissing-prototypes -Woverlength-strings"
92 CPPFLAGS="$CPPFLAGS -Wshadow -Wstrict-selector-match -Wundeclared-selector"
93#CPPFLAGS="$CPPFLAGS -Wunreachable-code"
94 AC_MSG_RESULT([Enabling CLANG flags...])
95fi
96
97dnl Use option --enable-dmalloc-debug to enable dmalloc debug code.
98AC_ARG_ENABLE(dmalloc-debug,
99AC_HELP_STRING([--enable-dmalloc-debug],
100        [enable dmalloc debug code]),
101        [enable_dmalloc_debug=yes],
102        [enable_dmalloc_debug=no])
103if test "$enable_dmalloc_debug" = "yes" && (test "$GXX" = "yes"); then
104 AC_CHECK_HEADER(dmalloc.h,CPPFLAGS="$CPPFLAGS -DDMALLOC",AC_MSG_ERROR([dmalloc.h not found!]))
105 AC_CHECK_LIB(dmallocthcxx,dmalloc_shutdown,LIBS="$LIBS -ldmallocthcxx",AC_MSG_ERROR([libdmallocthcxx not found!]))
106 AC_MSG_RESULT([Enabling dmalloc debug...])
107fi
108
109dnl Use option --gprof to enable gprof support
110AC_ARG_ENABLE(gprof,
111AC_HELP_STRING([--enable-gprof],
112        [enable gprof support]),
113        [enable_gprof=yes],
114        [enable_gprof=no])
115if test "$enable_gprof" = "yes" && (test "$GXX" = "yes"); then
116 CPPFLAGS="$CPPFLAGS -pg"
117 AC_MSG_RESULT([Enabling gprof...])
118fi
119
120AC_CONFIG_FILES([Makefile
121 src/Makefile
122 doc/Makefile
123 doc/Doxyfile
124 doc/svg/Makefile
125 ])
126AC_OUTPUT
127