summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 019be20b4d26fbbdfa5c1fd75fba80cd62012fc0 (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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Process this file with autoconf to create configure.

AC_PREREQ([2.65])

# ====================
# Version informations
# ====================
m4_define([cppunit_version_major],[1])
m4_define([cppunit_version_minor],[14])
m4_define([cppunit_version_micro],[0])
m4_define([cppunit_version],[cppunit_version_major.cppunit_version_minor.cppunit_version_micro])
m4_define([cppunit_interface_age], [0])
m4_define([cppunit_binary_age], [0])

# =============
# Automake init
# =============
AC_INIT([cppunit],[cppunit_version])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 foreign dist-xz dist-bzip2])
AM_SILENT_RULES([yes])
AC_LANG([C++])

# ===========================
# Find required base packages
# ===========================
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_LIBTOOL_WIN32_DLL

# ======================================
# Check for various headers and settings
# ======================================
AC_HEADER_STDC
AC_LTDL_DLLIB
AC_CHECK_HEADERS(cmath,[],[],[/**/])
AX_CXX_HAVE_ISFINITE
AC_CHECK_FUNCS(finite)
AX_CXX_HAVE_SSTREAM
AC_CXX_HAVE_STRSTREAM

# Enable doxygen
BB_ENABLE_DOXYGEN

# Compiler characteristics
AC_CXX_RTTI
AX_CXX_GCC_ABI_DEMANGLE
AC_CXX_STRING_COMPARE_STRING_FIRST

AC_ARG_ENABLE([typeinfo-name],
	[AS_HELP_STRING([--disable-typeinfo-name], [Disable use of RTTI for class names])],
	[enable_typeinfo_name="$enableval"],
	[enable_typeinfo_name=yes]
)
AS_IF([test x"$enable_typeinfo_name" = "xno" -o x"$HAVE_RTTI" != "x1"], [
	use_typeinfo="yes"
	typeinfoval="CPPUNIT_HAVE_RTTI"
], [
	use_typeinfo="no"
	typeinfoval="0"
])
AC_DEFINE_UNQUOTED(USE_TYPEINFO_NAME, [$typeinfoval],
	[Define to 1 to use type_info::name() for class names])

# =================================
# Libtool/Version Makefile settings
# =================================
AC_SUBST(CPPUNIT_MAJOR_VERSION, [cppunit_version_major])
AC_SUBST(CPPUNIT_MINOR_VERSION, [cppunit_version_minor])
AC_SUBST(CPPUNIT_MICRO_VERSION, [cppunit_version_micro])
AC_SUBST(CPPUNIT_BINARY_AGE, [cppunit_binary_age])
AC_SUBST(CPPUNIT_INTERFACE_AGE, [cppunit_interface_age])
LT_RELEASE=$CPPUNIT_MAJOR_VERSION.$CPPUNIT_MINOR_VERSION
LT_CURRENT=`expr $CPPUNIT_MICRO_VERSION - $CPPUNIT_INTERFACE_AGE`
LT_AGE=`expr $CPPUNIT_BINARY_AGE - $CPPUNIT_INTERFACE_AGE`

AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION, [cppunit_interface_age])
AC_SUBST(LT_AGE)

# ================
# Check for cflags
# ================

# ================================================================
# Check if optional features should be enabled (requires c++11)
# ================================================================

AC_ARG_ENABLE(optional_features,
              [AS_HELP_STRING([--enable-optional-features], [Build with some optional features requiring C++11 support.])],
              [enable_optional="$enableval"],
              [enable_optional=yes]
)

AS_IF([test "x$enable_optional" != "xno"], [
       AX_CXX_COMPILE_STDCXX_11(noext, mandatory)
])

AM_CONDITIONAL([WITH_OPTIONAL_FEATURES], [test "x$enable_optional" != "xno"])

# =====
# Debug
# =====
AC_ARG_ENABLE(debug,
	AS_HELP_STRING([--enable-debug], [Build with debug symbols.]),
	[enable_debug="$enableval"],
	[enable_debug=no]
)
AS_IF([test "x$enable_debug" != "xno"], [
	CFLAGS="$CFLAGS -g"
	CXXFLAGS="$CXXFLAGS -g"
], [
	AC_DEFINE([NDEBUG], [], [Disable debugging information])
])

AC_ARG_ENABLE([werror],
	[AS_HELP_STRING([--disable-werror], [Treat all warnings as errors, useful for development])],
	[enable_werror="$enableval"],
	[enable_werror=yes]
)
AS_IF([test x"$enable_werror" != "xno"], [
	CFLAGS="$CFLAGS -Werror"
	CXXFLAGS="$CXXFLAGS -Werror"
])
AS_IF([test x"$GCC" = xyes], [
	# Be tough with warnings and produce less careless code
	# Weffc++ currently prints too much warnings
	CFLAGS="$CFLAGS -Wall -Wextra -pedantic"
	CXXFLAGS="$CXXFLAGS -Wall -Wextra -pedantic" # -Weffc++"
])
CPPUNIT_CXXFLAGS="$CPPUNIT_CFLAGS"
AC_SUBST(CPPUNIT_CXXFLAGS)

# ==============
# Setup config.h
# ==============
AC_CONFIG_HEADERS([config.h])
AX_PREFIX_CONFIG_H([include/cppunit/config-auto.h])

# =====================
# Prepare all .in files
# =====================
AC_CONFIG_FILES([
	Makefile
	cppunit.pc
	cppunit.spec
	cppunit-config
	src/Makefile
	src/DllPlugInTester/Makefile
	src/cppunit/Makefile
	include/Makefile
	include/cppunit/Makefile
	include/cppunit/config/Makefile
	include/cppunit/extensions/Makefile
	include/cppunit/plugin/Makefile
	include/cppunit/portability/Makefile
	include/cppunit/tools/Makefile
	include/cppunit/ui/Makefile
	include/cppunit/ui/mfc/Makefile
	include/cppunit/ui/qt/Makefile
	include/cppunit/ui/text/Makefile
	doc/Makefile
	doc/Doxyfile
	examples/Makefile
	examples/simple/Makefile
	examples/hierarchy/Makefile
	examples/cppunittest/Makefile
	examples/ClockerPlugIn/Makefile
	examples/DumperPlugIn/Makefile
	examples/money/Makefile
])
AC_OUTPUT

# ==============================================
# Display final informations about configuration
# ==============================================
AC_MSG_NOTICE([
==============================================================================
Build configuration:
	debug:              ${enable_debug}
	docs:               ${enable_doc}
	werror:             ${enable_werror}
	typeinfo-name:      ${use_typeinfo}
        optional-features:  ${enable_optional}
==============================================================================
])