-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
147 lines (127 loc) · 5.98 KB
/
configure.ac
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
AC_INIT([ClamFS],[1.3.1],[[email protected]],[clamfs])
AC_CONFIG_AUX_DIR(build)
AC_CONFIG_SRCDIR(src/clamfs.cxx)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR(m4)
AM_INIT_AUTOMAKE
AM_CONDITIONAL([DOT_GIT], [test -d .git])
# Checks for programs
AC_PROG_CXX
AC_PROG_CC
# Set language to C++
AC_LANG([C++])
# Checks for header files
AC_HEADER_DIRENT
AC_CHECK_HEADERS([fcntl.h string.h unistd.h stdlib.h malloc.h])
# Checks for typedefs, structures, and compiler characteristics
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
# Check for functions
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_UTIME_NULL
AC_CHECK_FUNCS([fchdir fdatasync fork ftruncate fstatat utimensat posix_fallocate copy_file_range lchown memset mkdir mkfifo rmdir setxattr strdup strerror utime mallinfo mallinfo2])
# Check for BSD 4.4 / RFC2292 style fd passing
AC_C_FDPASSING
# Set initial CPPFLAGS and LDFLAGS
CPPFLAGS="$CPPFLAGS -Wall -Werror -Wextra -Wdate-time"
CPPFLAGS="$CPPFLAGS -Wformat -Wformat-security"
CPPFLAGS="$CPPFLAGS -Wcast-align -Wcast-qual -Wchar-subscripts"
CPPFLAGS="$CPPFLAGS -Wformat-nonliteral -Wpointer-arith -Wredundant-decls"
CPPFLAGS="$CPPFLAGS -Wreturn-type -Wshadow -Wswitch -Wunused-parameter -Wwrite-strings"
CPPFLAGS="$CPPFLAGS -fstack-protector-strong -fPIC -fPIE"
LDFLAGS="$LDFLAGS -pie -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,--fatal-warnings"
# Check whether to add -D_FORTIFY_SOURCE=? to CPPFLAGS
AX_ADD_FORTIFY_SOURCE
# Checks for boost
AX_BOOST_BASE(1.33)
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
# Check for libfuse3
PKG_CHECK_MODULES([FUSE3],[fuse3 >= 3],
[CPPFLAGS="$CPPFLAGS $FUSE3_CFLAGS -pthread -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=31"
LIBS="$LIBS $FUSE3_LIBS"])
PKG_CHECK_MODULES([FUSE38],[fuse3 >= 3.8],AC_DEFINE([HAVE_FUSE_LSEEK],[1],[Define to 1 if you have the lseek() support in FUSE library.]),
AC_MSG_WARN([disabling lseek() support as building with FUSE version < 3.8.0]))
# Check for libulockmgr
AC_CHECK_HEADER(ulockmgr.h,AC_DEFINE([HAVE_LIBULOCKMGR],[1],[Define to 1 if you have the `ulockmgr` library.]))
AC_CHECK_LIB(ulockmgr,ulockmgr_op,LIBS="$LIBS -lulockmgr")
# Check for libpoco
AC_CHECK_HEADER(Poco/Exception.h,,AC_MSG_ERROR([Poco/Exception.h]))
AC_CHECK_HEADER(Poco/Logger.h,,AC_MSG_ERROR([Poco/Logger.h]))
AC_CHECK_HEADER(Poco/ExpireLRUCache.h,,AC_MSG_ERROR([Poco/ExpireLRUCache.h not found!]))
AC_CHECK_HEADER(Poco/Net/MailMessage.h,,AC_MSG_ERROR([Poco/Net/MailMessage.h]))
AC_CHECK_HEADER(Poco/Net/MailRecipient.h,,AC_MSG_ERROR([Poco/Net/MailRecipient.h]))
AC_CHECK_HEADER(Poco/Net/SMTPClientSession.h,,AC_MSG_ERROR([Poco/Net/SMTPClientSession.h]))
AC_CHECK_HEADER(Poco/XML/expat.h,,AC_DEFINE([POCO_UNBUNDLED],[1],[Set to 1 if you prefer system dependencies instead of components bundled with the `POCO` library.]))
AC_CHECK_HEADER(Poco/SAX/SAXParser.h,,AC_MSG_ERROR([Poco/SAX/SAXParser.h]))
AC_CHECK_HEADER(Poco/SAX/ContentHandler.h,,AC_MSG_ERROR([Poco/SAX/ContentHandler.h]))
AC_CHECK_HEADER(Poco/SAX/LexicalHandler.h,,AC_MSG_ERROR([Poco/SAX/LexicalHandler.h]))
AC_CHECK_HEADER(Poco/SAX/Attributes.h,,AC_MSG_ERROR([Poco/SAX/Attributes.h]))
AC_CHECK_HEADER(Poco/SAX/Locator.h,,AC_MSG_ERROR([Poco/SAX/Locator.h]))
# There is no portable way to check for C++ symbol with AC_CHECK_LIB().
# Mangling C++ symbols is not portable. Hacks like using main() or _start()
# are neither portable enough. Calling main() is forbidden in C++.
# Symbol _start() is non-standard and does not exists on mips(64)el.
#AC_CHECK_LIB(PocoFoundation,_start,LIBS="$LIBS -lPocoFoundation",AC_MSG_ERROR([libPocoFoundation not found!]))
#AC_CHECK_LIB(PocoNet,_start,LIBS="$LIBS -lPocoNet",AC_MSG_ERROR([libPocoNet not found!]))
#AC_CHECK_LIB(PocoXML,_start,LIBS="$LIBS -lPocoXML",AC_MSG_ERROR([libPocoXML not found!]))
CPPFLAGS="$CPPFLAGS -DPOCO_LOG_DEBUG"
LIBS="$LIBS -lPocoFoundation -lPocoNet -lPocoXML"
# Use option --enable-gcc-debug to enable GCC debug code.
AC_ARG_ENABLE(gcc-debug,
AS_HELP_STRING([--enable-gcc-debug],[enable GCC DEBUG code]),
[enable_gcc_debug=yes],
[enable_gcc_debug=no])
if test "$enable_gcc_debug" = "yes" && (test "$GXX" = "yes"); then
CPPFLAGS="$CPPFLAGS -O0 -ggdb"
AC_MSG_RESULT([Enabling GCC debug...])
else
CPPFLAGS="$CPPFLAGS -O2 -DNDEBUG"
fi
# Use option --enable-clang-flags to enable CLANG flags.
AC_ARG_ENABLE(clang-flags,
AS_HELP_STRING([--enable-clang-flags],[enable CLANG flags]),
[enable_clang_flags=yes],
[enable_clang_flags=no])
if test "$enable_clang_flags" = "yes" && (test "$GXX" = "yes"); then
CPPFLAGS="$CPPFLAGS -Wfour-char-constants -Wpointer-arith -Wwrite-strings -Wcast-align"
CPPFLAGS="$CPPFLAGS -Wconversion -Wfloat-equal -Wformat=2 -Wimplicit-atomic-properties"
CPPFLAGS="$CPPFLAGS -Wmissing-declarations"
CPPFLAGS="$CPPFLAGS -Woverlength-strings -Wshadow"
CPPFLAGS="$CPPFLAGS -Wstrict-selector-match -Wundeclared-selector"
CPPFLAGS="$CPPFLAGS -Wunreachable-code -Wthread-safety"
AC_MSG_RESULT([Enabling CLANG flags...])
fi
# Use option --enable-dmalloc-debug to enable dmalloc debug code.
AC_ARG_ENABLE(dmalloc-debug,
AS_HELP_STRING([--enable-dmalloc-debug],[enable dmalloc debug code]),
[enable_dmalloc_debug=yes],
[enable_dmalloc_debug=no])
if test "$enable_dmalloc_debug" = "yes" && (test "$GXX" = "yes"); then
AC_CHECK_HEADER(dmalloc.h,CPPFLAGS="$CPPFLAGS -DDMALLOC",AC_MSG_ERROR([dmalloc.h not found!]))
AC_CHECK_LIB(dmallocthcxx,dmalloc_shutdown,LIBS="$LIBS -ldmallocthcxx",AC_MSG_ERROR([libdmallocthcxx not found!]))
AC_MSG_RESULT([Enabling dmalloc debug...])
fi
# Use option --gprof to enable gprof support
AC_ARG_ENABLE(gprof,
AS_HELP_STRING([--enable-gprof],[enable gprof support]),
[enable_gprof=yes],
[enable_gprof=no])
if test "$enable_gprof" = "yes" && (test "$GXX" = "yes"); then
CPPFLAGS="$CPPFLAGS -pg"
AC_MSG_RESULT([Enabling gprof...])
fi
AC_CONFIG_FILES([Makefile
src/Makefile
doc/Makefile
doc/Doxyfile
doc/svg/Makefile
])
AC_OUTPUT