-
Notifications
You must be signed in to change notification settings - Fork 1
/
tdom.m4
382 lines (352 loc) · 10.4 KB
/
tdom.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
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
#------------------------------------------------------------------------
# TDOM_ENABLE_DTD --
#
# Allows the building with DTD support
#
# Arguments:
# None
#
# Results:
#
# Adds the following arguments to configure:
# --enable-dtd=yes|no
#
# Defines the following vars:
#
# Sets the following vars:
#
#------------------------------------------------------------------------
AC_DEFUN(TDOM_ENABLE_DTD, [
AC_MSG_CHECKING([whether to enable dtd support])
AC_ARG_ENABLE(dtd,
AC_HELP_STRING([--enable-dtd],
[build with dtd support (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test "${enable_dtd+set}" = set; then
enableval="$enable_dtd"
tcl_ok=$enableval
else
tcl_ok=yes
fi
if test "$tcl_ok" = "yes" ; then
AC_MSG_RESULT([yes])
AC_DEFINE(XML_DTD)
else
AC_MSG_RESULT([no])
fi
])
#------------------------------------------------------------------------
# TDOM_ENABLE_NS --
#
# Allows the building with namespace support
#
# Arguments:
# None
#
# Results:
#
# Adds the following arguments to configure:
# --enable-ns=yes|no
#
# Defines the following vars:
#
# Sets the following vars:
#
#------------------------------------------------------------------------
AC_DEFUN(TDOM_ENABLE_NS, [
AC_MSG_CHECKING([whether to enable namespace support])
AC_ARG_ENABLE(ns,
AC_HELP_STRING([--enable-ns],
[build with XML namespace support (default: on)]),
[tcl_ok=$enableval], [tcl_ok=yes])
if test "${enable_ns+set}" = set; then
enableval="$enable_ns"
tcl_ok=$enableval
else
tcl_ok=yes
fi
if test "$tcl_ok" = "yes" ; then
AC_MSG_RESULT([yes])
AC_DEFINE(XML_NS)
else
AC_MSG_RESULT([no])
fi
])
#------------------------------------------------------------------------
# TDOM_ENABLE_UNKNOWN --
#
# Allows the building with (or without) the custom unknown command
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --enable-unknown=yes|no
#
# Defines the following vars:
#
# Sets the following vars:
#
#------------------------------------------------------------------------
AC_DEFUN(TDOM_ENABLE_UNKNOWN, [
AC_MSG_CHECKING([whether to enable built-in unknown command])
AC_ARG_ENABLE(ucmd,
AC_HELP_STRING([--enable-unknown],
[enable built-in unknown command (default: off)]),
[tcl_ok=$enableval], [tcl_ok=no])
if test "${enable_unknown+set}" = set; then
enableval="$enable_unknown"
tcl_ok=$enableval
else
tcl_ok=no
fi
if test "$tcl_ok" = "no" ; then
AC_MSG_RESULT([no])
AC_DEFINE(TDOM_NO_UNKNOWN_CMD)
else
AC_MSG_RESULT([yes])
fi
])
#------------------------------------------------------------------------
# TDOM_ENABLE_TDOMALLOC --
#
# Allows the building with tDOMs block allocator for nodes
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --enable-tdomalloc=yes|no
#
# Defines the following vars:
#
# Sets the following vars:
#
#------------------------------------------------------------------------
AC_DEFUN(TDOM_ENABLE_TDOMALLOC, [
AC_MSG_CHECKING([whether to enable tDOMs block allocator])
AC_ARG_ENABLE(tdomalloc,
AC_HELP_STRING([--enable-tdomalloc],
[build with the tDOM allocator (default: off)]),
[tcl_ok=$enableval], [tcl_ok=no])
if test "${enable_tdomalloc+set}" = set; then
enableval="$enable_tdomalloc"
tcl_ok=$enableval
else
tcl_ok=no
fi
if test "$tcl_ok" = "yes" ; then
AC_MSG_RESULT([yes])
TEA_ADD_SOURCES([generic/domalloc.c])
else
AC_MSG_RESULT([no])
AC_DEFINE(USE_NORMAL_ALLOCATOR)
fi
])
#------------------------------------------------------------------------
# TDOM_PATH_AOLSERVER
#
# Allows the building with support for AOLserver
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --with-aolserver=...
#
# Defines the following vars:
# AOL_DIR Full path to the directory containing AOLserver distro
#
# Sets the following vars:
# NS_AOLSERVER
#------------------------------------------------------------------------
AC_DEFUN(TDOM_PATH_AOLSERVER, [
AC_MSG_CHECKING([for AOLserver configuration])
AC_ARG_WITH(aol,
AC_HELP_STRING([--with-aolserver],
[directory with AOLserver distribution]),
with_aolserver=${withval})
AC_CACHE_VAL(ac_cv_c_aolserver,[
if test x"${with_aolserver}" != x ; then
if test -f "${with_aolserver}/include/ns.h" ; then
ac_cv_c_aolserver=`(cd ${with_aolserver}; pwd)`
else
AC_MSG_ERROR([${with_aolserver} directory doesn't contain ns.h])
fi
fi
])
if test x"${ac_cv_c_aolserver}" = x ; then
AC_MSG_RESULT([none found])
else
AOL_DIR=${ac_cv_c_aolserver}
AOL_INCLUDES="-I\"${AOL_DIR}/include\""
if test "`uname -s`" = Darwin ; then
aollibs=`ls ${AOL_DIR}/lib/libns* 2>/dev/null`
if test x"$aollibs" != x ; then
AOL_LIBS="-L\"${AOL_DIR}/lib\" -lnsd -lnsthread"
fi
fi
AC_MSG_RESULT([found AOLserver in $AOL_DIR])
AC_DEFINE(NS_AOLSERVER)
AC_DEFINE(USE_NORMAL_ALLOCATOR)
fi
])
#------------------------------------------------------------------------
# TDOM_PATH_CONFIG --
#
# Locate the tdomConfig.sh file
#
# Arguments:
# None
#
# Results:
#
# Adds the following arguments to configure:
# --with-tdom=...
#
# Defines the following vars:
# TDOM_BIN_DIR Full path to the directory with tdomConfig.sh
#------------------------------------------------------------------------
AC_DEFUN(TDOM_PATH_CONFIG, [
if test x"${no_tdom}" = x ; then
AC_MSG_CHECKING([for tDOM configuration])
AC_ARG_WITH(tdom,
AC_HELP_STRING([--with-tdom],
[directory containig tDOM configuration (tdomConfig.sh)]),
with_tdomconfig=${withval})
no_tdom=true
if test "${TEA_PLATFORM}" = "windows" ; then
tdom_bindir=win
else
tdom_bindir=unix
fi
AC_CACHE_VAL(ac_cv_c_tdomconfig,[
# First check to see if --with-tdom was specified.
if test x"${with_tdomconfig}" != x ; then
if test -f "${with_tdomconfig}/tdomConfig.sh" ; then
ac_cv_c_tdomconfig=`(cd ${with_tdomconfig}; pwd)`
else
AC_MSG_ERROR([${with_tdomconfig} directory doesn't contain tdomConfig.sh])
fi
fi
# Then check for a sibling installation
if test x"${ac_cv_c_tdomconfig}" = x ; then
for i in \
../tdom `ls -dr ../tdom-* 2>/dev/null` \
../../tdom `ls -dr ../../tdom-* 2>/dev/null` \
../../../tdom `ls -dr ../../../tdom-* 2>/dev/null` ; do
if test -f "$i/$tdom_bindir/tdomConfig.sh" ; then
ac_cv_c_tdomconfig=`(cd $i/$tdom_bindir; pwd)`
fi
done
fi
# Then check if tnc/tdom are compilied in the source tree
if test x"${ac_cv_c_tdomconfig}" = x ; then
if test -f "../../$tdom_bindir/tdomConfig.sh" ; then
ac_cv_c_tdomconfig=`(cd ../../$tdom_bindir; pwd)`
fi
fi
# Check in a few common install locations
if test x"${ac_cv_c_tdomconfig}" = x ; then
for i in \
`ls -d ${prefix}/lib 2>/dev/null` \
`ls -d /usr/local/lib 2>/dev/null` ; do
if test -f "$i/tdomConfig.sh" ; then
ac_cv_c_tdomconfig=`(cd $i; pwd)`
fi
done
fi
# Check in a few other private locations
if test x"${ac_cv_c_tdomconfig}" = x ; then
for i in \
${srcdir}/../tdom \
`ls -dr ${srcdir}/../tdom[[0-9]].[[0-9]]* 2>/dev/null` ; do
if test -f "$i/$tdom_bindir/tdomConfig.sh" ; then
ac_cv_c_tdomconfig=`(cd $i/$tdom_bindir; pwd)`
fi
done
fi
])
if test x"${ac_cv_c_tdomconfig}" = x ; then
TDOM_BIN_DIR="# no tDOM configuration file found"
AC_MSG_WARN(Can't find tDOM configuration definitions)
exit 0
else
no_tdom=
TDOM_BIN_DIR=${ac_cv_c_tdomconfig}
AC_MSG_RESULT(found $TDOM_BIN_DIR/tdomConfig.sh)
fi
fi
])
#------------------------------------------------------------------------
# TDOM_LOAD_CONFIG --
#
# Load the tdomConfig.sh file
#
# Arguments:
#
# Requires the following vars to be set:
# TDOM_BIN_DIR
#
# Defines the following vars:
#
# Sets the following vars:
#
#------------------------------------------------------------------------
AC_DEFUN(TDOM_LOAD_CONFIG, [
AC_MSG_CHECKING([for existence of $TDOM_BIN_DIR/tdomConfig.sh])
if test -f "$TDOM_BIN_DIR/tdomConfig.sh" ; then
AC_MSG_RESULT([loading])
. $TDOM_BIN_DIR/tdomConfig.sh
else
AC_MSG_RESULT([file not found])
fi
if test -f "${TDOM_BIN_DIR}/Makefile" ; then
TDOM_STUB_LIB_SPEC=${TDOM_BUILD_STUB_LIB_SPEC}
fi
AC_SUBST(TDOM_VERSION)
AC_SUBST(TDOM_STUB_LIB_SPEC)
AC_SUBST(TDOM_SRC_DIR)
])
#------------------------------------------------------------------------
# TDOM_EXPORT_CONFIG --
#
# Define the data to insert into the ${PACKAGE_NAME}Config.sh file
#
# Arguments:
# None
#
# Results:
# Subst the following vars:
#
#------------------------------------------------------------------------
AC_DEFUN(TDOM_EXPORT_CONFIG, [
#--------------------------------------------------------------------
# These are for ${PACKAGE_NAME}Config.sh
#--------------------------------------------------------------------
# pkglibdir must be a fully qualified path and (not ${exec_prefix}/lib)
eval pkglibdir="[$]{libdir}/${PACKAGE_NAME}${PACKAGE_VERSION}"
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
eval PKG_STUB_LIB_FLAG="-l${PACKAGE_NAME}stub${PACKAGE_VERSION}"
else
eval PKG_STUB_LIB_FLAG="-l${PACKAGE_NAME}stub`echo ${PACKAGE_VERSION} | tr -d .`"
fi
PKG_BUILD_STUB_LIB_SPEC="-L`pwd` ${PKG_STUB_LIB_FLAG}"
PKG_STUB_LIB_SPEC="-L${pkglibdir} ${PKG_STUB_LIB_FLAG}"
PKG_BUILD_STUB_LIB_PATH="`pwd`/[$]{PKG_STUB_LIB_FILE}"
PKG_STUB_LIB_PATH="${pkglibdir}/[$]{PKG_STUB_LIB_FILE}"
AC_SUBST(PKG_BUILD_STUB_LIB_SPEC)
AC_SUBST(PKG_STUB_LIB_SPEC)
AC_SUBST(PKG_BUILD_STUB_LIB_PATH)
AC_SUBST(PKG_STUB_LIB_PATH)
])
# Local Variables:
# mode: autoconf
# End:
# EOF