root/tcl-8.0/tags/rat_4_2_24/unix/configure.in @ 1180

Revision 1180, 37.7 KB (checked in by anonymous, 14 years ago)

This commit was manufactured by cvs2svn to create tag 'rat_4_2_24'.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1dnl     This file is an input file used by the GNU "autoconf" program to
2dnl     generate the file "configure", which is run during Tcl installation
3dnl     to configure the system for the local environment.
4AC_INIT(../generic/tcl.h)
5# SCCS: @(#) configure.in 1.18 98/08/12 17:29:39
6
7TCL_VERSION=8.0
8TCL_MAJOR_VERSION=8
9TCL_MINOR_VERSION=0
10TCL_PATCH_LEVEL=".3"
11VERSION=${TCL_VERSION}
12
13if test "${prefix}" = "NONE"; then
14    prefix=/usr/local
15fi
16if test "${exec_prefix}" = "NONE"; then
17    exec_prefix=$prefix
18fi
19TCL_SRC_DIR=`cd $srcdir/..; pwd`
20
21AC_PROG_RANLIB
22#AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
23#    [tcl_ok=$enableval], [tcl_ok=no])
24#if test "$tcl_ok" = "yes"; then
25    AC_PROG_CC
26#else
27#    CC=${CC-cc}
28#AC_SUBST(CC)
29#fi
30
31# set the warning flags depending on whether or not we are using gcc
32if test "${GCC}" = "yes" ; then
33    CFLAGS_WARNING="-Wall -Wconversion"
34else
35    CFLAGS_WARNING=""
36fi
37
38#--------------------------------------------------------------------
39#       Supply substitutes for missing POSIX library procedures, or
40#       set flags so Tcl uses alternate procedures.
41#--------------------------------------------------------------------
42
43# Check if Posix compliant getcwd exists, if not we'll use getwd.
44AC_CHECK_FUNCS(getcwd, , AC_DEFINE(USEGETWD))
45# Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really
46# define USEGETWD even if the posix getcwd exists. Add a test ?
47
48AC_REPLACE_FUNCS(opendir strstr)
49
50AC_REPLACE_FUNCS(strtol tmpnam waitpid)
51AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR))
52AC_CHECK_FUNC(getwd, , AC_DEFINE(NO_GETWD))
53AC_CHECK_FUNC(wait3, , AC_DEFINE(NO_WAIT3))
54AC_CHECK_FUNC(uname, , AC_DEFINE(NO_UNAME))
55
56#--------------------------------------------------------------------
57#       On a few very rare systems, all of the libm.a stuff is
58#       already in libc.a.  Set compiler flags accordingly.
59#       Also, Linux requires the "ieee" library for math to work
60#       right (and it must appear before "-lm").
61#--------------------------------------------------------------------
62
63AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
64AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
65
66#--------------------------------------------------------------------
67#       On AIX systems, libbsd.a has to be linked in to support
68#       non-blocking file IO.  This library has to be linked in after
69#       the MATH_LIBS or it breaks the pow() function.  The way to
70#       insure proper sequencing, is to add it to the tail of MATH_LIBS.
71#        This library also supplies gettimeofday.
72#--------------------------------------------------------------------
73libbsd=no
74if test "`uname -s`" = "AIX" ; then
75    AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes)
76    if test $libbsd = yes; then
77        MATH_LIBS="$MATH_LIBS -lbsd"
78    fi
79fi
80
81#--------------------------------------------------------------------
82#       Supply substitutes for missing POSIX header files.  Special
83#       notes:
84#           - stdlib.h doesn't define strtol, strtoul, or
85#             strtod insome versions of SunOS
86#           - some versions of string.h don't declare procedures such
87#             as strstr
88#--------------------------------------------------------------------
89
90AC_MSG_CHECKING(dirent.h)
91AC_TRY_LINK([#include <sys/types.h>
92#include <dirent.h>], [
93#ifndef _POSIX_SOURCE
94#   ifdef __Lynx__
95        /*
96         * Generate compilation error to make the test fail:  Lynx headers
97         * are only valid if really in the POSIX environment.
98         */
99
100        missing_procedure();
101#   endif
102#endif
103DIR *d;
104struct dirent *entryPtr;
105char *p;
106d = opendir("foobar");
107entryPtr = readdir(d);
108p = entryPtr->d_name;
109closedir(d);
110], tcl_ok=yes, tcl_ok=no)
111if test $tcl_ok = no; then
112    AC_DEFINE(NO_DIRENT_H)
113fi
114AC_MSG_RESULT($tcl_ok)
115AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H))
116AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H))
117AC_CHECK_HEADER(values.h, , AC_DEFINE(NO_VALUES_H))
118AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H))
119AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
120AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
121AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
122AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
123if test $tcl_ok = 0; then
124    AC_DEFINE(NO_STDLIB_H)
125fi
126AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
127AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
128AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
129if test $tcl_ok = 0; then
130    AC_DEFINE(NO_STRING_H)
131fi
132AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
133AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H))
134AC_HAVE_HEADERS(unistd.h)
135
136#---------------------------------------------------------------------------
137#       Determine which interface to use to talk to the serial port.
138#       Note that #include lines must begin in leftmost column for
139#       some compilers to recognize them as preprocessor directives.
140#---------------------------------------------------------------------------
141
142AC_MSG_CHECKING([termios vs. termio vs. sgtty])
143AC_TRY_RUN([
144#include <termios.h>
145
146main()
147{
148    struct termios t;
149    if (tcgetattr(0, &t) == 0) {
150        cfsetospeed(&t, 0);
151        t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
152        return 0;
153    }
154    return 1;
155}], tk_ok=termios, tk_ok=no, tk_ok=no)
156if test $tk_ok = termios; then
157    AC_DEFINE(USE_TERMIOS)
158else
159AC_TRY_RUN([
160#include <termio.h>
161
162main()
163{
164    struct termio t;
165    if (ioctl(0, TCGETA, &t) == 0) {
166        t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
167        return 0;
168    }
169    return 1;
170}], tk_ok=termio, tk_ok=no, tk_ok=no)
171if test $tk_ok = termio; then
172    AC_DEFINE(USE_TERMIO)
173else
174AC_TRY_RUN([
175#include <sgtty.h>
176
177main()
178{
179    struct sgttyb t;
180    if (ioctl(0, TIOCGETP, &t) == 0) {
181        t.sg_ospeed = 0;
182        t.sg_flags |= ODDP | EVENP | RAW;
183        return 0;
184    }
185    return 1;
186}], tk_ok=sgtty, tk_ok=none, tk_ok=none)
187if test $tk_ok = sgtty; then
188    AC_DEFINE(USE_SGTTY)
189fi
190fi
191fi
192AC_MSG_RESULT($tk_ok)
193
194#--------------------------------------------------------------------
195#       Include sys/select.h if it exists and if it supplies things
196#       that appear to be useful and aren't already in sys/types.h.
197#       This appears to be true only on the RS/6000 under AIX.  Some
198#       systems like OSF/1 have a sys/select.h that's of no use, and
199#       other systems like SCO UNIX have a sys/select.h that's
200#       pernicious.  If "fd_set" isn't defined anywhere then set a
201#       special flag.
202#--------------------------------------------------------------------
203
204AC_MSG_CHECKING([fd_set and sys/select])
205AC_TRY_COMPILE([#include <sys/types.h>],
206        [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
207if test $tk_ok = no; then
208    AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
209    if test $tk_ok = yes; then
210        AC_DEFINE(HAVE_SYS_SELECT_H)
211    fi
212fi
213AC_MSG_RESULT($tk_ok)
214if test $tk_ok = no; then
215    AC_DEFINE(NO_FD_SET)
216fi
217
218#------------------------------------------------------------------------------
219#       Find out all about time handling differences.
220#------------------------------------------------------------------------------
221
222AC_CHECK_HEADERS(sys/time.h)
223AC_HEADER_TIME
224AC_STRUCT_TIMEZONE
225
226AC_MSG_CHECKING([tm_tzadj in struct tm])
227AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
228        [AC_DEFINE(HAVE_TM_TZADJ)
229         AC_MSG_RESULT(yes)],
230         AC_MSG_RESULT(no))
231
232AC_MSG_CHECKING([tm_gmtoff in struct tm])
233AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
234        [AC_DEFINE(HAVE_TM_GMTOFF)
235         AC_MSG_RESULT(yes)],
236         AC_MSG_RESULT(no))
237
238#
239# Its important to include time.h in this check, as some systems (like convex)
240# have timezone functions, etc.
241#
242have_timezone=no
243AC_MSG_CHECKING([long timezone variable])
244AC_TRY_COMPILE([#include <time.h>],
245        [extern long timezone;
246         timezone += 1;
247         exit (0);],
248        [have_timezone=yes
249         AC_DEFINE(HAVE_TIMEZONE_VAR)
250         AC_MSG_RESULT(yes)],
251         AC_MSG_RESULT(no))
252
253#
254# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
255#
256if test "$have_timezone" = no; then
257   AC_MSG_CHECKING([time_t timezone variable])
258   AC_TRY_COMPILE([#include <time.h>],
259        [extern time_t timezone;
260         timezone += 1;
261         exit (0);],
262        [AC_DEFINE(HAVE_TIMEZONE_VAR)
263         AC_MSG_RESULT(yes)],
264         AC_MSG_RESULT(no))
265fi
266
267#
268# AIX does not have a timezone field in struct tm. When the AIX bsd
269# library is used, the timezone global and the gettimeofday methods are
270# to be avoided for timezone deduction instead, we deduce the timezone
271# by comparing the localtime result on a known GMT value.
272#
273if test $libbsd = yes; then
274    AC_DEFINE(USE_DELTA_FOR_TZ)
275fi
276
277#--------------------------------------------------------------------
278#       Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
279#       in struct stat.
280#--------------------------------------------------------------------
281AC_STRUCT_ST_BLKSIZE
282
283#--------------------------------------------------------------------
284#       On some systems strstr is broken: it returns a pointer even
285#       even if the original string is empty.
286#--------------------------------------------------------------------
287
288AC_MSG_CHECKING([proper strstr implementation])
289AC_TRY_RUN([
290extern int strstr();
291int main()
292{
293    exit(strstr("\0test", "test") ? 1 : 0);
294}
295], tcl_ok=yes, tcl_ok=no, tcl_ok=no)
296if test $tcl_ok = yes; then
297    AC_MSG_RESULT(yes)
298else
299    AC_MSG_RESULT([broken, using substitute])
300    LIBOBJS="$LIBOBJS strstr.o"
301fi
302
303#--------------------------------------------------------------------
304#       Check for strtoul function.  This is tricky because under some
305#       versions of AIX strtoul returns an incorrect terminator
306#       pointer for the string "0".
307#--------------------------------------------------------------------
308
309AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0)
310AC_TRY_RUN([
311extern int strtoul();
312int main()
313{
314    char *string = "0";
315    char *term;
316    int value;
317    value = strtoul(string, &term, 0);
318    if ((value != 0) || (term != (string+1))) {
319        exit(1);
320    }
321    exit(0);
322}], , tcl_ok=0, tcl_ok=0)
323if test "$tcl_ok" = 0; then
324    test -n "$verbose" && echo "        Adding strtoul.o."
325    LIBOBJS="$LIBOBJS strtoul.o"
326fi
327
328#--------------------------------------------------------------------
329#       Check for the strtod function.  This is tricky because in some
330#       versions of Linux strtod mis-parses strings starting with "+".
331#--------------------------------------------------------------------
332
333AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0)
334AC_TRY_RUN([
335extern double strtod();
336int main()
337{
338    char *string = " +69";
339    char *term;
340    double value;
341    value = strtod(string, &term);
342    if ((value != 69) || (term != (string+4))) {
343        exit(1);
344    }
345    exit(0);
346}], , tcl_ok=0, tcl_ok=0)
347if test "$tcl_ok" = 0; then
348    test -n "$verbose" && echo "        Adding strtod.o."
349    LIBOBJS="$LIBOBJS strtod.o"
350fi
351
352#--------------------------------------------------------------------
353#       Under Solaris 2.4, strtod returns the wrong value for the
354#       terminating character under some conditions.  Check for this
355#       and if the problem exists use a substitute procedure
356#       "fixstrtod" that corrects the error.
357#--------------------------------------------------------------------
358
359AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
360if test "$tcl_strtod" = 1; then
361    AC_MSG_CHECKING([for Solaris strtod bug])
362    AC_TRY_RUN([
363extern double strtod();
364int main()
365{
366    char *string = "NaN";
367    char *term;
368    strtod(string, &term);
369    if ((term != string) && (term[-1] == 0)) {
370        exit(1);
371    }
372    exit(0);
373}], tcl_ok=1, tcl_ok=0, tcl_ok=0)
374    if test $tcl_ok = 1; then
375        AC_MSG_RESULT(ok)
376    else
377        AC_MSG_RESULT(buggy)
378        LIBOBJS="$LIBOBJS fixstrtod.o"
379        AC_DEFINE(strtod, fixstrtod)
380    fi
381fi
382
383#--------------------------------------------------------------------
384#       Check for various typedefs and provide substitutes if
385#       they don't exist.
386#--------------------------------------------------------------------
387
388AC_TYPE_MODE_T
389AC_TYPE_PID_T
390AC_TYPE_SIZE_T
391AC_TYPE_UID_T
392
393#--------------------------------------------------------------------
394#       If a system doesn't have an opendir function (man, that's old!)
395#       then we have to supply a different version of dirent.h which
396#       is compatible with the substitute version of opendir that's
397#       provided.  This version only works with V7-style directories.
398#--------------------------------------------------------------------
399
400AC_CHECK_FUNC(opendir, , AC_DEFINE(USE_DIRENT2_H))
401
402#--------------------------------------------------------------------
403#       The check below checks whether <sys/wait.h> defines the type
404#       "union wait" correctly.  It's needed because of weirdness in
405#       HP-UX where "union wait" is defined in both the BSD and SYS-V
406#       environments.  Checking the usability of WIFEXITED seems to do
407#       the trick.
408#--------------------------------------------------------------------
409
410AC_MSG_CHECKING([union wait])
411AC_TRY_LINK([#include <sys/types.h>
412#include <sys/wait.h>], [
413union wait x;
414WIFEXITED(x);           /* Generates compiler error if WIFEXITED
415                         * uses an int. */
416], tcl_ok=yes, tcl_ok=no)
417AC_MSG_RESULT($tcl_ok)
418if test $tcl_ok = no; then
419    AC_DEFINE(NO_UNION_WAIT)
420fi
421
422#--------------------------------------------------------------------
423#       Check to see whether the system supports the matherr function
424#       and its associated type "struct exception".
425#--------------------------------------------------------------------
426
427AC_MSG_CHECKING([matherr support])
428AC_TRY_COMPILE([#include <math.h>], [
429struct exception x;
430x.type = DOMAIN;
431x.type = SING;
432], tcl_ok=yes, tcl_ok=no)
433AC_MSG_RESULT($tcl_ok)
434if test $tcl_ok = yes; then
435    AC_DEFINE(NEED_MATHERR)
436fi
437
438#--------------------------------------------------------------------
439#       Check to see whether the system provides a vfork kernel call.
440#       If not, then use fork instead.  Also, check for a problem with
441#       vforks and signals that can cause core dumps if a vforked child
442#       resets a signal handler.  If the problem exists, then use fork
443#       instead of vfork.
444#--------------------------------------------------------------------
445
446AC_TYPE_SIGNAL()
447AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0)
448if test "$tcl_ok" = 1; then
449    AC_MSG_CHECKING([vfork/signal bug]);
450    AC_TRY_RUN([
451#include <stdio.h>
452#include <signal.h>
453#include <sys/wait.h>
454int gotSignal = 0;
455sigProc(sig)
456    int sig;
457{
458    gotSignal = 1;
459}
460main()
461{
462    int pid, sts;
463    (void) signal(SIGCHLD, sigProc);
464    pid = vfork();
465    if (pid <  0) {
466        exit(1);
467    } else if (pid == 0) {
468        (void) signal(SIGCHLD, SIG_DFL);
469        _exit(0);
470    } else {
471        (void) wait(&sts);
472    }
473    exit((gotSignal) ? 0 : 1);
474}], tcl_ok=1, tcl_ok=0, tcl_ok=0)
475    if test "$tcl_ok" = 1; then
476        AC_MSG_RESULT(ok)
477    else
478        AC_MSG_RESULT([buggy, using fork instead])
479    fi
480fi
481rm -f core
482if test "$tcl_ok" = 0; then
483    AC_DEFINE(vfork, fork)
484fi
485
486#--------------------------------------------------------------------
487#       Check whether there is an strncasecmp function on this system.
488#       This is a bit tricky because under SCO it's in -lsocket and
489#       under Sequent Dynix it's in -linet.
490#--------------------------------------------------------------------
491
492AC_CHECK_FUNC(strncasecmp, tcl_ok=1, tcl_ok=0)
493if test "$tcl_ok" = 0; then
494    AC_CHECK_LIB(socket, strncasecmp, tcl_ok=1, tcl_ok=0)
495fi
496if test "$tcl_ok" = 0; then
497    AC_CHECK_LIB(inet, strncasecmp, tcl_ok=1, tcl_ok=0)
498fi
499if test "$tcl_ok" = 0; then
500    LIBOBJS="$LIBOBJS strncasecmp.o"
501fi
502
503#--------------------------------------------------------------------
504#       The code below deals with several issues related to gettimeofday:
505#       1. Some systems don't provide a gettimeofday function at all
506#          (set NO_GETTOD if this is the case).
507#       2. SGI systems don't use the BSD form of the gettimeofday function,
508#          but they have a BSDgettimeofday function that can be used instead.
509#       3. See if gettimeofday is declared in the <sys/time.h> header file.
510#          if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can
511#          declare it.
512#--------------------------------------------------------------------
513
514AC_CHECK_FUNC(BSDgettimeofday, AC_DEFINE(HAVE_BSDGETTIMEOFDAY),
515        AC_CHECK_FUNC(gettimeofday, , AC_DEFINE(NO_GETTOD)))
516AC_MSG_CHECKING([for gettimeofday declaration])
517AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [
518    AC_MSG_RESULT(missing)
519    AC_DEFINE(GETTOD_NOT_DECLARED)
520])
521
522#--------------------------------------------------------------------
523#       Interactive UNIX requires -linet instead of -lsocket, plus it
524#       needs net/errno.h to define the socket-related error codes.
525#--------------------------------------------------------------------
526
527AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
528AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H))
529
530#--------------------------------------------------------------------
531#       The following code checks to see whether it is possible to get
532#       signed chars on this platform.  This is needed in order to
533#       properly generate sign-extended ints from character values.
534#--------------------------------------------------------------------
535
536AC_C_CHAR_UNSIGNED
537AC_MSG_CHECKING([signed char declarations])
538AC_TRY_COMPILE(, [
539signed char *p;
540p = 0;
541], tcl_ok=yes, tcl_ok=no)
542AC_MSG_RESULT($tcl_ok)
543if test $tcl_ok = yes; then
544    AC_DEFINE(HAVE_SIGNED_CHAR)
545fi
546
547#--------------------------------------------------------------------
548#       Check for the existence of the -lsocket and -lnsl libraries.
549#       The order here is important, so that they end up in the right
550#       order in the command line generated by make.  Here are some
551#       special considerations:
552#       1. Use "connect" and "accept" to check for -lsocket, and
553#          "gethostbyname" to check for -lnsl.
554#       2. Use each function name only once:  can't redo a check because
555#          autoconf caches the results of the last check and won't redo it.
556#       3. Use -lnsl and -lsocket only if they supply procedures that
557#          aren't already present in the normal libraries.  This is because
558#          IRIX 5.2 has libraries, but they aren't needed and they're
559#          bogus:  they goof up name resolution if used.
560#       4. On some SVR4 systems, can't use -lsocket without -lnsl too.
561#          To get around this problem, check for both libraries together
562#          if -lsocket doesn't work by itself.
563#--------------------------------------------------------------------
564
565tcl_checkBoth=0
566AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
567if test "$tcl_checkSocket" = 1; then
568    AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tcl_checkBoth=1)
569fi
570if test "$tcl_checkBoth" = 1; then
571    tk_oldLibs=$LIBS
572    LIBS="$LIBS -lsocket -lnsl"
573    AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
574fi
575AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
576
577#--------------------------------------------------------------------
578#       The statements below define a collection of symbols related to
579#       dynamic loading and shared libraries:
580#
581#       DL_OBJS -       Name of the object file that implements dynamic
582#                       loading for Tcl on this system.
583#       DL_LIBS -       Library file(s) to include in tclsh and other base
584#                       applications in order for the "load" command to work.
585#       LD_FLAGS -      Flags to pass to the compiler when linking object
586#                       files into an executable application binary such
587#                       as tclsh.
588#       LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
589#                       that tell the run-time dynamic linker where to look
590#                       for shared libraries such as libtcl.so.  Depends on
591#                       the variable LIB_RUNTIME_DIR in the Makefile.
592#       MAKE_LIB -      Command to execute to build the Tcl library;
593#                       differs depending on whether or not Tcl is being
594#                       compiled as a shared library.
595#       SHLIB_CFLAGS -  Flags to pass to cc when compiling the components
596#                       of a shared library (may request position-independent
597#                       code, among other things).
598#       SHLIB_LD -      Base command to use for combining object files
599#                       into a shared library.
600#       SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
601#                       creating shared libraries.  This symbol typically
602#                       goes at the end of the "ld" commands that build
603#                       shared libraries. The value of the symbol is
604#                       "${LIBS}" if all of the dependent libraries should
605#                       be specified when creating a shared library.  If
606#                       dependent libraries should not be specified (as on
607#                       SunOS 4.x, where they cause the link to fail, or in
608#                       general if Tcl and Tk aren't themselves shared
609#                       libraries), then this symbol has an empty string
610#                       as its value.
611#       SHLIB_SUFFIX -  Suffix to use for the names of dynamically loadable
612#                       extensions.  An empty string means we don't know how
613#                       to use shared libraries on this platform.
614#       TCL_LIB_FILE -  Name of the file that contains the Tcl library, such
615#                       as libtcl7.8.so or libtcl7.8.a.
616#       TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
617#                       in the shared library name, using the $VERSION variable
618#                       to put the version in the right place.  This is used
619#                       by platforms that need non-standard library names.
620#                       Examples:  ${VERSION}.so.1.1 on NetBSD, since it needs
621#                       to have a version after the .so, and ${VERSION}.a
622#                       on AIX, since the Tcl shared library needs to have
623#                       a .a extension whereas shared objects for loadable
624#                       extensions have a .so extension.  Defaults to
625#                       ${VERSION}${SHLIB_SUFFIX}.
626#--------------------------------------------------------------------
627
628# Step 1: set the variable "system" to hold the name and version number
629# for the system.  This can usually be done via the "uname" command, but
630# there are a few systems, like Next, where this doesn't work.
631
632AC_MSG_CHECKING([system version (for dynamic loading)])
633if test -f /usr/lib/NextStep/software_version; then
634    system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
635else
636    system=`uname -s`-`uname -r`
637    if test "$?" -ne 0 ; then
638        AC_MSG_RESULT([unknown (can't find uname command)])
639        system=unknown
640    else
641        # Special check for weird MP-RAS system (uname returns weird
642        # results, and the version is kept in special file).
643   
644        if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
645            system=MP-RAS-`awk '{print $3}' /etc/.relid'`
646        fi
647        if test "`uname -s`" = "AIX" ; then
648            system=AIX-`uname -v`.`uname -r`
649        fi
650        AC_MSG_RESULT($system)
651    fi
652fi
653
654# Step 2: check for existence of -ldl library.  This is needed because
655# Linux can use either -ldl or -ldld for dynamic loading.
656
657AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
658
659# Step 3: set configuration options based on system name and version.
660
661fullSrcDir=`cd $srcdir; pwd`
662TCL_SHARED_LIB_SUFFIX=""
663TCL_UNSHARED_LIB_SUFFIX=""
664TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
665ECHO_VERSION='`echo ${VERSION}`'
666TCL_LIB_VERSIONS_OK=ok
667CFLAGS_DEBUG=-g
668CFLAGS_OPTIMIZE=-O
669case $system in
670    AIX-4.[[2-9]])
671        SHLIB_CFLAGS=""
672        SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
673        SHLIB_LD_LIBS='${LIBS}'
674        SHLIB_SUFFIX=".so"
675        DL_OBJS="tclLoadDl.o"
676        DL_LIBS="-ldl"
677        LD_FLAGS=""
678        LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
679        AIX=yes
680        TCL_SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
681        ;;
682    AIX-*)
683        SHLIB_CFLAGS=""
684        SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
685        SHLIB_LD_LIBS='${LIBS}'
686        SHLIB_SUFFIX=".so"
687        DL_OBJS="tclLoadDl.o tclLoadAix.o"
688        DL_LIBS="-lld"
689        LD_FLAGS=""
690        LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
691        TCL_SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
692        ;;
693    BSD/OS-2.1*|BSD/OS-3*)
694        SHLIB_CFLAGS=""
695        SHLIB_LD="shlicc -r"
696        SHLIB_LD_LIBS='${LIBS}'
697        SHLIB_SUFFIX=".so"
698        DL_OBJS="tclLoadDl.o"
699        DL_LIBS="-ldl"
700        LD_FLAGS=""
701        LD_SEARCH_FLAGS=""
702        ;;
703    dgux*)
704        SHLIB_CFLAGS="-K PIC"
705        SHLIB_LD="cc -G"
706        SHLIB_LD_LIBS=""
707        SHLIB_SUFFIX=".so"
708        DL_OBJS="tclLoadDl.o"
709        DL_LIBS="-ldl"
710        LD_FLAGS=""
711        LD_SEARCH_FLAGS=""
712        ;;
713    HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
714        AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
715        if test "$tcl_ok" = yes; then
716            SHLIB_CFLAGS="+z"
717            SHLIB_LD="ld -b"
718            SHLIB_LD_LIBS=""
719            SHLIB_SUFFIX=".sl"
720            DL_OBJS="tclLoadShl.o"
721            DL_LIBS="-ldld"
722            LD_FLAGS="-Wl,-E"
723            LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
724        fi
725        ;;
726    IRIX-4.*)
727        SHLIB_CFLAGS="-G 0"
728        SHLIB_SUFFIX=".a"
729        SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
730        SHLIB_LD_LIBS='${LIBS}'
731        DL_OBJS="tclLoadAout.o"
732        DL_LIBS=""
733        LD_FLAGS="-Wl,-D,08000000"
734        LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
735        TCL_SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
736        ;;
737    IRIX-5.*|IRIX-6.*)
738        SHLIB_CFLAGS=""
739        SHLIB_LD="ld -shared -rdata_shared"
740        SHLIB_LD_LIBS=""
741        SHLIB_SUFFIX=".so"
742        DL_OBJS="tclLoadDl.o"
743        DL_LIBS=""
744        LD_FLAGS=""
745        LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
746        ;;
747    IRIX64-6.*)
748        SHLIB_CFLAGS=""
749        SHLIB_LD="ld -32 -shared -rdata_shared -rpath /usr/local/lib"
750        SHLIB_LD_LIBS=""
751        SHLIB_SUFFIX=".so"
752        DL_OBJS="tclLoadDl.o"
753        DL_LIBS=""
754        LD_FLAGS=""
755        LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
756        ;;
757    Linux*)
758        SHLIB_CFLAGS="-fPIC"
759        SHLIB_LD_LIBS=""
760        SHLIB_SUFFIX=".so"
761        if test "$have_dl" = yes; then
762            SHLIB_LD="${CC} -shared"
763            DL_OBJS="tclLoadDl.o"
764            DL_LIBS="-ldl"
765            LD_FLAGS="-rdynamic"
766            LD_SEARCH_FLAGS=""
767        else
768            AC_CHECK_HEADER(dld.h, [
769                SHLIB_LD="ld -shared"
770                DL_OBJS="tclLoadDld.o"
771                DL_LIBS="-ldld"
772                LD_FLAGS=""
773                LD_SEARCH_FLAGS=""])
774        fi
775        ;;
776    MP-RAS-02*)
777        SHLIB_CFLAGS="-K PIC"
778        SHLIB_LD="cc -G"
779        SHLIB_LD_LIBS=""
780        SHLIB_SUFFIX=".so"
781        DL_OBJS="tclLoadDl.o"
782        DL_LIBS="-ldl"
783        LD_FLAGS=""
784        LD_SEARCH_FLAGS=""
785        ;;
786    MP-RAS-*)
787        SHLIB_CFLAGS="-K PIC"
788        SHLIB_LD="cc -G"
789        SHLIB_LD_LIBS=""
790        SHLIB_SUFFIX=".so"
791        DL_OBJS="tclLoadDl.o"
792        DL_LIBS="-ldl"
793        LD_FLAGS="-Wl,-Bexport"
794        LD_SEARCH_FLAGS=""
795        ;;
796    NetBSD-*|FreeBSD-*|OpenBSD-*)
797        # Not available on all versions:  check for include file.
798        AC_CHECK_HEADER(dlfcn.h, [
799            SHLIB_CFLAGS="-fpic"
800            SHLIB_LD="ld -Bshareable -x"
801            SHLIB_LD_LIBS=""
802            SHLIB_SUFFIX=".so"
803            DL_OBJS="tclLoadDl.o"
804            DL_LIBS=""
805            LD_FLAGS=""
806            LD_SEARCH_FLAGS=""
807            TCL_SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
808        ], [
809            SHLIB_CFLAGS=""
810            SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
811            SHLIB_LD_LIBS='${LIBS}'
812            SHLIB_SUFFIX=".a"
813            DL_OBJS="tclLoadAout.o"
814            DL_LIBS=""
815            LD_FLAGS=""
816            LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
817            TCL_SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
818        ])
819
820        # FreeBSD doesn't handle version numbers with dots.
821
822        TCL_UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
823        TCL_LIB_VERSIONS_OK=nodots
824        ;;
825    NEXTSTEP-*)
826        SHLIB_CFLAGS=""
827        SHLIB_LD="cc -nostdlib -r"
828        SHLIB_LD_LIBS=""
829        SHLIB_SUFFIX=".so"
830        DL_OBJS="tclLoadNext.o"
831        DL_LIBS=""
832        LD_FLAGS=""
833        LD_SEARCH_FLAGS=""
834        ;;
835    OSF1-1.0|OSF1-1.1|OSF1-1.2)
836        # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
837        SHLIB_CFLAGS=""
838        # Hack: make package name same as library name
839        SHLIB_LD='ld -R -export $@:'
840        SHLIB_LD_LIBS=""
841        SHLIB_SUFFIX=".so"
842        DL_OBJS="tclLoadOSF.o"
843        DL_LIBS=""
844        LD_FLAGS=""
845        LD_SEARCH_FLAGS=""
846        ;;
847    OSF1-1.*)
848        # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
849        SHLIB_CFLAGS="-fpic"
850        SHLIB_LD="ld -shared"
851        SHLIB_LD_LIBS=""
852        SHLIB_SUFFIX=".so"
853        DL_OBJS="tclLoadDl.o"
854        DL_LIBS=""
855        LD_FLAGS=""
856        LD_SEARCH_FLAGS=""
857        ;;
858    OSF1-V*)
859        # Digital OSF/1
860        SHLIB_CFLAGS=""
861        SHLIB_LD='ld -shared -expect_unresolved "*"'
862        SHLIB_LD_LIBS=""
863        SHLIB_SUFFIX=".so"
864        DL_OBJS="tclLoadDl.o"
865        DL_LIBS=""
866        LD_FLAGS=""
867        LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
868        ;;
869    RISCos-*)
870        SHLIB_CFLAGS="-G 0"
871        SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
872        SHLIB_LD_LIBS='${LIBS}'
873        SHLIB_SUFFIX=".a"
874        DL_OBJS="tclLoadAout.o"
875        DL_LIBS=""
876        LD_FLAGS="-Wl,-D,08000000"
877        LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
878        ;;
879    SCO_SV-3.2*)
880        # Note, dlopen is available only on SCO 3.2.5 and greater.  However,
881        # this test works, since "uname -s" was non-standard in 3.2.4 and
882        # below.
883        SHLIB_CFLAGS="-Kpic -belf"
884        SHLIB_LD="ld -G"
885        SHLIB_LD_LIBS=""
886        SHLIB_SUFFIX=".so"
887        DL_OBJS="tclLoadDl.o"
888        DL_LIBS=""
889        LD_FLAGS="-belf -Wl,-Bexport"
890        LD_SEARCH_FLAGS=""
891        ;;
892     SINIX*5.4*)
893        SHLIB_CFLAGS="-K PIC"
894        SHLIB_LD="cc -G"
895        SHLIB_LD_LIBS=""
896        SHLIB_SUFFIX=".so"
897        DL_OBJS="tclLoadDl.o"
898        DL_LIBS="-ldl"
899        LD_FLAGS=""
900        LD_SEARCH_FLAGS=""
901        ;;
902    SunOS-4*)
903        SHLIB_CFLAGS="-PIC"
904        SHLIB_LD="ld"
905        SHLIB_LD_LIBS=""
906        SHLIB_SUFFIX=".so"
907        DL_OBJS="tclLoadDl.o"
908        DL_LIBS="-ldl"
909        LD_FLAGS=""
910        LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
911
912        # SunOS can't handle version numbers with dots in them in library
913        # specs, like -ltcl7.5, so use -ltcl75 instead.  Also, it
914        # requires an extra version number at the end of .so file names.
915        # So, the library has to have a name like libtcl75.so.1.0
916
917        TCL_SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
918        TCL_UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
919        TCL_LIB_VERSIONS_OK=nodots
920        ;;
921    SunOS-5*)
922        SHLIB_CFLAGS="-KPIC"
923        SHLIB_LD="/usr/ccs/bin/ld -G -z text"
924
925        # Note: need the LIBS below, otherwise Tk won't find Tcl's
926        # symbols when dynamically loaded into tclsh.
927
928        SHLIB_LD_LIBS='${LIBS}'
929        SHLIB_SUFFIX=".so"
930        DL_OBJS="tclLoadDl.o"
931        DL_LIBS="-ldl"
932        LD_FLAGS=""
933        LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
934        ;;
935    ULTRIX-4.*)
936        SHLIB_CFLAGS="-G 0"
937        SHLIB_SUFFIX=".a"
938        SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
939        SHLIB_LD_LIBS='${LIBS}'
940        DL_OBJS="tclLoadAout.o"
941        DL_LIBS=""
942        LD_FLAGS="-Wl,-D,08000000"
943        LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
944        ;;
945    UNIX_SV* | UnixWare-5*)
946        SHLIB_CFLAGS="-KPIC"
947        SHLIB_LD="cc -G"
948        SHLIB_LD_LIBS=""
949        SHLIB_SUFFIX=".so"
950        DL_OBJS="tclLoadDl.o"
951        DL_LIBS="-ldl"
952        # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
953        # that don't grok the -Bexport option.  Test that it does.
954        hold_ldflags=$LDFLAGS
955        AC_MSG_CHECKING(for ld accepts -Bexport flag)
956        LDFLAGS="${LDFLAGS} -Wl,-Bexport"
957        AC_TRY_LINK(, [int i;], found=yes, found=no)
958        LDFLAGS=$hold_ldflags
959        AC_MSG_RESULT($found)
960        if test $found = yes; then
961          LD_FLAGS="-Wl,-Bexport"
962        else
963          LD_FLAGS=""
964        fi
965        LD_SEARCH_FLAGS=""
966        ;;
967esac
968
969# Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
970# Loading for Tcl -- What Became of It?".  Proc. 2nd Tcl/Tk Workshop,
971# New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
972# to determine which of several header files defines the a.out file
973# format (a.out.h, sys/exec.h, or sys/exec_aout.h).  At present, we
974# support only a file format that is more or less version-7-compatible.
975# In particular,
976#       - a.out files must begin with `struct exec'.
977#       - the N_TXTOFF on the `struct exec' must compute the seek address
978#         of the text segment
979#       - The `struct exec' must contain a_magic, a_text, a_data, a_bss
980#         and a_entry fields.
981# The following compilation should succeed if and only if either sys/exec.h
982# or a.out.h is usable for the purpose.
983#
984# Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
985# `struct exec' includes a second header that contains information that
986# duplicates the v7 fields that are needed.
987
988if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
989    AC_MSG_CHECKING(sys/exec.h)
990    AC_TRY_COMPILE([#include <sys/exec.h>],[
991        struct exec foo;
992        unsigned long seek;
993        int flag;
994#if defined(__mips) || defined(mips)
995        seek = N_TXTOFF (foo.ex_f, foo.ex_o);
996#else
997        seek = N_TXTOFF (foo);
998#endif
999        flag = (foo.a_magic == OMAGIC);
1000        return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1001], tcl_ok=usable, tcl_ok=unusable)
1002    AC_MSG_RESULT($tcl_ok)
1003    if test $tcl_ok = usable; then
1004        AC_DEFINE(USE_SYS_EXEC_H)
1005    else
1006        AC_MSG_CHECKING(a.out.h)
1007        AC_TRY_COMPILE([#include <a.out.h>],[
1008            struct exec foo;
1009            unsigned long seek;
1010            int flag;
1011#if defined(__mips) || defined(mips)
1012            seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1013#else
1014            seek = N_TXTOFF (foo);
1015#endif
1016            flag = (foo.a_magic == OMAGIC);
1017            return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1018        ], tcl_ok=usable, tcl_ok=unusable)
1019        AC_MSG_RESULT($tcl_ok)
1020        if test $tcl_ok = usable; then
1021            AC_DEFINE(USE_A_OUT_H)
1022        else
1023            AC_MSG_CHECKING(sys/exec_aout.h)
1024            AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
1025                struct exec foo;
1026                unsigned long seek;
1027                int flag;
1028#if defined(__mips) || defined(mips)
1029                seek = N_TXTOFF (foo.ex_f, foo.ex_o);
1030#else
1031                seek = N_TXTOFF (foo);
1032#endif
1033                flag = (foo.a_midmag == OMAGIC);
1034                return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
1035            ], tcl_ok=usable, tcl_ok=unusable)
1036            AC_MSG_RESULT($tcl_ok)
1037            if test $tcl_ok = usable; then
1038                AC_DEFINE(USE_SYS_EXEC_AOUT_H)
1039            else
1040                DL_OBJS=""
1041            fi
1042        fi
1043    fi
1044fi
1045
1046# Step 5: disable dynamic loading if requested via a command-line switch.
1047
1048#AC_ARG_ENABLE(load, [  --disable-load          disallow dynamic loading and "load" command],
1049#    [tcl_ok=$enableval], [tcl_ok=yes])
1050#if test "$tcl_ok" = "no"; then
1051#    DL_OBJS=""
1052#fi
1053#
1054#if test "x$DL_OBJS" != "x" ; then
1055#    BUILD_DLTEST="\$(DLTEST_TARGETS)"
1056#else
1057    echo "Dynamic loading and shared libraries are disabled."
1058    SHLIB_CFLAGS=""
1059    SHLIB_LD=""
1060    SHLIB_SUFFIX=""
1061    DL_OBJS="tclLoadNone.o"
1062    DL_LIBS=""
1063    LD_FLAGS=""
1064    LD_SEARCH_FLAGS=""
1065    BUILD_DLTEST=""
1066#fi
1067
1068# If we're running gcc, then change the C flags for compiling shared
1069# libraries to the right flags for gcc, instead of those for the
1070# standard manufacturer compiler.
1071
1072if test "$DL_OBJS" != "tclLoadNone.o" ; then
1073    if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
1074        case $system in
1075            AIX-*)
1076                ;;
1077            BSD/OS*)
1078                ;;
1079            IRIX*)
1080                ;;
1081            NetBSD-*|FreeBSD-*|OpenBSD-*)
1082                ;;
1083            RISCos-*)
1084                ;;
1085            ULTRIX-4.*)
1086                ;;
1087            *)
1088                SHLIB_CFLAGS="-fPIC"
1089                ;;
1090        esac
1091    fi
1092fi
1093
1094# Set the default compiler switches based on the --enable-symbols option
1095
1096AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols],
1097    [tcl_ok=$enableval], [tcl_ok=no])
1098if test "$tcl_ok" = "yes"; then
1099    CFLAGS_DEFAULT=CFLAGS_DEBUG
1100    TCL_DBGX=g
1101else
1102    CFLAGS_DEFAULT=CFLAGS_OPTIMIZE
1103    TCL_DBGX=""
1104fi
1105
1106#--------------------------------------------------------------------
1107#       The statements below check for systems where POSIX-style
1108#       non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
1109#       On these systems (mostly older ones), use the old BSD-style
1110#       FIONBIO approach instead.
1111#--------------------------------------------------------------------
1112
1113AC_CHECK_HEADERS(sys/ioctl.h)
1114AC_CHECK_HEADERS(sys/filio.h)
1115AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
1116if test -f /usr/lib/NextStep/software_version; then
1117    system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
1118else
1119    system=`uname -s`-`uname -r`
1120    if test "$?" -ne 0 ; then
1121        system=unknown
1122    else
1123        # Special check for weird MP-RAS system (uname returns weird
1124        # results, and the version is kept in special file).
1125   
1126        if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
1127            system=MP-RAS-`awk '{print $3}' /etc/.relid'`
1128        fi
1129        if test "`uname -s`" = "AIX" ; then
1130            system=AIX-`uname -v`.`uname -r`
1131        fi
1132    fi
1133fi
1134case $system in
1135    # There used to be code here to use FIONBIO under AIX.  However, it
1136    # was reported that FIONBIO doesn't work under AIX 3.2.5.  Since
1137    # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
1138    # code (JO, 5/31/97).
1139
1140    OSF*)
1141        AC_DEFINE(USE_FIONBIO)
1142        AC_MSG_RESULT(FIONBIO)
1143        ;;
1144    SunOS-4*)
1145        AC_DEFINE(USE_FIONBIO)
1146        AC_MSG_RESULT(FIONBIO)
1147        ;;
1148    ULTRIX-4.*)
1149        AC_DEFINE(USE_FIONBIO)
1150        AC_MSG_RESULT(FIONBIO)
1151        ;;
1152    *)
1153        AC_MSG_RESULT(O_NONBLOCK)
1154        ;;
1155esac
1156
1157#--------------------------------------------------------------------
1158#       The statements below define a collection of symbols related to
1159#       building libtcl as a shared library instead of a static library.
1160#--------------------------------------------------------------------
1161
1162realRanlib=$RANLIB
1163if test "$TCL_SHARED_LIB_SUFFIX" = "" ; then
1164    TCL_SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
1165fi
1166if test "$TCL_UNSHARED_LIB_SUFFIX" = "" ; then
1167    TCL_UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
1168fi
1169#AC_ARG_ENABLE(shared,
1170#    [  --enable-shared         build libtcl as a shared library],
1171#    [tcl_ok=$enableval], [tcl_ok=no])
1172#if test "$tcl_ok" = "yes" -a "${SHLIB_SUFFIX}" != "" ; then
1173#    TCL_SHARED_BUILD=1
1174#    TCL_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
1175#    TCL_LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS}"
1176#    eval "TCL_LIB_FILE=libtcl${TCL_SHARED_LIB_SUFFIX}"
1177#    if test "x$DL_OBJS" = "xtclLoadAout.o"; then
1178#       MAKE_LIB="ar cr \${TCL_LIB_FILE} \${OBJS}"
1179#    else
1180#       MAKE_LIB="\${SHLIB_LD} -o \${TCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
1181#       RANLIB=":"
1182#    fi
1183#else
1184    TCL_SHARED_BUILD=0
1185    case $system in
1186        BSD/OS*)
1187            ;;
1188
1189        AIX-*)
1190            ;;
1191
1192        *)
1193            SHLIB_LD_LIBS=""
1194            ;;
1195    esac
1196    TCL_SHLIB_CFLAGS=""
1197    TCL_LD_SEARCH_FLAGS=""
1198    eval "TCL_LIB_FILE=libtcl${TCL_UNSHARED_LIB_SUFFIX}"
1199    MAKE_LIB="ar cr \${TCL_LIB_FILE} \${OBJS}"
1200#fi
1201
1202# Note:  in the following variable, it's important to use the absolute
1203# path name of the Tcl directory rather than "..":  this is because
1204# AIX remembers this path and will attempt to use it at run-time to look
1205# up the Tcl library.
1206
1207if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
1208    TCL_LIB_FLAG="-ltcl${TCL_VERSION}\${TCL_DBGX}"
1209else
1210    TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
1211fi
1212#TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
1213TCL_BUILD_LIB_SPEC="`pwd`/libtcl8.0.a"
1214TCL_LIB_SPEC="-L${exec_prefix}/lib ${TCL_LIB_FLAG}"
1215
1216# tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
1217# so that the backslashes quoting the DBX braces are dropped.
1218
1219# Trick to replace DBGX with TCL_DBGX
1220DBGX='${TCL_DBGX}'
1221eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
1222
1223VERSION='${VERSION}'
1224eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
1225eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
1226
1227#--------------------------------------------------------------------
1228#       The statements below define the symbol TCL_PACKAGE_PATH, which
1229#       gives a list of directories that may contain packages.  The list
1230#       consists of one directory for machine-dependent binaries and
1231#       another for platform-independent scripts.
1232#--------------------------------------------------------------------
1233
1234if test "$prefix" != "$exec_prefix"; then
1235    TCL_PACKAGE_PATH="${exec_prefix}/lib ${prefix}/lib"
1236else
1237    TCL_PACKAGE_PATH="${prefix}/lib"
1238fi
1239
1240AC_SUBST(BUILD_DLTEST)
1241AC_SUBST(CFLAGS_DEBUG)
1242AC_SUBST(CFLAGS_DEFAULT)
1243AC_SUBST(CFLAGS_OPTIMIZE)
1244AC_SUBST(CFLAGS_WARNING)
1245AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
1246AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
1247AC_SUBST(TCL_DBGX)
1248AC_SUBST(DL_LIBS)
1249AC_SUBST(DL_OBJS)
1250AC_SUBST(LD_FLAGS)
1251AC_SUBST(MAKE_LIB)
1252AC_SUBST(MATH_LIBS)
1253AC_SUBST(SHLIB_CFLAGS)
1254AC_SUBST(SHLIB_LD)
1255AC_SUBST(SHLIB_LD_LIBS)
1256AC_SUBST(SHLIB_SUFFIX)
1257AC_SUBST(TCL_BUILD_LIB_SPEC)
1258AC_SUBST(TCL_LD_SEARCH_FLAGS)
1259AC_SUBST(TCL_LIB_FILE)
1260AC_SUBST(TCL_LIB_FLAG)
1261AC_SUBST(TCL_LIB_SPEC)
1262AC_SUBST(TCL_LIB_VERSIONS_OK)
1263AC_SUBST(TCL_MAJOR_VERSION)
1264AC_SUBST(TCL_MINOR_VERSION)
1265AC_SUBST(TCL_PACKAGE_PATH)
1266AC_SUBST(TCL_PATCH_LEVEL)
1267AC_SUBST(TCL_SHARED_LIB_SUFFIX)
1268AC_SUBST(TCL_SHARED_BUILD)
1269AC_SUBST(TCL_SHLIB_CFLAGS)
1270AC_SUBST(TCL_SRC_DIR)
1271AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
1272AC_SUBST(TCL_VERSION)
1273
1274AC_OUTPUT(Makefile tclConfig.sh)
Note: See TracBrowser for help on using the browser.