OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [unix/] [configure.in] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.