-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
299 lines (270 loc) · 8.4 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
dnl Process this file with aclocal, autoconf and automake.
AC_INIT([rtfl],[0.1.1])
dnl Detect the canonical target build environment
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([objects/rtfl_objview.cc])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
dnl Options
JAVA_HOME=""
WARN_GRAPH=no
AC_ARG_ENABLE(efence, [ --enable-efence Try to compile and run with Electric Fence],
, enable_efence=no)
AC_ARG_ENABLE(gprof, [ --enable-gprof Try to compile and run with profiling enabled],
, enable_gprof=no)
AC_ARG_ENABLE(insure, [ --enable-insure Try to compile and run with Insure++],
, enable_insure=no)
AC_ARG_ENABLE(rtfl, [ --enable-rtfl Build with RTFL messages (for debugging rendering)])
AC_ARG_ENABLE(graph2, [ --disable-graph2 Use simple Graph widget instead of Graph2])
AC_ARG_ENABLE(java, [ --disable-java Build RTFL java agent])
AC_ARG_WITH(java-home,[ --with-java-home=DIR Specify where to find the JDK], JAVA_HOME=$withval)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
LT_INIT
dnl ----------------------------
dnl Check our char and int types
dnl ----------------------------
dnl
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
dnl -----------------------------------------------------------------
dnl Check for absolute path of working directory.
dnl This is needed for RTFL, to get full the full paths of the source
dnl file names
dnl -----------------------------------------------------------------
dnl
BASE_CUR_WORKING_DIR=`pwd`
dnl --------------------------------------
dnl Check whether to add /usr/local or not
dnl (this is somewhat a religious problem)
dnl --------------------------------------
dnl
if test "`$CPP -v < /dev/null 2>&1 | grep '/usr/local/include' 2>&1`" = ""; then
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
fi
dnl ----------------------
dnl Test for FLTK 1.3 library
dnl ----------------------
dnl
dnl For debugging and to be user friendly
AC_MSG_CHECKING([FLTK 1.3])
fltk_version="`fltk-config --version 2>/dev/null`"
case $fltk_version in
1.3.*) AC_MSG_RESULT(yes)
LIBFLTK_CXXFLAGS=`fltk-config --cxxflags`
LIBFLTK_LIBS=`fltk-config --ldflags`;;
?*) AC_MSG_RESULT(no)
AC_MSG_ERROR(FLTK 1.3 required; version found: $fltk_version);;
*) AC_MSG_RESULT(no)
AC_MSG_ERROR(FLTK 1.3 required; fltk-config not found)
esac
dnl -------------------------
dnl Test for Graphviz library
dnl -------------------------
AC_MSG_CHECKING([Graphviz library >= 2.38.0])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <graphviz/graphviz_version.h>
#include <ctype.h>
#include <stdlib.h>
static int version_cmp (const char *v1, const char *v2)
{
const char *s1 = v1, *s2 = v2;
while (*s1 && *s2) {
if (isdigit (*s1) && isdigit (*s2)) {
char buf1[10], buf2[10];
int n1 = 0, n2 = 0;
while (isdigit (*s1)) {
if (n1 < 9) buf1[n1++] = *s1;
s1++;
}
while (isdigit (*s2)) {
if (n2 < 9) buf2[n2++] = *s2;
s2++;
}
buf1[n1] = buf2[n2] = 0;
int c = atoi (buf1) - atoi (buf2);
if (c != 0)
return c;
} else {
if (*s1 != *s2)
return *s1 - *s2;
s1++;
s2++;
}
}
return *s1 - *s2;
}
]],[[
if(version_cmp (PACKAGE_VERSION, "2.38.0") >= 0)
return 0;
else
return 1;
]])],
[AC_MSG_RESULT(yes)
HAS_GRAPHVIZ=yes
AM_CONDITIONAL([HAS_GRAPHVIZ], [true])
GRAPHVIZ_LIBS="-lcgraph -lgvc"],
[AC_MSG_RESULT(no)
HAS_GRAPHVIZ=no
AM_CONDITIONAL([HAS_GRAPHVIZ], [false])]
[AC_MSG_RESULT(no)
HAS_GRAPHVIZ=no
AM_CONDITIONAL([HAS_GRAPHVIZ], [false])
AC_MSG_WARN([Testing Graphviz library not possible when cross-compiling.])])
dnl ------------
dnl Test for JDK
dnl ------------
AC_MSG_CHECKING([JDK])
if test "$enable_java" = no ; then
AC_MSG_RESULT(disabled)
AM_CONDITIONAL([HAS_JAVA], [false])
JAVA_HOME=""
else
# Follow symbolic links of javac in $PATH.
if test -z "$JAVA_HOME"; then
if which javac >/dev/null; then
javac=$(which javac)
while test -n "$javac"; do
nextjavac=$(readlink $javac)
if test -z "$nextjavac"; then
JAVA_HOME=${javac%/bin/javac}
if test $JAVA_HOME = $javac; then
AC_MSG_RESULT(no)
AC_MSG_WARN([Javac found at $javac, which is strange.])
AM_CONDITIONAL([HAS_JAVA], [false])
JAVA_HOME=""
fi
fi
javac=$nextjavac
done
else
AC_MSG_RESULT(no)
AM_CONDITIONAL([HAS_JAVA], [false])
JAVA_HOME=""
fi
fi
fi
if test -n "$JAVA_HOME"; then
if test '!' -e $JAVA_HOME/include/jvmti.h; then
AC_MSG_RESULT(no)
AC_MSG_WARN([$JAVA_HOME/include/jvmti.h not found: JDK not usable.])
AM_CONDITIONAL([HAS_JAVA], [false])
JAVA_HOME=""
else
AC_MSG_RESULT(yes)
AM_CONDITIONAL([HAS_JAVA], [true])
# Hopefully only simple directory names ...
JAVA_CFLAGS="-I$JAVA_HOME/include"
if test '!' -e $JAVA_HOME/include/jni_md.h; then
# For some JDKs, "jni_md.h" is only in a OS specific directory.
JAVA_CFLAGS=$JAVA_CFLAGS" -I"`find $JAVA_HOME/include/ -name jni_md.h \
| head -1 | xargs dirname`
fi
fi
fi
dnl --------------------
dnl Command line options
dnl --------------------
dnl
if test "x$enable_efence" = "xyes" ; then
LIBS="-lefence $LIBS"
fi
if test "x$enable_gprof" = "xyes" ; then
CXXFLAGS="$CXXFLAGS -pg"
fi
if test "x$enable_insure" = "xyes" ; then
CC="insure -Zoi \"compiler $CC\""
LIBS="$LIBS -lstdc++-2-libc6.1-1-2.9.0"
fi
if test "x$enable_rtfl" = "xyes" ; then
CXXFLAGS="$CXXFLAGS -DDBG_RTFL"
fi
if test "$enable_graph2" = no ; then
AM_CONDITIONAL([USE_GRAPH2], [false])
else
if test $HAS_GRAPHVIZ = yes ; then
AM_CONDITIONAL([USE_GRAPH2], [true])
CXXFLAGS="$CXXFLAGS -DUSE_GRAPH2"
else
AM_CONDITIONAL([USE_GRAPH2], [false])
AC_MSG_WARN([Graphviz library >= 2.38.0 not found. Graph2 is not enabled.])
WARN_GRAPH=yes
fi
fi
dnl -----------------------
dnl Checks for header files
dnl -----------------------
dnl
AC_CHECK_HEADERS(fcntl.h unistd.h sys/uio.h)
dnl --------------------------
dnl Check for compiler options
dnl --------------------------
dnl
if eval "test x$GCC = xyes"; then
if test "`echo $CFLAGS | grep '\-D_REENTRANT' 2> /dev/null`" = ""; then
CFLAGS="$CFLAGS -D_REENTRANT"
fi
if test "`echo $CFLAGS | grep '\-D_THREAD_SAFE' 2> /dev/null`" = ""; then
CFLAGS="$CFLAGS -D_THREAD_SAFE"
fi
if test "`echo $CFLAGS | grep '\-Wall' 2> /dev/null`" = ""; then
CFLAGS="$CFLAGS -Wall"
fi
if test "`echo $CFLAGS | grep -e '-W ' -e '-W$' 2> /dev/null`" = ""; then
CFLAGS="$CFLAGS -W"
fi
if test "`echo $CFLAGS | grep '\-Wno-unused-parameter' 2> /dev/null`" = ""; then
CFLAGS="$CFLAGS -Wno-unused-parameter"
fi
if test "`echo $CFLAGS | grep '\-Waggregate-return' 2> /dev/null`" = ""; then
CFLAGS="$CFLAGS -Waggregate-return"
fi
fi
dnl -----------
dnl CXX options
dnl -----------
dnl
if eval "test x$GCC = xyes"; then
CXXFLAGS="$CXXFLAGS -Wall -W -Wno-unused-parameter -fno-rtti -fno-exceptions"
fi
AC_SUBST(BASE_CUR_WORKING_DIR)
AC_SUBST(LIBFLTK_CXXFLAGS)
AC_SUBST(GRAPHVIZ_LIBS)
AC_SUBST(LIBFLTK_LIBS)
AC_SUBST(JAVA_HOME)
AC_SUBST(JAVA_CFLAGS)
AC_SUBST(datadir)
AC_CONFIG_FILES([
Makefile
lout/Makefile
common/Makefile
dw/Makefile
dwr/Makefile
objects/Makefile
tests/Makefile
scripts/Makefile
doc/Makefile
java/Makefile
])
AC_OUTPUT
dnl --------------------------
dnl Some more notable messages
dnl --------------------------
if test "$WARN_GRAPH" = yes; then
echo '----------------------------------------------------------------------'
echo 'NOTE: No Graphviz library >= 2.38.0 was found, and you did not'
echo 'explicitly disable the Graph2 widget, which depends on Graphviz. It is'
echo 'recommend to install the Graphviz library and thus enable Graph2 which'
echo 'greatly improves rendering of rtfl-objview. See README for details.'
echo '----------------------------------------------------------------------'
fi