-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
executable file
·504 lines (456 loc) · 16.5 KB
/
configure.in
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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Ck installation
dnl to configure the system for the local environment.
AC_INIT(ck.h)
AC_PROG_INSTALL
AC_PROG_RANLIB
CC=${CC-cc}
AC_HAVE_HEADERS(unistd.h limits.h)
#--------------------------------------------------------------------
# Supply a substitute for stdlib.h if it doesn't define strtol,
# strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------
AC_MSG_CHECKING(stdlib.h)
AC_HEADER_EGREP(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
AC_HEADER_EGREP(strtoul, stdlib.h, , tk_ok=no)
AC_HEADER_EGREP(strtod, stdlib.h, , tk_ok=no)
if test $tk_ok = no; then
AC_DEFINE(NO_STDLIB_H)
fi
AC_MSG_RESULT($tk_ok)
#--------------------------------------------------------------------
# Check for various typedefs and provide substitutes if
# they don't exist.
#--------------------------------------------------------------------
AC_MODE_T
AC_PID_T
AC_SIZE_T
AC_UID_T
#------------------------------------------------------------------------------
# What type do signals return? Do we have sigaction ?
#------------------------------------------------------------------------------
AC_RETSIGTYPE
AC_HAVE_FUNCS(sigaction)
#--------------------------------------------------------------------
# See if there was a command-line option for where Tcl is; if
# not, assume that its top-level directory is a sibling of ours.
#--------------------------------------------------------------------
TCL_LIB_DIR=$(find /usr/lib -type d -a -name 'tcl8.*' | tail -1)
if test -z "$TCL_LIB_DIR" ; then
TCL_LIB_DIR=$(find /usr/lib64 -type d -a -name 'tcl8.*' | tail -1)
fi
AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.X binaries from DIR],
TCL_BIN_DIR=$withval, TCL_BIN_DIR="$TCL_LIB_DIR")
if test ! -d $TCL_BIN_DIR ; then
AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR doesn't exist)
fi
#--------------------------------------------------------------------
# Read in configuration information generated by Tcl for shared
# libraries, and arrange for it to be substituted into our
# Makefile.
#--------------------------------------------------------------------
if test -z "$TCL_BIN_DIR" ; then
for i in /usr/lib /usr/lib64 /usr/local/lib /opt/lib ; do
if test -r $i/tclConfig.sh ; then
echo "Found tclConfig.sh in $i"
TCL_BIN_DIR=$i
break
fi
done
fi
if test -r $TCL_BIN_DIR/tclConfig.sh ; then
file=$TCL_BIN_DIR/tclConfig.sh
if test -d $TCL_BIN_DIR/../generic ; then
TCL_DIR=`cd $TCL_BIN_DIR/../generic ; pwd`
elif test -d $TCL_BIN_DIR/../include ; then
TCL_DIR=`cd $TCL_BIN_DIR/../include ; pwd`
else
TCL_DIR=$TCL_BIN_DIR
fi
. $file
CC=$TCL_CC
SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
SHLIB_LD=$TCL_SHLIB_LD
SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
SHLIB_VERSION=$TCL_SHLIB_VERSION
DL_LIBS=$TCL_DL_LIBS
LD_FLAGS=$TCL_LD_FLAGS
LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS
TCL_BUILD_LIB_SPEC="${TCL_LIB_SPEC}"
else
TCL_DIR=$TCL_BIN_DIR
TCL_LIB_FILE=libtcl.a
TCL_LIB_VERSIONS_OK=no
TCL_BUILD_LIB_SPEC="-L$TCL_BIN_DIR -ltcl"
fi
CK_SHLIB_CFLAGS=
CK_CFLAGS=
AC_MSG_CHECKING([Ck version])
if test "${TCL_VERSION}" = "7.4"; then
VERSION=4.0
CK_VERSION=4.0
CK_MAJOR_VERSION=4
CK_MINOR_VERSION=0
elif test "${TCL_VERSION}" = "7.5"; then
VERSION=4.1
CK_VERSION=4.1
CK_MAJOR_VERSION=4
CK_MINOR_VERSION=1
elif test "${TCL_VERSION}" = "7.6"; then
VERSION=4.2
CK_VERSION=4.2
CK_MAJOR_VERSION=4
CK_MINOR_VERSION=2
else
# Assume Tcl8.0 or higher
VERSION=$TCL_VERSION
CK_VERSION=$VERSION
CK_MAJOR_VERSION=$TCL_MAJOR_VERSION
CK_MINOR_VERSION=$TCL_MINOR_VERSION
# Special for 8.4 to avoid lots of warnings
CK_CFLAGS="-DUSE_NON_CONST"
fi
AC_MSG_RESULT(${CK_VERSION})
#--------------------------------------------------------------------
# Include sys/select.h if it exists and if it supplies things
# that appear to be useful and aren't already in sys/types.h.
# This appears to be true only on the RS/6000 under AIX. Some
# systems like OSF/1 have a sys/select.h that's of no use, and
# other systems like SCO UNIX have a sys/select.h that's
# pernicious. If "fd_set" isn't defined anywhere then set a
# special flag.
#--------------------------------------------------------------------
AC_MSG_CHECKING([fd_set and sys/select])
AC_TRY_COMPILE([#include <sys/types.h>],
[fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
if test $tk_ok = no; then
AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
if test $tk_ok = yes; then
AC_DEFINE(HAVE_SYS_SELECT_H)
fi
fi
AC_MSG_RESULT($tk_ok)
if test $tk_ok = no; then
AC_DEFINE(NO_FD_SET)
fi
#---------------------------------------------------------------------
# Locate the curses header files and the curses library archive.
# The order is:
# ../ncurses
# /usr/include and /usr/lib
# /opt/ncurses
# /usr/local
# /usr/local/ncurses
#---------------------------------------------------------------------
echo checking for curses/ncurses header files
CURSESINCLUDES=nope
USE_NCURSESW=0
dirs="../ncurses/include /usr/include/ncursesw /usr/include /usr/include/ncurses /opt/ncurses/include /usr/local/include /usr/local/include/ncurses"
for i in $dirs ; do
if test -r $i/ncurses.h; then
AC_MSG_CHECKING([ncurses headers])
tk_oldCFlags=$CFLAGS
CFLAGS="$CFLAGS -I$i"
AC_TRY_COMPILE([#include <ncurses.h>],
[int c; initscr(); c = ACS_ULCORNER; curs_set(1);],
[AC_MSG_RESULT(yes)
CURSESINCLUDES="-I$i"], AC_MSG_RESULT(no))
CFLAGS=$tk_oldCFlags
if test "$CURSESINCLUDES" != nope; then
USE_NCURSESW=1
break
fi
fi
done
if test "$CURSESINCLUDES" = nope; then
echo "Warning: couldn't find any curses header file."
CURSESINCLUDES="# no header file found"
else
if test $USE_NCURSESW = 1 ; then
echo "using ncurses.h from $CURSESINCLUDES"
else
echo "can't find usable ncurses.h"
fi
fi
echo checking for ncursesw library files
CURSESLIBSW=nope
dirs="../ncurses/lib /usr/lib /usr/lib64 /usr/lib/ncurses /usr/lib64/ncurses /usr/lib/`uname -m`-linux-gnu /usr/lib/arm-linux-gnueabihf /opt/ncurses/lib /usr/local/lib /usr/local/ncurses/lib"
for i in $dirs ; do
if test -r $i/libncursesw.a || test -r $i/libncursesw$SHLIB_SUFFIX ; then
AC_MSG_CHECKING([ncursesw library])
tk_oldCFlags=$CFLAGS
CFLAGS="$CFLAGS $CURSESINCLUDES -D_XOPEN_SOURCE_EXTENDED"
if test "$i" = "/usr/lib" ; then
LIBSW="-lncursesw"
else
LIBSW="-L$i -lncursesw"
fi
tk_oldLibs=$LIBS
LIBS="$LIBSW"
AC_TRY_LINK([#include <ncurses.h>],
[int c; initscr(); c = ACS_ULCORNER; addwstr("");],
[AC_MSG_RESULT(yes)
USE_NCURSESW=1
CURSESINCLUDES="$CURSESINCLUDES -D_XOPEN_SOURCE_EXTENDED"
CURSESLIBSW="$LIBSW"], AC_MSG_RESULT(no))
CFLAGS=$tk_oldCFlags
LIBS=$tk_oldLibs
if test "$CURSESLIBSW" != nope; then
break
fi
fi
done
if test "$CURSESLIBSW" = nope ; then
echo "Warning: couldn't find the curses library archive. Using -lncursesw."
CURSESLIBSW="-lncursesw -ltermcap"
CURSESINCLUDES="$CURSESINCLUDES -D_XOPEN_SOURCE_EXTENDED"
else
echo "using curses library: $CURSESLIBSW"
AC_MSG_CHECKING([curses scr_dump function])
tk_oldCFlags=$CFLAGS
CFLAGS="$CFLAGS $CURSESINCLUDES"
tk_oldLibs=$LIBS
LIBS="$CURSESLIBSW"
if test $USE_NCURSESW = 1 ; then
AC_TRY_LINK([#include <ncurses.h>],
[int c; initscr(); scr_dump("xx");],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SCR_DUMP)], AC_MSG_RESULT(no))
fi
CFLAGS=$tk_oldCFlags
LIBS=$tk_oldLibs
fi
if test $USE_NCURSESW = 1 ; then
USE_NCURSESW="-DUSE_NCURSESW"
else
USE_NCURSESW=""
fi
USE_NCURSESW="-DUSE_NCURSESW"
#---------------------------------------------------------------------
# Check for GPM (General Purpose Mouse)
#---------------------------------------------------------------------
AC_MSG_CHECKING([GPM library])
tk_oldLibs=$LIBS
LIBS="-lgpm"
AC_TRY_LINK([#include <gpm.h>],
[Gpm_Connect conn; Gpm_Open(&conn, 0);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GPM)
CURSESLIBSW="$CURSESLIBSW -lgpm"],
[AC_MSG_RESULT(no)])
LIBS=$tk_oldLibs
#--------------------------------------------------------------------
# Check for the existence of various libraries. The order here
# is important, so that then end up in the right order in the
# command line generated by make. The -lsocket and -lnsl libraries
# require a couple of special tricks:
# 1. Use "connect" and "accept" to check for -lsocket, and
# "gethostbyname" to check for -lnsl.
# 2. Use each function name only once: can't redo a check because
# autoconf caches the results of the last check and won't redo it.
# 3. Use -lnsl and -lsocket only if they supply procedures that
# aren't already present in the normal libraries. This is because
# IRIX 5.2 has libraries, but they aren't needed and they're
# bogus: they goof up name resolution if used.
# 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
# To get around this problem, check for both libraries together
# if -lsocket doesn't work by itself.
#--------------------------------------------------------------------
AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
tk_checkBoth=0
AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
if test "$tk_checkSocket" = 1; then
AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
fi
if test "$tk_checkBoth" = 1; then
tk_oldLibs=$LIBS
LIBS="$LIBS -lsocket -lnsl"
AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
#--------------------------------------------------------------------
# On Interactive the str(n)casecmp is burried in libinet.a
#--------------------------------------------------------------------
AC_CHECK_FUNC(strncasecmp, , AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]))
#--------------------------------------------------------------------
# Figure out how to find out whether a FILE structure contains
# buffered readable data. Some known names for the count field:
# _cnt: Most UNIX systems
# __cnt: HPUX
# _r: BSD
# readCount: Sprite
# Or, in GNU libc there are two fields, _gptr and _egptr, which
# have to be compared.
#--------------------------------------------------------------------
AC_MSG_CHECKING([count field in FILE structures])
AC_TRY_COMPILE([#include <stdio.h>],
[FILE *f = stdin; f->_cnt = 0;], fcnt="_cnt", )
if test "$fcnt" = ""; then
AC_TRY_COMPILE([#include <stdio.h>],
[FILE *f = stdin; f->__cnt = 0;], fcnt="__cnt", )
fi
if test "$fcnt" = ""; then
AC_TRY_COMPILE([#include <stdio.h>],
[FILE *f = stdin; f->_r = 0;], fcnt="_r", )
fi
if test "$fcnt" = ""; then
AC_TRY_COMPILE([#include <stdio.h>],
[FILE *f = stdin; f->readCount = 0;], fcnt="readCount", )
fi
if test "$fcnt" != ""; then
AC_DEFINE_UNQUOTED(TK_FILE_COUNT, $fcnt)
fi
if test "$fcnt" = ""; then
AC_TRY_COMPILE([#include <stdio.h>],
[FILE *f = stdin; f->_gptr = f->_egptr;],
tk_ok=yes, tk_ok=no)
if test $tk_ok = yes; then
AC_DEFINE(TK_FILE_GPTR)
fcnt="_gptr/_egptr"
fi
fi
if test "$fcnt" = ""; then
AC_TRY_COMPILE([#include <stdio.h>],
[FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
tk_ok=yes, tk_ok=no)
if test $tk_ok = yes; then
AC_DEFINE(TK_FILE_READ_PTR)
fcnt="_IO_read_ptr/_IO_read_end"
fi
fi
if test "$fcnt" = ""; then
AC_MSG_RESULT([not found; must supply TkReadDataPending procedure])
else
AC_MSG_RESULT("$fcnt")
fi
#--------------------------------------------------------------------
# On a few very rare systems, all of the libm.a stuff is
# already in libc.a. Set compiler flags accordingly.
# Also, Linux requires the "ieee" library for math to
# work right (and it must appear before "-lm").
#--------------------------------------------------------------------
MATH_LIBS=""
AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
#--------------------------------------------------------------------
# If this system doesn't have a memmove procedure, use memcpy
# instead.
#--------------------------------------------------------------------
AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)])
#--------------------------------------------------------------------
# SGI systems don't use the BSD form of the gettimeofday function,
# but they have a BSDgettimeofday function that can be used instead.
#
# Also, check for the existence of a gettimeofday declaration,
# to tkPort.h can declare it if it isn't already declared.
#--------------------------------------------------------------------
AC_CHECK_FUNC(BSDgettimeofday, AC_DEFINE(HAVE_BSDGETTIMEOFDAY))
AC_MSG_CHECKING([for gettimeofday declaration])
AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [
AC_MSG_RESULT(missing)
AC_DEFINE(GETTOD_NOT_DECLARED)
])
#--------------------------------------------------------------------
# Under Solaris 2.4, strtod returns the wrong value for the
# terminating character under some conditions. Check for this
# and if the problem exists use a substitute procedure
# "fixstrtod" (provided by Tcl) that corrects the error.
#--------------------------------------------------------------------
AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
if test "$tk_strtod" = 1; then
AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
AC_TRY_RUN([
extern double strtod();
int main()
{
char *string = "NaN";
char *term;
strtod(string, &term);
if ((term != string) && (term[-1] == 0)) {
exit(1);
}
exit(0);
}], tk_ok=1, tk_ok=0, tk_ok=0)
if test "$tk_ok" = 1; then
AC_MSG_RESULT(ok)
else
AC_MSG_RESULT(buggy)
AC_DEFINE(strtod, fixstrtod)
fi
fi
#--------------------------------------------------------------------
# forkpty might be in lutil
#--------------------------------------------------------------------
AC_CHECK_FUNC(forkpty, , AC_CHECK_LIB(util, forkpty, [LIBS="$LIBS -lutil"]))
#--------------------------------------------------------------------
# The statements below define a collection of symbols related to
# building libck as a shared library instead of a static library.
#--------------------------------------------------------------------
AC_ARG_ENABLE(shared,
[ --enable-shared build libck as a shared library],
[ok=$enableval], [ok=no])
if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
CK_SHLIB_CFLAGS="${CK_SHLIB_CFLAGS} ${SHLIB_CFLAGS}"
eval "CK_LIB_FILE=libck${TCL_SHARED_LIB_SUFFIX}"
eval "suffix=${TCL_SHARED_LIB_SUFFIX}"
case "$suffix" in
${VERSION}*) ;;
*) eval "CK_LIB_FILE=libck${VERSION}${TCL_SHARED_LIB_SUFFIX}" ;;
esac
MAKE_LIB="\${SHLIB_LD} -o ${CK_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
RANLIB=":"
else
CK_SHLIB_CFLAGS=""
eval "CK_LIB_FILE=libck${TCL_UNSHARED_LIB_SUFFIX}"
eval "suffix=${TCL_UNSHARED_LIB_SUFFIX}"
case "$suffix" in
${VERSION}*) ;;
*) eval "CK_LIB_FILE=libck${VERSION}${TCL_UNSHARED_LIB_SUFFIX}" ;;
esac
# Fixup if suffix missing
if test "$CK_LIB_FILE" = "libck" ; then
CK_LIB_FILE=libck.a
fi
MAKE_LIB="ar cr ${CK_LIB_FILE} \${OBJS}"
fi
# Note: in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..": this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.
if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
CK_BUILD_LIB_SPEC="-L`pwd` -lck${VERSION}"
CK_LIB_SPEC="-L${exec_prefix}/lib -lck${VERSION}"
else
CK_BUILD_LIB_SPEC="-L`pwd` -lck`echo ${VERSION} | tr -d .`"
CK_LIB_SPEC="-L${exec_prefix}/lib -lck`echo ${VERSION} | tr -d .`"
fi
AC_SUBST(CC)
AC_SUBST(DL_LIBS)
AC_SUBST(LD_FLAGS)
AC_SUBST(MATH_LIBS)
AC_SUBST(MAKE_LIB)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(SHLIB_VERSION)
AC_SUBST(TCL_DIR)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_LIB)
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_BUILD_LIB_SPEC)
AC_SUBST(TCL_INCLUDE_SPEC)
AC_SUBST(CK_LD_SEARCH_FLAGS)
AC_SUBST(CK_LIB_FILE)
AC_SUBST(CK_LIB_SPEC)
AC_SUBST(CK_MAJOR_VERSION)
AC_SUBST(CK_MINOR_VERSION)
AC_SUBST(CK_CFLAGS)
AC_SUBST(CK_SHLIB_CFLAGS)
AC_SUBST(CK_VERSION)
AC_SUBST(CK_BUILD_LIB_SPEC)
AC_SUBST(USE_NCURSESW)
AC_SUBST(CURSESINCLUDES)
AC_SUBST(CURSESLIBSW)
AC_OUTPUT(Makefile ckConfig.sh)