summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 6a933b98cf97151fc5a34bd594f282e9a3829f92 (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
# 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],[15])
m4_define([cppunit_version_micro],[2])
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_SSTREAM
AC_CXX_HAVE_STRSTREAM

# Enable doxygen
BB_ENABLE_DOXYGEN

# Compiler characteristics
AX_CXX_GCC_ABI_DEMANGLE
AC_CXX_STRING_COMPARE_STRING_FIRST
AX_CXX_COMPILE_STDCXX_11(noext, mandatory)

# =================================
# 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
# ================

# =====
# 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([--enable-werror], [Treat all warnings as errors, useful for development])],
	[enable_werror="$enableval"],
	[enable_werror=no]
)
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
	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/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}
==============================================================================
])