-
Notifications
You must be signed in to change notification settings - Fork 6
/
acinclude.m4
113 lines (103 loc) · 2.52 KB
/
acinclude.m4
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
AC_DEFUN([AC_CHECK_COMPILER],
[
AC_ARG_ENABLE(debug,[ --enable-debug creates debugging code [default=no]],
[
if test $enableval = "no"; dnl
then ac_use_debug_code="no"
else ac_use_debug_code="yes"
fi
], [ac_use_debug_code="no"])
dnl this prevents stupid AC_PROG_CXX from adding "-g" to the default CXXFLAGS
cxx_flags_in=$CXXFLAGS
AC_PROG_CXX
AC_PROG_CXXCPP
CXXFLAGS=$cxx_flags_in
if test -z "$CXXFLAGS"; then
if test "$GXX" = "yes"; then
if test "$ac_use_debug_code" = "yes"; then
CXXFLAGS="-g $CXXFLAGS"
else
CXXFLAGS="-O2 $CXXFLAGS"
if test -z "$LDFLAGS"; then
LDFLAGS="-s"
fi
fi
else
if test "$ac_use_debug_code" = "yes"; then
AC_CHECK_COMPILER_FLAG(g,
[
CXXFLAGS="-g $CXXFLAGS"
])
else
AC_CHECK_COMPILER_FLAG(O2,
[
CXXFLAGS="-O2 $CXXFLAGS"
])
fi
fi
AC_CHECK_COMPILER_FLAG(fexceptions,
[
CXXFLAGS="$CXXFLAGS -fexceptions"
])
if test "$GXX" = "yes"; then
CXXFLAGS="$CXXFLAGS -Wall"
fi
fi
AC_CHECK_COMPILER_FLAG(std=c++11,
[
CXXFLAGS="$CXXFLAGS -std=c++11"
],
[
AC_CHECK_COMPILER_FLAG(std=c++0x,
[
CXXFLAGS="$CXXFLAGS -std=c++0x"
])
])
])
AC_DEFUN([AC_CHECK_COMPILER_FLAG],
[
AC_MSG_CHECKING(whether $CXX supports -$1)
flag_cache=`echo $1 | sed 'y%.=/+-%___p_%'`
AC_CACHE_VAL(ac_cv_prog_cxx_$flag_cache,
[
echo 'int main() { return 0; }' >conftest.cc
eval "ac_cv_prog_cxx_$flag_cache=no"
if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then
if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then
eval "ac_cv_prog_cxx_$flag_cache=yes"
fi
fi
rm -f conftest*
])
if eval "test \"`echo '$ac_cv_prog_cxx_'$flag_cache`\" = yes"; then
AC_MSG_RESULT(yes)
:
$2
else
AC_MSG_RESULT(no)
:
$3
fi
])
AC_DEFUN([AC_CHECK_COMPILE_SCHEME],
[
AC_MSG_CHECKING([whether library is to compile scheme files to bytecode])
AC_ARG_ENABLE(compile-to-bytecode,
[ --enable-compile-to-bytecode compile scheme files to bytecode [[default=no]]],
[
if test "x$enableval" = "xyes"; then
compile_scheme=true
AC_MSG_RESULT([yes])
elif test "x$enableval" = "xno"; then
compile_scheme=false
AC_MSG_RESULT([no])
else
AC_MSG_ERROR([incorrect bytecode option specified - should be yes or no])
fi
],
[
compile_scheme=false
AC_MSG_RESULT([no])
])
AM_CONDITIONAL([COMPILE_TO_BYTECODE], [test x$compile_scheme = xtrue])
])