-
Notifications
You must be signed in to change notification settings - Fork 23
/
configure.ac
326 lines (273 loc) · 9.2 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
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
dnl -*- autoconf -*-
dnl FILE: configure.in
dnl $Id$
dnl ---
dnl tclreadline -- gnu readline for tcl
dnl https://github.com/flightaware/tclreadline/
dnl Copyright (c) 1998 - 2014, Johannes Zellner <[email protected]>
dnl This software is copyright under the BSD license.
dnl ---
AC_INIT([tclreadline],[2.3.8])
AC_CONFIG_SRCDIR([tclreadline.c])
AC_CONFIG_HEADERS(config.h)
AC_PREREQ([2.71])
AC_REVISION($Revision$)
AC_CONFIG_AUX_DIR(./aux)
MAJOR="`echo 'AC_PACKAGE_VERSION' | cut -d. -f 1`"
MINOR="`echo 'AC_PACKAGE_VERSION' | cut -d. -f 2`"
PATCHLEVEL="`echo 'AC_PACKAGE_VERSION' | cut -d. -f 3`"
VERSION=$MAJOR.$MINOR
PATCHLEVEL_STR=$VERSION.$PATCHLEVEL
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(PATCHLEVEL)
AC_SUBST(VERSION)
AC_SUBST(PATCHLEVEL_STR)
AM_INIT_AUTOMAKE([foreign])
AC_PROG_MAKE_SET
dnl AM_INIT_AUTOMAKE(tclreadline, $VERSION)
AC_CANONICAL_HOST
AC_PROG_CC
AC_EXEEXT
LT_INIT([dlopen])
AC_SUBST(LIBTOOL_DEPS)
AC_C_CONST
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_LN_S
# -- WHICH TCL TO USE
AC_ARG_WITH(
tcl,
[ --with-tcl=DIR where to look for tclConfig.sh],
tcl_search=$withval,
tcl_search=""
)
AC_MSG_CHECKING([which tclConfig.sh to use])
TCL_LIB_DIR=""
for dir in $tcl_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do
if test -r $dir/tclConfig.sh; then
TCL_LIB_DIR=$dir
break
fi
done
if test -z "$TCL_LIB_DIR"; then
AC_MSG_ERROR(Can't find Tcl libraries. Use --with-tcl to specify the directory containing tclConfig.sh on your system.)
fi
. $TCL_LIB_DIR/tclConfig.sh
AC_MSG_RESULT($TCL_LIB_DIR/tclConfig.sh)
AC_MSG_CHECKING([for your tcl version])
AC_MSG_RESULT([$TCL_VERSION, patchlevel $TCL_PATCH_LEVEL])
# Check, if tcl_version is > 8.0
if test $TCL_MAJOR_VERSION -lt 8; then
AC_MSG_ERROR(need tcl 8.0 or higher.)
fi
# -- WHICH TK TO USE
AC_ARG_WITH(
tk,
[ --with-tk=DIR where to look for tkConfig.sh],
tk_search=$withval,
tk_search=""
)
if test x$tk_search != xno; then
AC_MSG_CHECKING([which tkConfig.sh to use])
TK_LIB_DIR=""
for dir in $tk_search $tcl_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do
if test -r $dir/tkConfig.sh; then
TK_LIB_DIR=$dir
break
fi
done
if test -z "$TK_LIB_DIR"; then
AC_MSG_ERROR(Can't find Tk libraries. Use --with-tk to specify the directory containing tkConfig.sh on your system.)
fi
. $TK_LIB_DIR/tkConfig.sh
AC_MSG_RESULT($TK_LIB_DIR/tkConfig.sh)
AC_MSG_CHECKING([for your tk version])
AC_MSG_RESULT([$TK_VERSION, patchlevel $TK_PATCH_LEVEL])
# Check, if tk_version is > 8.0
if test $TK_MAJOR_VERSION -lt 8; then
AC_MSG_ERROR(need tk 8.0 or higher.)
fi
fi
# -----------------------------------------------------------------------
# Set up a new default --prefix.
# -----------------------------------------------------------------------
# this is the default anyway:
# AC_PREFIX_DEFAULT(/usr/local)
if test "${prefix}" = "NONE"; then
prefix=$TCL_PREFIX
fi
TCLRL_LIBDIR="${prefix}/lib"
AC_SUBST(TCLRL_LIBDIR)
TCLRL_DIR="${TCLRL_LIBDIR}/tclreadline$VERSION"
AC_SUBST(TCLRL_DIR)
# HEADERS
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_CHECK_HEADERS(string.h)
#--------------------------------------------------------------------
# Check for tcl.h
#--------------------------------------------------------------------
AC_ARG_WITH(tcl-includes,
[ --with-tcl-includes=DIR where to look for tcl.h],
tcl_includes=$withval, tcl_includes=$prefix/include)
AC_MSG_CHECKING([where to look for tcl.h])
TCL_INCLUDE_DIR=""
for dir in $tcl_includes $prefix/include/ ${TCL_INCLUDE_SPEC#-I} /usr/include; do
if test -r $dir/tcl.h; then
TCL_INCLUDE_DIR=$dir
break
fi
done
if test -z "$TCL_INCLUDE_DIR"; then
AC_MSG_ERROR([
Can't find tcl.h. Use --with-tcl-includes to specify the directory
containing tcl.h on your system.])
else
AC_MSG_RESULT($TCL_INCLUDE_DIR/tcl.h)
fi
#--------------------------------------------------------------------
# Check for readline.h
#--------------------------------------------------------------------
AC_ARG_WITH(readline-includes,
[ --with-readline-includes=DIR readline include files in DIR],
rl_includes=$withval, rl_includes="")
dnl look for readline/readline.h
dnl ^^^^^^^^
AC_MSG_CHECKING([where to look for readline.h])
READLINE_INCLUDE_DIR=""
for dir in $rl_includes /usr/local/include /usr/include ; do
if test -r $dir/readline/readline.h; then
READLINE_INCLUDE_DIR=$dir
break
fi
done
dnl look directly in the include dirs for readline.h
if test -z "$READLINE_INCLUDE_DIR"; then
for dir in $rl_includes /usr/local/include /usr/include ; do
if test -r $dir/readline.h; then
READLINE_INCLUDE_DIR=$dir
AC_DEFINE_UNQUOTED(READLINE_LIBRARY, 1, [ Define if we have libreadline. ])
break
fi
done
fi
if test -z "$READLINE_INCLUDE_DIR"; then
AC_MSG_ERROR([
Can't find readline.h.
Use --with-readline-includes to specify the directory
containing readline.h on your system.])
fi
AC_ARG_WITH(readline-library,
[ --with-readline-library=DIR
lib spec to readline (e.g. '-L/usr/local/lib -lreadline')],
LIBS="$LIBS $withval",
AC_SEARCH_LIBS(rl_callback_read_char, readline, ,
AC_MSG_RESULT([
Your readline version does not support readline's alternate interface.
Please upgrade to readline >= 2.2 and retry.
])
exit
)
)
# check for readline's rl_executing_macro
# (could be macro.c's private variable _rl_executing_macro).
AC_CHECK_DECL(rl_executing_macro
, AC_DEFINE(EXECUTING_MACRO_NAME, rl_executing_macro,
[ Define the name of the executing macro variable in libreadline. ])
, AC_MSG_CHECKING([for _rl_executing_macro in -lreadline])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
extern char* _rl_executing_macro;
_rl_executing_macro = (char*) 0;
]])],[AC_MSG_RESULT(yes)
AC_DEFINE(EXECUTING_MACRO_HACK, 1,
Define if EXECUTING_MACRO_NAME is resolved in libreadline. )
AC_DEFINE(EXECUTING_MACRO_NAME, _rl_executing_macro,
Define the name of the executing macro variable in libreadline. )
],[AC_MSG_RESULT(no)])
, [AC_INCLUDES_DEFAULT
#include "$READLINE_INCLUDE_DIR/readline.h"])
# check for readline's rl_cleanup_after_signal
AC_MSG_CHECKING([for rl_cleanup_after_signal() in -lreadline])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
extern void rl_cleanup_after_signal();
rl_cleanup_after_signal();
]])],[AC_MSG_RESULT(yes);
AC_DEFINE(CLEANUP_AFER_SIGNAL, 1,
Define if rl_cleanup_after_signal is resolved in libreadline. )],[AC_MSG_RESULT(no)])
# check for readline's rl_extend_line_buffer
AC_MSG_CHECKING([for rl_extend_line_buffer() in -lreadline])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
extern void rl_extend_line_buffer(int len);
rl_extend_line_buffer(1);
]])],[AC_MSG_RESULT(yes);
AC_DEFINE(EXTEND_LINE_BUFFER, 1,
Define if rl_extend_line_buffer is resolved in libreadline. )],[AC_MSG_RESULT(no)])
AC_MSG_CHECKING([for the readline version number])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <unistd.h>
int main (void) {
FILE *fp = fopen("conftestversion", "w");
extern char *rl_library_version;
fprintf(fp, "%s", rl_library_version);
fclose(fp);
return 0;
}]])],[READLINE_VERSION=`cat conftestversion`
AC_MSG_RESULT($READLINE_VERSION)],[AC_MSG_RESULT(failed)],[AC_MSG_RESULT(no cross compiling)
])
AC_ARG_ENABLE(tclstub,
[ --enable-tclstub build with TCL stub library],
[dnl action if given
case "${enableval}" in
yes) enable_tclstub=true ;;
no) enable_tclstub=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-tclstub) ;;
esac
],
[dnl action if not given
enable_tclstub=false
]
)
AM_CONDITIONAL(USE_TCL_STUBS, test x$enable_tclstub = xtrue)
AC_ARG_ENABLE(tclshrl,
[ --enable-tclshrl build statically linked tclshrl],
[dnl action if given
case "${enableval}" in
yes) enable_static=true ;;
no) enable_static=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
esac
],
[dnl action if not given
enable_static=false
]
)
AM_CONDITIONAL(STATIC_TCLSHRL, test x$enable_static = xtrue)
AC_ARG_ENABLE(wishrl,
[ --enable-wishrl build statically linked wishrl],
[dnl action if given
case "${enableval}" in
yes)
enable_static=true
dnl source the tkConfig.sh which defines TK_LIB_SPEC
. $TK_LIB_DIR/tkConfig.sh
AC_SUBST(TK_LIB_SPEC)
;;
no) enable_static=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-static) ;;
esac
],
[dnl action if not given
enable_static=false
]
)
AM_CONDITIONAL(STATIC_WISHRL, test x$enable_static = xtrue)
AC_SUBST(TCL_INCLUDE_DIR)
AC_SUBST(TCL_STUB_LIB_SPEC)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(READLINE_INCLUDE_DIR)
AC_CONFIG_FILES([Makefile tclreadline.h tclreadlineInit.tcl tclreadlineSetup.tcl tclreadline.n pkgIndex.tcl])
AC_OUTPUT