forked from DOMjudge/checktestdata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
79 lines (66 loc) · 2.78 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
# Process this file with autoconf to produce a configure script.
AC_INIT([checktestdata],m4_esyscmd([date '+%Y%m%d' | tr -d '\n']]),
AC_PREREQ([2.64])
AC_CONFIG_SRCDIR([checktestdata.cc])
# Set default {CXX,LD}FLAGS. This might screw up portability, but
# adds important security. Only set these flags when none are supplied
# by the user.
for flag in CXXFLAGS LDFLAGS ; do
AC_MSG_CHECKING([whether configure should try to set $flag])
if test x`eval echo '${'$flag'+set}'` = xset ; then res=no ; else res=yes ; fi
eval enable_${flag}_setting=$res
AC_MSG_RESULT($res)
done
DEF_CXXFLAGS="-g -O2"
DEF_LDFLAGS=""
AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS(-Wall, DEF_CXXFLAGS)
AX_APPEND_COMPILE_FLAGS(-fstack-protector, DEF_CXXFLAGS)
AX_APPEND_COMPILE_FLAGS(-fPIE, DEF_CXXFLAGS)
AX_APPEND_COMPILE_FLAGS(-D_FORTIFY_SOURCE=2, DEF_CXXFLAGS)
AX_APPEND_LINK_FLAGS([-fPIE -pie], DEF_LDFLAGS)
AX_APPEND_LINK_FLAGS([-Wl,-z,relro], DEF_LDFLAGS)
AX_APPEND_LINK_FLAGS([-Wl,-z,now], DEF_LDFLAGS)
AC_LANG_POP([C++])
test "x$enable_CXXFLAGS_setting" = xyes && AC_SUBST(CXXFLAGS, $DEF_CXXFLAGS)
test "x$enable_LDFLAGS_setting" = xyes && AC_SUBST(LDFLAGS, $DEF_LDFLAGS)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CXXCPP
AC_PROG_CPP
# Check for C++11 with std::regex support and gmpxx headers.
AC_LANG_PUSH([C++])
AX_CXX_COMPILE_STDCXX(11,noext)
AX_LIB_CXX_REGEX
AC_CHECK_HEADERS([gmpxx.h])
AC_CHECK_LIB(gmpxx,abs,AC_SUBST(LIBGMPXX,'-lgmpxx -lgmp'),[
AC_MSG_ERROR([GMPlib not found])],[-lgmp])
AC_LANG_POP([C++])
# check for Boost library
AC_MSG_CHECKING([for libboost regex support])
AX_BOOST_BASE([1.33.1],[],[AC_MSG_ERROR([Boost not found])])
AC_ARG_ENABLE(parsergeneration,AS_HELP_STRING([--disable-parsergeneration],
[toggle parser generation from grammar description (default: yes).
This requires bisonc++ and flexc++.]))
if test "x$enable_parsergeneration" != "xno"; then
AC_SUBST(PARSERGEN_ENABLED,[yes])
AC_PROG_EGREP
AC_MSG_CHECKING([for bisonc++])
AS_IF([bisonc++ --version | $EGREP -q '^bisonc\+\+ V'], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([bisonc++ not found (required for dist build)])])
AC_MSG_CHECKING([for flex++])
AS_IF([flexc++ --version | $EGREP -q '^flexc\+\+ V'], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([flexc++ not found (required for dist build)])])
else
AC_MSG_NOTICE([parser generation disabled])
fi
# Check option to link statically against "special" libraries for
# submit client and checktestdata programs.
AC_ARG_ENABLE(static-linking,AS_HELP_STRING([--enable-static-linking],
[enable static linking against libgmpxx (default: no).]))
if test "x$enable_static_linking" = "xyes"; then
AC_SUBST(STATIC_LINK_START,[-Wl,-Bstatic])
AC_SUBST(STATIC_LINK_END, [-Wl,-Bdynamic])
fi
AC_CONFIG_FILES([config.mk])
AC_OUTPUT