root/tk-8.0/tags/rat_4_2_15/unix/configure.in @ 1284

Revision 1284, 14.6 KB (checked in by anonymous, 14 years ago)

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

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#! /bin/bash -norc
2dnl     This file is an input file used by the GNU "autoconf" program to
3dnl     generate the file "configure", which is run during Tk installation
4dnl     to configure the system for the local environment.
5AC_INIT(../generic/tk.h)
6# SCCS: @(#) configure.in 1.90 97/11/20 12:45:45
7
8TK_VERSION=8.0
9TK_MAJOR_VERSION=8
10TK_MINOR_VERSION=0
11TK_PATCH_LEVEL=".3"
12VERSION=${TK_VERSION}
13
14if test "${prefix}" = "NONE"; then
15    prefix=/usr/local
16fi
17if test "${exec_prefix}" = "NONE"; then
18    exec_prefix=$prefix
19fi
20TK_SRC_DIR=`cd $srcdir/..; pwd`
21
22AC_PROG_RANLIB
23#AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
24#    [tk_ok=$enableval], [tkl_ok=no])
25#if test "$tk_ok" = "yes"; then
26    AC_PROG_CC
27#else
28#    CC=${CC-cc}
29#AC_SUBST(CC)
30#fi
31#AC_C_CROSS
32AC_HAVE_HEADERS(unistd.h limits.h)
33
34# set the warning flags depending on whether or not we are using gcc
35if test "${GCC}" = "yes" ; then
36    # leave -Wimplicit-int out, the X libs generate so many of these warnings
37    # that they obscure everything else.
38
39    CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
40else
41    CFLAGS_WARNING=""
42fi
43
44#--------------------------------------------------------------------
45#       See if there was a command-line option for where Tcl is;  if
46#       not, assume that its top-level directory is a sibling of ours.
47#--------------------------------------------------------------------
48
49TCL_BIN_DIR=`cd ../../tcl-8.0/unix; pwd`
50if test ! -f $TCL_BIN_DIR/Makefile; then
51    AC_MSG_ERROR(There's no Makefile in $TCL_BIN_DIR;  perhaps you didn't specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?)
52fi
53
54#--------------------------------------------------------------------
55#       Read in configuration information generated by Tcl for shared
56#       libraries, and arrange for it to be substituted into our
57#       Makefile.
58#--------------------------------------------------------------------
59
60file=$TCL_BIN_DIR/tclConfig.sh
61. $file
62
63# Set the default compiler switches based on the --enable-symbols option
64
65AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols],
66    [tcl_ok=$enableval], [tcl_ok=no])
67if test "$tcl_ok" = "yes"; then
68    CFLAGS_DEFAULT=CFLAGS_DEBUG
69    TK_DBGX=g
70else
71    CFLAGS_DEFAULT=CFLAGS_OPTIMIZE
72    TK_DBGX=""
73fi
74
75SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
76SHLIB_LD=$TCL_SHLIB_LD
77SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
78SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
79SHLIB_VERSION=$TCL_SHLIB_VERSION
80DL_LIBS=$TCL_DL_LIBS
81LD_FLAGS=$TCL_LD_FLAGS
82CFLAGS_DEBUG=$TCL_CFLAGS_DEBUG
83CFLAGS_OPTIMIZE=$TCL_CFLAGS_OPTIMIZE
84
85LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
86
87# If Tcl and Tk are installed in different places, adjust the library
88# search path to reflect this.
89
90if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
91    LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}"
92fi
93
94#--------------------------------------------------------------------
95#       Supply a substitute for stdlib.h if it doesn't define strtol,
96#       strtoul, or strtod (which it doesn't in some versions of SunOS).
97#--------------------------------------------------------------------
98
99AC_MSG_CHECKING(stdlib.h)
100AC_HEADER_EGREP(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
101AC_HEADER_EGREP(strtoul, stdlib.h, , tk_ok=no)
102AC_HEADER_EGREP(strtod, stdlib.h, , tk_ok=no)
103if test $tk_ok = no; then
104    AC_DEFINE(NO_STDLIB_H)
105fi
106AC_MSG_RESULT($tk_ok)
107
108#--------------------------------------------------------------------
109#       Include sys/select.h if it exists and if it supplies things
110#       that appear to be useful and aren't already in sys/types.h.
111#       This appears to be true only on the RS/6000 under AIX.  Some
112#       systems like OSF/1 have a sys/select.h that's of no use, and
113#       other systems like SCO UNIX have a sys/select.h that's
114#       pernicious.  If "fd_set" isn't defined anywhere then set a
115#       special flag.
116#--------------------------------------------------------------------
117
118AC_MSG_CHECKING([fd_set and sys/select])
119AC_TRY_COMPILE([#include <sys/types.h>],
120        [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
121if test $tk_ok = no; then
122    AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
123    if test $tk_ok = yes; then
124        AC_DEFINE(HAVE_SYS_SELECT_H)
125    fi
126fi
127AC_MSG_RESULT($tk_ok)
128if test $tk_ok = no; then
129    AC_DEFINE(NO_FD_SET)
130fi
131
132#--------------------------------------------------------------------
133#       Check for various typedefs and provide substitutes if
134#       they don't exist.
135#--------------------------------------------------------------------
136
137AC_MODE_T
138AC_PID_T
139AC_SIZE_T
140AC_UID_T
141
142#------------------------------------------------------------------------------
143#       Find out about time handling differences.
144#------------------------------------------------------------------------------
145
146AC_CHECK_HEADERS(sys/time.h)
147AC_HEADER_TIME
148
149#--------------------------------------------------------------------
150#       Locate the X11 header files and the X11 library archive.  Try
151#       the ac_path_x macro first, but if it doesn't find the X stuff
152#       (e.g. because there's no xmkmf program) then check through
153#       a list of possible directories.  Under some conditions the
154#       autoconf macro will return an include directory that contains
155#       no include files, so double-check its result just to be safe.
156#--------------------------------------------------------------------
157
158AC_PATH_X
159not_really_there=""
160if test "$no_x" = ""; then
161    if test "$x_includes" = ""; then
162        AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
163    else
164        if test ! -r $x_includes/X11/Intrinsic.h; then
165            not_really_there="yes"
166        fi
167    fi
168fi
169if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
170    AC_MSG_CHECKING(for X11 header files)
171    XINCLUDES="# no special path needed"
172    AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
173    if test "$XINCLUDES" = nope; then
174        dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
175        for i in $dirs ; do
176            if test -r $i/X11/Intrinsic.h; then
177                AC_MSG_RESULT($i)
178                XINCLUDES=" -I$i"
179                break
180            fi
181        done
182    fi
183else
184    if test "$x_includes" != ""; then
185        XINCLUDES=-I$x_includes
186    else
187        XINCLUDES="# no special path needed"
188    fi
189fi
190if test "$XINCLUDES" = nope; then
191    AC_MSG_RESULT(couldn't find any!)
192    XINCLUDES="# no include files found"
193fi
194
195if test "$no_x" = yes; then
196    AC_MSG_CHECKING(for X11 libraries)
197    XLIBSW=nope
198    dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
199    for i in $dirs ; do
200        if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
201            AC_MSG_RESULT($i)
202            XLIBSW="-L$i -lX11"
203            x_libraries="$i"
204            break
205        fi
206    done
207else
208    if test "$x_libraries" = ""; then
209        XLIBSW=-lX11
210    else
211        XLIBSW="-L$x_libraries -lX11"
212    fi
213fi
214if test "$XLIBSW" = nope ; then
215    AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
216fi
217if test "$XLIBSW" = nope ; then
218    AC_MSG_RESULT(couldn't find any!  Using -lX11.)
219    XLIBSW=-lX11
220fi
221
222#--------------------------------------------------------------------
223#       Various manipulations on the search path used at runtime to
224#       find shared libraries:
225#       1. If the X library binaries are in a non-standard directory,
226#          add the X library location into that search path.
227#       2. On systems such as AIX and Ultrix that use "-L" as the
228#          search path option, colons cannot be used to separate
229#          directories from each other. Change colons to " -L".
230#       3. Create two sets of search flags, one for use in cc lines
231#          and the other for when the linker is invoked directly.  In
232#          the second case, '-Wl,' must be stripped off and commas must
233#          be replaced by spaces.
234#--------------------------------------------------------------------
235
236if test "x${x_libraries}" != "x"; then
237    LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}"
238fi
239if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
240    LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
241fi
242
243# The statement below is very tricky!  It actually *evaluates* the
244# string in TCL_LD_SEARCH_FLAGS, which causes a substitution of the
245# variable LIB_RUNTIME_DIR.
246
247eval "TK_CC_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
248TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e "s|,| |g"`
249
250#--------------------------------------------------------------------
251#       Check for the existence of various libraries.  The order here
252#       is important, so that then end up in the right order in the
253#       command line generated by make.  The -lsocket and -lnsl libraries
254#       require a couple of special tricks:
255#       1. Use "connect" and "accept" to check for -lsocket, and
256#          "gethostbyname" to check for -lnsl.
257#       2. Use each function name only once:  can't redo a check because
258#          autoconf caches the results of the last check and won't redo it.
259#       3. Use -lnsl and -lsocket only if they supply procedures that
260#          aren't already present in the normal libraries.  This is because
261#          IRIX 5.2 has libraries, but they aren't needed and they're
262#          bogus:  they goof up name resolution if used.
263#       4. On some SVR4 systems, can't use -lsocket without -lnsl too.
264#          To get around this problem, check for both libraries together
265#          if -lsocket doesn't work by itself.
266#--------------------------------------------------------------------
267
268AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
269
270tk_checkBoth=0
271AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
272if test "$tk_checkSocket" = 1; then
273    AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
274fi
275if test "$tk_checkBoth" = 1; then
276    tk_oldLibs=$LIBS
277    LIBS="$LIBS -lsocket -lnsl"
278    AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
279fi
280AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
281
282#--------------------------------------------------------------------
283# One more check related to the X libraries.  The standard releases
284# of Ultrix don't support the "xauth" mechanism, so send won't work
285# unless TK_NO_SECURITY is defined.  However, there are usually copies
286# of the MIT X server available as well, which do support xauth.
287# Check for the MIT stuff and use it if it exists.
288#
289# Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
290# because it can't deal with the "-" in the library name.
291#--------------------------------------------------------------------
292
293if test -d /usr/include/mit ; then
294    AC_MSG_CHECKING([MIT X libraries])
295    tk_oldCFlags=$CFLAGS
296    CFLAGS="$CFLAGS -I/usr/include/mit"
297    tk_oldLibs=$LIBS
298    LIBS="$LIBS -lX11-mit"
299    AC_TRY_LINK([
300        #include <X11/Xlib.h>
301    ], [
302        XOpenDisplay(0);
303    ], [
304        AC_MSG_RESULT(yes)
305        XLIBSW="-lX11-mit"
306        XINCLUDES="-I/usr/include/mit"
307    ], AC_MSG_RESULT(no))
308    CFLAGS=$tk_oldCFlags
309    LIBS=$tk_oldLibs
310fi
311
312#--------------------------------------------------------------------
313#       On a few very rare systems, all of the libm.a stuff is
314#       already in libc.a.  Set compiler flags accordingly.
315#       Also, Linux requires the "ieee" library for math to
316#       work right (and it must appear before "-lm").
317#--------------------------------------------------------------------
318
319MATH_LIBS=""
320AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
321AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
322
323#--------------------------------------------------------------------
324#       If this system doesn't have a memmove procedure, use memcpy
325#       instead.
326#--------------------------------------------------------------------
327
328AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)])
329
330#--------------------------------------------------------------------
331#       Figure out whether "char" is unsigned.  If so, set a
332#       #define for __CHAR_UNSIGNED__.
333#--------------------------------------------------------------------
334
335AC_C_CHAR_UNSIGNED
336
337#--------------------------------------------------------------------
338#       Under Solaris 2.4, strtod returns the wrong value for the
339#       terminating character under some conditions.  Check for this
340#       and if the problem exists use a substitute procedure
341#       "fixstrtod" (provided by Tcl) that corrects the error.
342#--------------------------------------------------------------------
343
344AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
345if test "$tk_strtod" = 1; then
346    AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
347    AC_TRY_RUN([
348        extern double strtod();
349        int main()
350        {
351            char *string = "NaN";
352            char *term;
353            strtod(string, &term);
354            if ((term != string) && (term[-1] == 0)) {
355                exit(1);
356            }
357            exit(0);
358        }], tk_ok=1, tk_ok=0, tk_ok=0)
359    if test "$tk_ok" = 1; then
360        AC_MSG_RESULT(ok)
361    else
362        AC_MSG_RESULT(buggy)
363        AC_DEFINE(strtod, fixstrtod)
364    fi
365fi
366
367#--------------------------------------------------------------------
368#       The statements below define a collection of symbols related to
369#       building libtk as a shared library instead of a static library.
370#--------------------------------------------------------------------
371
372#AC_ARG_ENABLE(shared,
373#    [  --enable-shared         build libtk as a shared library],
374#    [ok=$enableval], [ok=no])
375#if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
376#    TK_SHARED_BUILD=1
377#    TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
378#    TK_LIB_FILE=libtk${TCL_SHARED_LIB_SUFFIX}
379#    MAKE_LIB="\${SHLIB_LD} -o \${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${SHLIB_LD_LIBS}"
380#    RANLIB=":"
381#else
382    TK_SHARED_BUILD=0
383    TK_SHLIB_CFLAGS=""
384    TK_LIB_FILE=libtk${TCL_UNSHARED_LIB_SUFFIX}
385    MAKE_LIB="ar cr \${TK_LIB_FILE} \${OBJS}"
386#fi
387
388DBGX='${TK_DBGX}'
389eval "TK_LIB_FILE=${TK_LIB_FILE}"
390
391# Note:  in the following variable, it's important to use the absolute
392# path name of the Tcl directory rather than "..":  this is because
393# AIX remembers this path and will attempt to use it at run-time to look
394# up the Tcl library.
395
396if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
397    TK_LIB_FLAG="-ltk${VERSION}\${TK_DBGX}"
398else
399    TK_LIB_FLAG="-ltk`echo ${VERSION} | tr -d .`\${TK_DBGX}"
400fi
401TK_BUILD_LIB_SPEC="`pwd`/libtk8.0.a"
402TK_LIB_SPEC="-L${exec_prefix}/lib ${TK_LIB_FLAG}"
403
404AC_SUBST(CFLAGS_DEBUG)
405AC_SUBST(CFLAGS_DEFAULT)
406AC_SUBST(CFLAGS_OPTIMIZE)
407AC_SUBST(CFLAGS_WARNING)
408AC_SUBST(TK_DBGX)
409AC_SUBST(DL_LIBS)
410AC_SUBST(LD_FLAGS)
411AC_SUBST(MATH_LIBS)
412AC_SUBST(MAKE_LIB)
413AC_SUBST(SHLIB_CFLAGS)
414AC_SUBST(SHLIB_LD)
415AC_SUBST(SHLIB_LD_LIBS)
416AC_SUBST(SHLIB_SUFFIX)
417AC_SUBST(SHLIB_VERSION)
418AC_SUBST(TCL_BIN_DIR)
419AC_SUBST(TCL_BUILD_LIB_SPEC)
420AC_SUBST(TCL_DBGX)
421AC_SUBST(TCL_LIB_FLAG)
422AC_SUBST(TCL_SRC_DIR)
423AC_SUBST(TCL_VERSION)
424AC_SUBST(TK_BUILD_LIB_SPEC)
425AC_SUBST(TK_CC_SEARCH_FLAGS)
426AC_SUBST(TK_LD_SEARCH_FLAGS)
427AC_SUBST(TK_LIB_FILE)
428AC_SUBST(TK_LIB_FLAG)
429AC_SUBST(TK_LIB_SPEC)
430AC_SUBST(TK_MAJOR_VERSION)
431AC_SUBST(TK_MINOR_VERSION)
432AC_SUBST(TK_PATCH_LEVEL)
433AC_SUBST(TK_SHLIB_CFLAGS)
434AC_SUBST(TK_SRC_DIR)
435AC_SUBST(TK_VERSION)
436AC_SUBST(XINCLUDES)
437AC_SUBST(XLIBSW)
438AC_SUBST(TK_SHARED_BUILD)
439
440AC_OUTPUT(Makefile tkConfig.sh)
Note: See TracBrowser for help on using the browser.