forked from vgough/rlog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
248 lines (200 loc) · 6.53 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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
dnl Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([rlog/rlog.h]) dnl a source file from your sub dir
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_TARGET
dnl Perform program name transformation
AC_ARG_PROGRAM
AC_LANG(C++)
# Must be updated for public releases..
# CURRENT : REVISON : AGE
#
# +1 : ? : +1 => new interface that does not break old one
# +1 : 0 : 0 => new interface that breaks old one
# ? : 0 : 0 => no new interfaces, but breaks apps
# ? :+1 : ? => internal changes, nothing breaks, and might work better..
#
LIBRLOG_VERSION=5:0:0
AC_SUBST(LIBRLOG_VERSION)
AC_SUBST(PACKAGE_VERSION)
AM_INIT_AUTOMAKE(rlog, 1.4) dnl searches for some needed programs
dnl
unset CDPATH
dnl make /usr/local the default for the installation
AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
ac_configure_args="$ac_configure_args --prefix $prefix"
fi
dnl without this order in this file, automake will be confused!
dnl
AC_CONFIG_HEADERS([config.h])
dnl create only shared libtool-libraries
AC_ENABLE_SHARED(yes)
dnl set the following to yes, if you want to create static
dnl libtool-libraries, too.
AC_ENABLE_STATIC(no)
dnl checks for programs.
dnl first check for c/c++ compilers
AC_LANG([C++])
AC_PROG_CXX
AC_PROG_LIBTOOL
dnl CXXFLAGS="$NOOPT_CXXFLAGS" dnl __kdevelop[noopt]__
dnl CFLAGS="$NOOPT_CFLAGS" dnl __kdevelop[noopt]__
dnl CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS" dnl __kdevelop[exc]__
ACX_PTHREAD
AC_ARG_ENABLE(printffp,
AS_HELP_STRING([--disable-printffp],
[disables printf attribute on function pointers]),
with_printffp=$enableval,with_printffp="test")
if test "x$with_printffp" = "xtest"; then
# check if we can use printf attribute on a function..
AC_MSG_CHECKING(if __printf__ attribute can apply to function pointers)
AC_COMPILE_IFELSE( [[
void testfunc(const char *format, ...)
{ }
void (*funcProto)(const char *, ...)
__attribute__ (( __format__ ( __printf__ , 1, 2 )));
int main()
{
funcProto = testfunc;
(*funcProto)("hello %s", "world");
return 0;
}
]],
with_printffp="yes",
with_printffp="no")
AC_MSG_RESULT($with_printffp)
fi
if test "x$with_printffp" = "xyes"; then
HAVE_PRINTF_FP_PROTOTYPE="1"
else
HAVE_PRINTF_FP_PROTOTYPE="0"
fi
AC_SUBST(HAVE_PRINTF_FP_PROTOTYPE)
AC_ARG_ENABLE(variable-clustering,
AS_HELP_STRING([--disable-variable-clustering],
[disables rlog variable clustering via separate data section]),
with_var_cluster=$enableval,with_var_cluster="test")
HAVE_GCC_DATA_SECTION_ATTRIBUTE="0"
HAVE_GCC_SIMPLE_SECTION_ATTRIBUTE="0"
if test "x$with_var_cluster" = "xtest"; then
# check if we can specify data section for variables
AC_MSG_CHECKING(if section attribute works)
with_section_attr="no"
AC_COMPILE_IFELSE( [[
extern void test(int val);
int main()
{
static int foo __attribute__ (( section("__DATA, RLOG_DATA") )) = 0;
test( foo );
return 0;
}
]],
[[HAVE_GCC_DATA_SECTION_ATTRIBUTE="1"
with_section_attr="yes"]])
AC_COMPILE_IFELSE( [[
extern void test(int val);
int main()
{
static int foo __attribute__ (( section("RLOG_DATA") )) = 0;
test( foo );
return 0;
}
]],
[[HAVE_GCC_SIMPLE_SECTION_ATTRIBUTE="1"
with_section_attr="yes"]])
AC_MSG_RESULT($with_section_attr)
fi
AC_SUBST(HAVE_GCC_DATA_SECTION_ATTRIBUTE)
AC_SUBST(HAVE_GCC_SIMPLE_SECTION_ATTRIBUTE)
AC_ARG_ENABLE(vararg,
AS_HELP_STRING([--disable-vararg],
[don't use vararg macros even if the compiler supports them]),
enable_vararg=$enableval)
if test "x$enable_vararg" != "xno"; then
# check if the compiler understands __VA_ARGS__
AC_MSG_CHECKING(if compiler has C99 variadac macro)
AC_COMPILE_IFELSE( [[
#include <stdio.h>
#define PRINT(FMT, ...) printf( FMT, __VA_ARGS__ )
int main()
{
PRINT("hello %s", "world");
return 0;
} ]], [C99_VARIADAC_MACROS="1"
AC_MSG_RESULT(yes)],
[C99_VARIADAC_MACROS="0"
AC_MSG_RESULT(no)])
# check if the compiler understands pre-c99 variadac macros
AC_MSG_CHECKING(if compiler has pre-C99 variadac macro)
AC_COMPILE_IFELSE( [[
#include <stdio.h>
#define PRINT(FMT, ARGS...) printf( FMT, ##ARGS )
int main()
{
PRINT("hello %s", "world");
return 0;
} ]], [PREC99_VARIADAC_MACROS="1"
AC_MSG_RESULT(yes)],
[PREC99_VARIADAC_MACROS="0"
AC_MSG_RESULT(no)])
else
dnl vararg support disabled
C99_VARIADAC_MACROS=0
PREC99_VARIADAC_MACROS=0
fi # enable_vararg
AC_SUBST(C99_VARIADAC_MACROS)
AC_SUBST(PREC99_VARIADAC_MACROS)
# check if the computer has hardware cycle counter
AC_ARG_ENABLE(rdtsc,
AS_HELP_STRING([--enable-rdtsc],
[use rdtsc for benchmarking rlog in test programs]),
with_rdtsc=$enableval,with_rdtsc="no")
if test "x$with_rdtsc" = "xyes"; then
AC_DEFINE([USE_RDTSC], [1], [Define to use RDTSC calls for benchmark test])
else
AC_DEFINE([USE_RDTSC], [0], [Define to use RDTSC calls for benchmark test])
fi
AC_ARG_ENABLE(valgrind,
AS_HELP_STRING([--disable-valgrind],
[disables valgrind support code.]),
with_valgrind=$enableval, with_valgrind="yes" )
USE_VALGRIND="0"
if test "x$with_valgrind" = "xyes"; then
AC_CHECK_HEADER([valgrind/valgrind.h],
AC_CHECK_DECLS([VALGRIND_PRINTF_BACKTRACE],
USE_VALGRIND="1",,[#include <valgrind/valgrind.h>]))
fi
AC_SUBST(USE_VALGRIND)
# allow documentation build to be disabled manually
AC_ARG_ENABLE(docs,
AS_HELP_STRING([--disable-docs],[disable documentation build]),
build_docs=$enableval, build_docs="yes")
# check for tools necessary to build documentation
AC_PATH_PROG(DOXYGEN, doxygen, [no])
AC_PATH_PROG(LATEX, latex, [no])
AC_PATH_PROG(PDFLATEX, pdflatex, [no])
AM_CONDITIONAL(BUILD_DOCS, test "x$build_docs" = "xyes" \
-a "x$DOXYGEN" != "xno" \
-a "x$LATEX" != "xno" \
-a "x$PDFLATEX" != "xno" )
AC_CHECK_FUNCS(localtime_r)
# check for files which may not be available if using old STL code
AC_CHECK_HEADERS(sstream)
LDFLAGS="$LDFLAGS $PTHREAD_LIBS $USER_LDFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $USER_INCLUDES"
AC_SUBST(AUTODIRS)
AC_CONFIG_FILES([Makefile \
rlog/Makefile \
docs/Makefile \
config/Makefile \
rlog/common.h \
librlog.pc \
rlog.spec \
makedist2.sh])
AC_OUTPUT