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 Tcl installation
4 dnl to configure the system for the local environment.
8 AC_INIT(../generic/tcl.h)
15 VERSION=${TCL_VERSION}
17 #------------------------------------------------------------------------
18 # Handle the --prefix=... option
19 #------------------------------------------------------------------------
21 if test "${prefix}" = "NONE"; then
24 if test "${exec_prefix}" = "NONE"; then
27 # libdir must be a fully qualified path and (not ${exec_prefix}/lib)
29 TCL_SRC_DIR=`cd $srcdir/..; pwd`
31 #------------------------------------------------------------------------
32 # Compress and/or soft link the manpages?
33 #------------------------------------------------------------------------
36 #------------------------------------------------------------------------
37 # Standard compiler checks
38 #------------------------------------------------------------------------
40 # If the user did not set CFLAGS, set it now to keep
41 # the AC_PROG_CC macro from adding "-g -O2".
42 if test "${CFLAGS+set}" != "set" ; then
47 AC_HAVE_HEADERS(unistd.h limits.h)
49 #------------------------------------------------------------------------
51 #------------------------------------------------------------------------
55 #------------------------------------------------------------------------
56 # If we're using GCC, see if the compiler understands -pipe. If so, use it.
57 # It makes compiling go faster. (This is only a performance feature.)
58 #------------------------------------------------------------------------
60 if test -z "$no_pipe"; then
61 if test -n "$GCC"; then
62 AC_MSG_CHECKING([if the compiler understands -pipe])
72 #--------------------------------------------------------------------
73 # Detect what compiler flags to set for 64-bit support.
74 #--------------------------------------------------------------------
80 #--------------------------------------------------------------------
81 # Check endianness because we can optimize comparisons of
82 # Tcl_UniChar strings to memcmp on big-endian systems.
83 #--------------------------------------------------------------------
87 #--------------------------------------------------------------------
88 # Supply substitutes for missing POSIX library procedures, or
89 # set flags so Tcl uses alternate procedures.
90 #--------------------------------------------------------------------
92 # Check if Posix compliant getcwd exists, if not we'll use getwd.
93 AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD)])
94 # Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really
95 # define USEGETWD even if the posix getcwd exists. Add a test ?
97 AC_REPLACE_FUNCS(opendir strstr)
99 AC_REPLACE_FUNCS(strtol strtoll strtoull tmpnam waitpid)
100 AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR)])
101 AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD)])
102 AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3)])
103 AC_CHECK_FUNC(uname, , [AC_DEFINE(NO_UNAME)])
104 AC_CHECK_FUNC(realpath, , [AC_DEFINE(NO_REALPATH)])
106 #--------------------------------------------------------------------
107 # Supply substitutes for missing POSIX header files. Special
109 # - stdlib.h doesn't define strtol, strtoul, or
110 # strtod insome versions of SunOS
111 # - some versions of string.h don't declare procedures such
113 #--------------------------------------------------------------------
115 SC_MISSING_POSIX_HEADERS
117 #---------------------------------------------------------------------------
118 # Determine which interface to use to talk to the serial port.
119 # Note that #include lines must begin in leftmost column for
120 # some compilers to recognize them as preprocessor directives.
121 #---------------------------------------------------------------------------
125 #--------------------------------------------------------------------
126 # Include sys/select.h if it exists and if it supplies things
127 # that appear to be useful and aren't already in sys/types.h.
128 # This appears to be true only on the RS/6000 under AIX. Some
129 # systems like OSF/1 have a sys/select.h that's of no use, and
130 # other systems like SCO UNIX have a sys/select.h that's
131 # pernicious. If "fd_set" isn't defined anywhere then set a
133 #--------------------------------------------------------------------
135 AC_MSG_CHECKING([for fd_set in sys/types])
136 AC_CACHE_VAL(tcl_cv_type_fd_set,
137 AC_TRY_COMPILE([#include <sys/types.h>],[fd_set readMask, writeMask;],
138 tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no))
139 AC_MSG_RESULT($tcl_cv_type_fd_set)
140 tk_ok=$tcl_cv_type_fd_set
141 if test $tcl_cv_type_fd_set = no; then
142 AC_MSG_CHECKING([for fd_mask in sys/select])
143 AC_CACHE_VAL(tcl_cv_grep_fd_mask,
144 AC_HEADER_EGREP(fd_mask, sys/select.h,
145 tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing))
146 AC_MSG_RESULT($tcl_cv_grep_fd_mask)
147 if test $tcl_cv_grep_fd_mask = present; then
148 AC_DEFINE(HAVE_SYS_SELECT_H)
152 if test $tk_ok = no; then
156 #------------------------------------------------------------------------------
157 # Find out all about time handling differences.
158 #------------------------------------------------------------------------------
162 #--------------------------------------------------------------------
163 # Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
164 # in struct stat. But we might be able to use fstatfs instead.
165 #--------------------------------------------------------------------
167 AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS)])
169 #--------------------------------------------------------------------
170 # Some system have no memcmp or it does not work with 8 bit
171 # data, this checks it and add memcmp.o to LIBOBJS if needed
172 #--------------------------------------------------------------------
175 #--------------------------------------------------------------------
176 # Some system like SunOS 4 and other BSD like systems
177 # have no memmove (we assume they have bcopy instead).
178 # {The replacement define is in compat/string.h}
179 #--------------------------------------------------------------------
180 AC_CHECK_FUNC(memmove, , [AC_DEFINE(NO_MEMMOVE) AC_DEFINE(NO_STRING_H)])
182 #--------------------------------------------------------------------
183 # On some systems strstr is broken: it returns a pointer even
184 # even if the original string is empty.
185 #--------------------------------------------------------------------
187 AC_MSG_CHECKING([proper strstr implementation])
192 exit(strstr("\0test", "test") ? 1 : 0);
194 ], tcl_ok=yes, tcl_ok=no, tcl_ok=no)
195 if test $tcl_ok = yes; then
198 AC_MSG_RESULT([broken, using substitute])
203 #--------------------------------------------------------------------
204 # Check for strtoul function. This is tricky because under some
205 # versions of AIX strtoul returns an incorrect terminator
206 # pointer for the string "0".
207 #--------------------------------------------------------------------
209 AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0)
211 extern int strtoul();
217 value = strtoul(string, &term, 0);
218 if ((value != 0) || (term != (string+1))) {
222 }], , tcl_ok=0, tcl_ok=0)
223 if test "$tcl_ok" = 0; then
224 test -n "$verbose" && echo " Adding strtoul.o."
229 #--------------------------------------------------------------------
230 # Check for the strtod function. This is tricky because in some
231 # versions of Linux strtod mis-parses strings starting with "+".
232 #--------------------------------------------------------------------
234 AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0)
236 extern double strtod();
239 char *string = " +69";
242 value = strtod(string, &term);
243 if ((value != 69) || (term != (string+4))) {
247 }], , tcl_ok=0, tcl_ok=0)
248 if test "$tcl_ok" = 0; then
249 test -n "$verbose" && echo " Adding strtod.o."
254 #--------------------------------------------------------------------
255 # Under Solaris 2.4, strtod returns the wrong value for the
256 # terminating character under some conditions. Check for this
257 # and if the problem exists use a substitute procedure
258 # "fixstrtod" that corrects the error.
259 #--------------------------------------------------------------------
263 #--------------------------------------------------------------------
264 # Check for various typedefs and provide substitutes if
266 #--------------------------------------------------------------------
273 AC_MSG_CHECKING([for socklen_t])
274 AC_CACHE_VAL(ac_cv_type_socklen_t,[AC_EGREP_CPP(changequote(<<,>>)dnl
275 <<(^|[^a-zA-Z_0-9])socklen_t[^a-zA-Z_0-9]>>dnl
277 #include <sys/types.h>
278 #include <sys/socket.h>
283 ], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)])
284 AC_MSG_RESULT($ac_cv_type_socklen_t)
285 if test $ac_cv_type_socklen_t = no; then
286 AC_DEFINE(socklen_t, unsigned)
289 #--------------------------------------------------------------------
290 # If a system doesn't have an opendir function (man, that's old!)
291 # then we have to supply a different version of dirent.h which
292 # is compatible with the substitute version of opendir that's
293 # provided. This version only works with V7-style directories.
294 #--------------------------------------------------------------------
296 AC_CHECK_FUNC(opendir, , [AC_DEFINE(USE_DIRENT2_H)])
298 #--------------------------------------------------------------------
299 # The check below checks whether <sys/wait.h> defines the type
300 # "union wait" correctly. It's needed because of weirdness in
301 # HP-UX where "union wait" is defined in both the BSD and SYS-V
302 # environments. Checking the usability of WIFEXITED seems to do
304 #--------------------------------------------------------------------
306 AC_MSG_CHECKING([union wait])
307 AC_CACHE_VAL(tcl_cv_union_wait,
308 AC_TRY_LINK([#include <sys/types.h>
309 #include <sys/wait.h>], [
311 WIFEXITED(x); /* Generates compiler error if WIFEXITED
313 ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no))
314 AC_MSG_RESULT($tcl_cv_union_wait)
315 if test $tcl_cv_union_wait = no; then
316 AC_DEFINE(NO_UNION_WAIT)
319 #--------------------------------------------------------------------
320 # Check whether there is an strncasecmp function on this system.
321 # This is a bit tricky because under SCO it's in -lsocket and
322 # under Sequent Dynix it's in -linet.
323 #--------------------------------------------------------------------
325 AC_CHECK_FUNC(strncasecmp, tcl_ok=1, tcl_ok=0)
326 if test "$tcl_ok" = 0; then
327 AC_CHECK_LIB(socket, strncasecmp, tcl_ok=1, tcl_ok=0)
329 if test "$tcl_ok" = 0; then
330 AC_CHECK_LIB(inet, strncasecmp, tcl_ok=1, tcl_ok=0)
332 if test "$tcl_ok" = 0; then
333 AC_LIBOBJ(strncasecmp)
337 #--------------------------------------------------------------------
338 # The code below deals with several issues related to gettimeofday:
339 # 1. Some systems don't provide a gettimeofday function at all
340 # (set NO_GETTOD if this is the case).
341 # 2. SGI systems don't use the BSD form of the gettimeofday function,
342 # but they have a BSDgettimeofday function that can be used instead.
343 # 3. See if gettimeofday is declared in the <sys/time.h> header file.
344 # if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can
346 #--------------------------------------------------------------------
348 AC_CHECK_FUNC(BSDgettimeofday,
349 [AC_DEFINE(HAVE_BSDGETTIMEOFDAY)], [
350 AC_CHECK_FUNC(gettimeofday, , [AC_DEFINE(NO_GETTOD)])
352 AC_MSG_CHECKING([for gettimeofday declaration])
353 AC_CACHE_VAL(tcl_cv_grep_gettimeofday,
354 AC_EGREP_HEADER(gettimeofday, sys/time.h,
355 tcl_cv_grep_gettimeofday=present, tcl_cv_grep_gettimeofday=missing))
356 AC_MSG_RESULT($tcl_cv_grep_gettimeofday)
357 if test $tcl_cv_grep_gettimeofday = missing ; then
358 AC_DEFINE(GETTOD_NOT_DECLARED)
361 #--------------------------------------------------------------------
362 # The following code checks to see whether it is possible to get
363 # signed chars on this platform. This is needed in order to
364 # properly generate sign-extended ints from character values.
365 #--------------------------------------------------------------------
368 AC_MSG_CHECKING([signed char declarations])
369 AC_CACHE_VAL(tcl_cv_char_signed,
373 ], tcl_cv_char_signed=yes, tcl_cv_char_signed=no))
374 AC_MSG_RESULT($tcl_cv_char_signed)
375 if test $tcl_cv_char_signed = yes; then
376 AC_DEFINE(HAVE_SIGNED_CHAR)
379 #--------------------------------------------------------------------
380 # Does putenv() copy or not? We need to know to avoid memory leaks.
381 #--------------------------------------------------------------------
383 AC_MSG_CHECKING([for a putenv() that copies the buffer])
384 AC_CACHE_VAL(tcl_cv_putenv_copy,
387 #define OURVAR "havecopy=yes"
388 int main (int argc, char *argv[])
391 foo = (char *)strdup(OURVAR);
393 strcpy((char *)(strchr(foo, '=') + 1), "no");
394 bar = getenv("havecopy");
395 if (!strcmp(bar, "no")) {
404 tcl_cv_putenv_copy=no,
405 tcl_cv_putenv_copy=yes,
406 tcl_cv_putenv_copy=no)
408 AC_MSG_RESULT($tcl_cv_putenv_copy)
409 if test $tcl_cv_putenv_copy = yes; then
410 AC_DEFINE(HAVE_PUTENV_THAT_COPIES)
413 #--------------------------------------------------------------------
414 # Check for support of nl_langinfo function
415 #--------------------------------------------------------------------
419 #--------------------------------------------------------------------
420 # Look for libraries that we will need when compiling the Tcl shell
421 #--------------------------------------------------------------------
425 # Add the threads support libraries
427 LIBS="$LIBS$THREADS_LIBS"
431 #--------------------------------------------------------------------
432 # The statements below define a collection of compile flags. This
433 # macro depends on the value of SHARED_BUILD, and should be called
434 # after SC_ENABLE_SHARED checks the configure switches.
435 #--------------------------------------------------------------------
443 #--------------------------------------------------------------------
444 # The statements below check for systems where POSIX-style
445 # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
446 # On these systems (mostly older ones), use the old BSD-style
447 # FIONBIO approach instead.
448 #--------------------------------------------------------------------
452 #--------------------------------------------------------------------
453 # The statements below define a collection of symbols related to
454 # building libtcl as a shared library instead of a static library.
455 #--------------------------------------------------------------------
457 TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
458 TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
459 eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
463 # tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
464 # so that the backslashes quoting the DBX braces are dropped.
466 # Trick to replace DBGX with TCL_DBGX
468 eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
470 # Note: in the following variable, it's important to use the absolute
471 # path name of the Tcl directory rather than "..": this is because
472 # AIX remembers this path and will attempt to use it at run-time to look
473 # up the Tcl library.
475 if test "$FRAMEWORK_BUILD" = "1" ; then
476 TCL_BUILD_LIB_SPEC="-F`pwd` -framework Tcl"
477 TCL_LIB_SPEC="-framework Tcl"
479 elif test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
480 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
481 TCL_LIB_FLAG="-ltcl${TCL_VERSION}\${TCL_DBGX}"
483 TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
485 TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
486 TCL_LIB_SPEC="-L${libdir} ${TCL_LIB_FLAG}"
488 TCL_BUILD_EXP_FILE="lib.exp"
489 eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
491 # Replace DBGX with TCL_DBGX
492 eval "TCL_EXP_FILE=\"${TCL_EXP_FILE}\""
494 if test "$GCC" = "yes" ; then
495 TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
496 TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L`pwd`"
498 TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
499 TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}"
503 eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
504 eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
505 eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
506 VERSION=${TCL_VERSION}
508 #--------------------------------------------------------------------
509 # The statements below define the symbol TCL_PACKAGE_PATH, which
510 # gives a list of directories that may contain packages. The list
511 # consists of one directory for machine-dependent binaries and
512 # another for platform-independent scripts.
513 #--------------------------------------------------------------------
515 if test "$FRAMEWORK_BUILD" = "1" ; then
516 TCL_PACKAGE_PATH="${libdir}/Resources/Scripts"
517 elif test "$prefix" != "$exec_prefix"; then
518 TCL_PACKAGE_PATH="${libdir} ${prefix}/lib"
520 TCL_PACKAGE_PATH="${prefix}/lib"
523 #--------------------------------------------------------------------
524 # The statements below define various symbols relating to Tcl
526 #--------------------------------------------------------------------
528 # Replace ${VERSION} with contents of ${TCL_VERSION}
529 eval "TCL_STUB_LIB_FILE=libtclstub${TCL_UNSHARED_LIB_SUFFIX}"
530 # Replace DBGX with TCL_DBGX
531 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
533 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
534 TCL_STUB_LIB_FLAG="-ltclstub${TCL_VERSION}\${TCL_DBGX}"
536 TCL_STUB_LIB_FLAG="-ltclstub`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
539 TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}"
540 TCL_STUB_LIB_SPEC="-L${libdir} ${TCL_STUB_LIB_FLAG}"
541 TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}"
542 TCL_STUB_LIB_PATH="${libdir}/${TCL_STUB_LIB_FILE}"
544 # Install time header dir can be set via --includedir
545 eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
547 #------------------------------------------------------------------------
548 # tclConfig.sh refers to this by a different name
549 #------------------------------------------------------------------------
551 TCL_SHARED_BUILD=${SHARED_BUILD}
553 AC_SUBST(TCL_VERSION)
554 AC_SUBST(TCL_MAJOR_VERSION)
555 AC_SUBST(TCL_MINOR_VERSION)
556 AC_SUBST(TCL_PATCH_LEVEL)
558 AC_SUBST(TCL_LIB_FILE)
559 AC_SUBST(TCL_LIB_FLAG)
560 AC_SUBST(TCL_LIB_SPEC)
561 AC_SUBST(TCL_STUB_LIB_FILE)
562 AC_SUBST(TCL_STUB_LIB_FLAG)
563 AC_SUBST(TCL_STUB_LIB_SPEC)
564 AC_SUBST(TCL_STUB_LIB_PATH)
565 AC_SUBST(TCL_INCLUDE_SPEC)
566 AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
567 AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
569 AC_SUBST(TCL_SRC_DIR)
571 AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
572 AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
573 AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
575 AC_SUBST(TCL_SHARED_BUILD)
576 AC_SUBST(LD_LIBRARY_PATH_VAR)
578 AC_SUBST(TCL_BUILD_LIB_SPEC)
579 AC_SUBST(TCL_NEEDS_EXP_FILE)
580 AC_SUBST(TCL_BUILD_EXP_FILE)
581 AC_SUBST(TCL_EXP_FILE)
583 AC_SUBST(TCL_LIB_VERSIONS_OK)
584 AC_SUBST(TCL_SHARED_LIB_SUFFIX)
585 AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
587 AC_SUBST(TCL_HAS_LONGLONG)
589 AC_SUBST(BUILD_DLTEST)
590 AC_SUBST(TCL_PACKAGE_PATH)
592 AC_OUTPUT(Makefile dltest/Makefile tclConfig.sh)