Debian Codegraph @

pTk/mTk/unix/configure.in

raw
1 #! /bin/bash -norc
2 dnl This file is an input file used by the GNU "autoconf" program to
3 dnl generate the file "configure", which is run during Tk installation
4 dnl to configure the system for the local environment.
5 #
6 # RCS: @(#) $Id: configure.in,v 1.83.2.5 2003/10/06 16:59:25 dgp Exp $
7
8 AC_INIT(../generic/tk.h)
9 AC_PREREQ(2.13)
10
11 TK_VERSION=8.4
12 TK_MAJOR_VERSION=8
13 TK_MINOR_VERSION=4
14 TK_PATCH_LEVEL=".5"
15 VERSION=${TK_VERSION}
16 LOCALES="cs de el en en_gb es fr it nl ru"
17
18 #--------------------------------------------------------------------
19 # Find and load the tclConfig.sh file
20 #--------------------------------------------------------------------
21
22 SC_PATH_TCLCONFIG
23 SC_LOAD_TCLCONFIG
24
25 if test "${TCL_VERSION}" != "${TK_VERSION}"; then
26 AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}.
27 Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl ${TK_VERSION}.
28 Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl ${TK_VERSION}.])
29 fi
30
31 #------------------------------------------------------------------------
32 # Handle the --prefix=... option
33 #------------------------------------------------------------------------
34
35 if test "${prefix}" = "NONE"; then
36 prefix="$TCL_PREFIX"
37 fi
38 if test "${exec_prefix}" = "NONE"; then
39 exec_prefix=$prefix
40 fi
41 # libdir must be a fully qualified path and (not ${exec_prefix}/lib)
42 eval libdir="$libdir"
43 # Make sure srcdir is fully qualified!
44 srcdir=`cd $srcdir ; pwd`
45 TK_SRC_DIR=`cd $srcdir/..; pwd`
46
47 #------------------------------------------------------------------------
48 # Compress and/or soft link the manpages?
49 #------------------------------------------------------------------------
50 SC_CONFIG_MANPAGES
51
52 #------------------------------------------------------------------------
53 # Standard compiler checks
54 #------------------------------------------------------------------------
55
56 # If the user did not set CFLAGS, set it now to keep
57 # the AC_PROG_CC macro from adding "-g -O2".
58 if test "${CFLAGS+set}" != "set" ; then
59 CFLAGS=""
60 fi
61
62 AC_PROG_CC
63
64 #------------------------------------------------------------------------
65 # I'm not sure why these need to come before all of the other tests
66 #------------------------------------------------------------------------
67
68 AC_HAVE_HEADERS(unistd.h limits.h)
69
70 #------------------------------------------------------------------------
71 # Threads support
72 #------------------------------------------------------------------------
73
74 SC_ENABLE_THREADS
75
76 #------------------------------------------------------------------------------
77 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
78 # It makes compiling go faster. (This is only a performance feature.)
79 #------------------------------------------------------------------------------
80
81 if test -z "$no_pipe"; then
82 if test -n "$GCC"; then
83 AC_MSG_CHECKING([if the compiler understands -pipe])
84 OLDCC="$CC"
85 CC="$CC -pipe"
86 AC_TRY_COMPILE(,,
87 AC_MSG_RESULT(yes),
88 CC="$OLDCC"
89 AC_MSG_RESULT(no))
90 fi
91 fi
92
93 #--------------------------------------------------------------------
94 # Detect what compiler flags to set for 64-bit support.
95 #--------------------------------------------------------------------
96
97 SC_TCL_EARLY_FLAGS
98
99 SC_TCL_64BIT_FLAGS
100
101 #--------------------------------------------------------------------
102 # Recompute the necessary flags to run the compiler
103 #--------------------------------------------------------------------
104
105 SC_ENABLE_SHARED
106
107 SC_CONFIG_CFLAGS
108
109 SC_ENABLE_SYMBOLS
110
111 LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
112
113 TK_DBGX=${DBGX}
114
115 #------------------------------------------------------------------------
116 # If Tcl and Tk are installed in different places, adjust the library
117 # search path to reflect this.
118 #------------------------------------------------------------------------
119
120 if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
121 LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib"
122 fi
123
124 if test "$TCL_PREFIX" != "$prefix"; then
125 AC_MSG_WARN([
126 Different --prefix selected for Tk and Tcl!
127 [[package require Tk]] may not work correctly in tclsh.])
128 fi
129
130 #--------------------------------------------------------------------
131 # On a few very rare systems, all of the libm.a stuff is
132 # already in libc.a. Set compiler flags accordingly.
133 # Also, Linux requires the "ieee" library for math to work
134 # right (and it must appear before "-lm").
135 #--------------------------------------------------------------------
136
137 AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
138 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
139
140 #--------------------------------------------------------------------
141 # On AIX systems, libbsd.a has to be linked in to support
142 # non-blocking file IO. This library has to be linked in after
143 # the MATH_LIBS or it breaks the pow() function. The way to
144 # insure proper sequencing, is to add it to the tail of MATH_LIBS.
145 # This library also supplies gettimeofday.
146 #--------------------------------------------------------------------
147 libbsd=no
148 if test "`uname -s`" = "AIX" ; then
149 AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
150 if test $libbsd = yes; then
151 MATH_LIBS="$MATH_LIBS -lbsd"
152 fi
153 fi
154
155 #--------------------------------------------------------------------
156 # Supply a substitute for stdlib.h if it doesn't define strtol,
157 # strtoul, or strtod (which it doesn't in some versions of SunOS).
158 #--------------------------------------------------------------------
159
160 AC_MSG_CHECKING(stdlib.h)
161 AC_HEADER_EGREP(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
162 AC_HEADER_EGREP(strtoul, stdlib.h, , tk_ok=no)
163 AC_HEADER_EGREP(strtod, stdlib.h, , tk_ok=no)
164 if test $tk_ok = no; then
165 AC_DEFINE(NO_STDLIB_H)
166 fi
167 AC_MSG_RESULT($tk_ok)
168
169 #--------------------------------------------------------------------
170 # Include sys/select.h if it exists and if it supplies things
171 # that appear to be useful and aren't already in sys/types.h.
172 # This appears to be true only on the RS/6000 under AIX. Some
173 # systems like OSF/1 have a sys/select.h that's of no use, and
174 # other systems like SCO UNIX have a sys/select.h that's
175 # pernicious. If "fd_set" isn't defined anywhere then set a
176 # special flag.
177 #--------------------------------------------------------------------
178
179 AC_MSG_CHECKING([fd_set and sys/select])
180 AC_TRY_COMPILE([#include <sys/types.h>],
181 [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
182 if test $tk_ok = no; then
183 AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
184 if test $tk_ok = yes; then
185 AC_DEFINE(HAVE_SYS_SELECT_H)
186 fi
187 fi
188 AC_MSG_RESULT($tk_ok)
189 if test $tk_ok = no; then
190 AC_DEFINE(NO_FD_SET)
191 fi
192
193 #--------------------------------------------------------------------
194 # Check for various typedefs and provide substitutes if
195 # they don't exist.
196 #--------------------------------------------------------------------
197
198 AC_TYPE_MODE_T
199 AC_TYPE_PID_T
200 AC_TYPE_SIZE_T
201 AC_TYPE_UID_T
202
203 #------------------------------------------------------------------------------
204 # Find out about time handling differences.
205 #------------------------------------------------------------------------------
206
207 AC_CHECK_HEADERS(sys/time.h)
208 AC_HEADER_TIME
209
210 #-------------------------------------------
211 # In OS/390 struct pwd has no pw_gecos field
212 #-------------------------------------------
213
214 AC_MSG_CHECKING([pw_gecos in struct pwd])
215 AC_TRY_COMPILE([#include <pwd.h>],
216 [struct passwd pwd; pwd.pw_gecos;], tk_ok=yes, tk_ok=no)
217 AC_MSG_RESULT($tk_ok)
218 if test $tk_ok = yes; then
219 AC_DEFINE(HAVE_PW_GECOS)
220 fi
221
222 #--------------------------------------------------------------------
223 # Locate the X11 header files and the X11 library archive. Try
224 # the ac_path_x macro first, but if it doesn't find the X stuff
225 # (e.g. because there's no xmkmf program) then check through
226 # a list of possible directories. Under some conditions the
227 # autoconf macro will return an include directory that contains
228 # no include files, so double-check its result just to be safe.
229 #--------------------------------------------------------------------
230
231 SC_PATH_X
232
233 #--------------------------------------------------------------------
234 # Various manipulations on the search path used at runtime to
235 # find shared libraries:
236 # 1. If the X library binaries are in a non-standard directory,
237 # add the X library location into that search path.
238 # 2. On systems such as AIX and Ultrix that use "-L" as the
239 # search path option, colons cannot be used to separate
240 # directories from each other. Change colons to " -L".
241 # 3. Create two sets of search flags, one for use in cc lines
242 # and the other for when the linker is invoked directly. In
243 # the second case, '-Wl,' must be stripped off and commas must
244 # be replaced by spaces.
245 #--------------------------------------------------------------------
246
247 if test "x${x_libraries}" != "x"; then
248 LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}"
249 fi
250 if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
251 LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
252 fi
253
254 # The statement below is very tricky! It actually *evaluates* the
255 # string in TCL_CC_SEARCH_FLAGS and TCL_LD_SEARCH_FLAGS which
256 # causes a substitution of the variable LIB_RUNTIME_DIR.
257
258 eval "CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\""
259 eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
260
261 #--------------------------------------------------------------------
262 # Check for the existence of various libraries. The order here
263 # is important, so that then end up in the right order in the
264 # command line generated by make. The -lsocket and -lnsl libraries
265 # require a couple of special tricks:
266 # 1. Use "connect" and "accept" to check for -lsocket, and
267 # "gethostbyname" to check for -lnsl.
268 # 2. Use each function name only once: can't redo a check because
269 # autoconf caches the results of the last check and won't redo it.
270 # 3. Use -lnsl and -lsocket only if they supply procedures that
271 # aren't already present in the normal libraries. This is because
272 # IRIX 5.2 has libraries, but they aren't needed and they're
273 # bogus: they goof up name resolution if used.
274 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
275 # To get around this problem, check for both libraries together
276 # if -lsocket doesn't work by itself.
277 #--------------------------------------------------------------------
278
279 AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
280
281 tk_checkBoth=0
282 AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
283 if test "$tk_checkSocket" = 1; then
284 AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
285 fi
286 if test "$tk_checkBoth" = 1; then
287 tk_oldLibs=$LIBS
288 LIBS="$LIBS -lsocket -lnsl"
289 AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
290 fi
291 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])])
292
293 # Add the threads support libraries
294
295 LIBS="$LIBS$THREADS_LIBS"
296
297 #--------------------------------------------------------------------
298 # One more check related to the X libraries. The standard releases
299 # of Ultrix don't support the "xauth" mechanism, so send won't work
300 # unless TK_NO_SECURITY is defined. However, there are usually copies
301 # of the MIT X server available as well, which do support xauth.
302 # Check for the MIT stuff and use it if it exists.
303 #
304 # Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
305 # because it can't deal with the "-" in the library name.
306 #--------------------------------------------------------------------
307
308 if test -d /usr/include/mit ; then
309 AC_MSG_CHECKING([MIT X libraries])
310 tk_oldCFlags=$CFLAGS
311 CFLAGS="$CFLAGS -I/usr/include/mit"
312 tk_oldLibs=$LIBS
313 LIBS="$LIBS -lX11-mit"
314 AC_TRY_LINK([
315 #include <X11/Xlib.h>
316 ], [
317 XOpenDisplay(0);
318 ], [
319 AC_MSG_RESULT(yes)
320 XLIBSW="-lX11-mit"
321 XINCLUDES="-I/usr/include/mit"
322 ], AC_MSG_RESULT(no))
323 CFLAGS=$tk_oldCFlags
324 LIBS=$tk_oldLibs
325 fi
326
327 #--------------------------------------------------------------------
328 # On a few very rare systems, all of the libm.a stuff is
329 # already in libc.a. Set compiler flags accordingly.
330 # Also, Linux requires the "ieee" library for math to
331 # work right (and it must appear before "-lm").
332 #--------------------------------------------------------------------
333
334 MATH_LIBS=""
335 AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
336 AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
337
338 #--------------------------------------------------------------------
339 # Figure out whether "char" is unsigned. If so, set a
340 # #define for __CHAR_UNSIGNED__.
341 #--------------------------------------------------------------------
342
343 AC_C_CHAR_UNSIGNED
344
345 #--------------------------------------------------------------------
346 # Under Solaris 2.4, strtod returns the wrong value for the
347 # terminating character under some conditions. Check for this
348 # and if the problem exists use a substitute procedure
349 # "fixstrtod" (provided by Tcl) that corrects the error.
350 #--------------------------------------------------------------------
351
352 SC_BUGGY_STRTOD
353
354 #--------------------------------------------------------------------
355 # The statements below define a collection of symbols related to
356 # building libtk as a shared library instead of a static library.
357 #--------------------------------------------------------------------
358
359 eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
360 eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
361
362 if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then
363 SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TCL_STUB_LIB_SPEC}"
364 TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
365 else
366 TCL_STUB_FLAGS=""
367 fi
368 TK_LIB_FILE=libtk${LIB_SUFFIX}
369 eval "TK_LIB_FILE=${TK_LIB_FILE}"
370
371 # Note: in the following variable, it's important to use the absolute
372 # path name of the Tcl directory rather than "..": this is because
373 # AIX remembers this path and will attempt to use it at run-time to look
374 # up the Tcl library.
375
376 if test "$SHARED_BUILD" = 0 -o $TCL_NEEDS_EXP_FILE = 0; then
377 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
378 eval TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
379 else
380 eval TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
381 fi
382 TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}"
383 TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}"
384 TK_BUILD_EXP_FILE=""
385 TK_EXP_FILE=""
386 else
387 TK_BUILD_EXP_FILE="lib.exp"
388 eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
389
390 if test "$GCC" = "yes" ; then
391 TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TK_BUILD_EXP_FILE} -L`pwd`"
392 TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L`pwd`"
393 else
394 TK_BUILD_LIB_SPEC="-bI:`pwd`/${TK_BUILD_EXP_FILE}"
395 TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}"
396 fi
397 fi
398 TK_SHARED_BUILD=${SHARED_BUILD}
399
400 #--------------------------------------------------------------------
401 # The statements below define various symbols relating to creating
402 # the stub'd version of the Tk library
403 #
404 # For now, linking to Tcl stubs is not supported with Tk. It causes
405 # too many problems with linking. When Tk is a fully loadable
406 # extension, linking the the Tcl stubs will be supported.
407 #--------------------------------------------------------------------
408
409 # Replace ${VERSION} with contents of ${TK_VERSION}
410 eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}"
411
412 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
413 eval TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}\${TK_DBGX}"
414 else
415 eval TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`\${TK_DBGX}"
416 fi
417
418 TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}"
419 TK_STUB_LIB_SPEC="-L${libdir} ${TK_STUB_LIB_FLAG}"
420 TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}"
421 TK_STUB_LIB_PATH="${libdir}/${TK_STUB_LIB_FILE}"
422
423 eval "TK_LIB_FILE=${TK_LIB_FILE}"
424
425 AC_SUBST(TK_VERSION)
426 AC_SUBST(TK_MAJOR_VERSION)
427 AC_SUBST(TK_MINOR_VERSION)
428 AC_SUBST(TK_PATCH_LEVEL)
429 AC_SUBST(TK_DBGX)
430
431 AC_SUBST(TK_STUB_LIB_FILE)
432 AC_SUBST(TK_STUB_LIB_FLAG)
433 AC_SUBST(TK_BUILD_STUB_LIB_SPEC)
434 AC_SUBST(TK_STUB_LIB_SPEC)
435 AC_SUBST(TK_BUILD_STUB_LIB_PATH)
436 AC_SUBST(TK_STUB_LIB_PATH)
437 AC_SUBST(TK_STUB_FLAGS)
438 AC_SUBST(TK_BUILD_EXP_FILE)
439 AC_SUBST(TK_EXP_FILE)
440
441 AC_SUBST(TCL_STUB_FLAGS)
442 AC_SUBST(TK_BUILD_EXP_FILE)
443 AC_SUBST(TK_EXP_FILE)
444
445 AC_SUBST(LD_LIBRARY_PATH_VAR)
446
447 AC_SUBST(MATH_LIBS)
448 AC_SUBST(TK_BUILD_LIB_SPEC)
449 AC_SUBST(TK_LIB_FILE)
450 AC_SUBST(TK_LIB_FLAG)
451 AC_SUBST(TK_LIB_SPEC)
452 AC_SUBST(TK_SRC_DIR)
453 AC_SUBST(XINCLUDES)
454 AC_SUBST(XLIBSW)
455 AC_SUBST(TK_SHARED_BUILD)
456 AC_SUBST(LOCALES)
457
458 AC_OUTPUT(Makefile tkConfig.sh)