home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Tk / unix / configure.in next >
Encoding:
Text File  |  1996-05-31  |  11.1 KB  |  332 lines

  1. dnl    This file is an input file used by the GNU "autoconf" program to
  2. dnl    generate the file "configure", which is run during Tk installation
  3. dnl    to configure the system for the local environment.
  4. AC_INIT(../generic/tk.h)
  5.  
  6. # @(#) configure.in 1.27 95/10/01 13:54:35
  7.  
  8. AC_PROG_INSTALL
  9. AC_PROG_RANLIB
  10. AC_PREFIX_PROGRAM(wish)
  11. AC_HAVE_HEADERS(unistd.h limits.h)
  12.  
  13. #--------------------------------------------------------------------
  14. #    Include sys/select.h if it exists and if it supplies things
  15. #    that appear to be useful and aren't already in sys/types.h.
  16. #    This appears to be true only on the RS/6000 under AIX.  Some
  17. #    systems like OSF/1 have a sys/select.h that's of no use, and
  18. #    other systems like SCO UNIX have a sys/select.h that's
  19. #    pernicious.  If "fd_set" isn't defined anywhere then set a
  20. #    special flag.
  21. #--------------------------------------------------------------------
  22.  
  23. AC_MSG_CHECKING([fd_set and sys/select])
  24. AC_TRY_COMPILE([#include <sys/types.h>],
  25.     [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
  26. if test $tk_ok = no; then
  27.     AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
  28.     if test $tk_ok = yes; then
  29.     AC_DEFINE(HAVE_SYS_SELECT_H)
  30.     fi
  31. fi
  32. AC_MSG_RESULT($tk_ok)
  33. if test $tk_ok = no; then
  34.     AC_DEFINE(NO_FD_SET)
  35. fi
  36.  
  37. #--------------------------------------------------------------------
  38. #    Supply a substitute for stdlib.h if it doesn't define strtol,
  39. #    strtoul, or strtod (which it doesn't in some versions of SunOS).
  40. #--------------------------------------------------------------------
  41.  
  42. AC_MSG_CHECKING(stdlib.h)
  43. AC_HEADER_EGREP(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
  44. AC_HEADER_EGREP(strtoul, stdlib.h, , tk_ok=no)
  45. AC_HEADER_EGREP(strtod, stdlib.h, , tk_ok=no)
  46. if test $tk_ok = no; then
  47.     AC_DEFINE(NO_STDLIB_H)
  48. fi
  49. AC_MSG_RESULT($tk_ok)
  50.  
  51. #--------------------------------------------------------------------
  52. #    Check for various typedefs and provide substitutes if
  53. #    they don't exist.
  54. #--------------------------------------------------------------------
  55.  
  56. AC_MODE_T
  57. AC_PID_T
  58. AC_SIZE_T
  59. AC_UID_T
  60.  
  61. #--------------------------------------------------------------------
  62. #    Locate the X11 header files and the X11 library archive.  Try
  63. #    the ac_path_x macro first, but if it doesn't find the X stuff
  64. #    (e.g. because there's no xmkmf program) then check through
  65. #    a list of possible directories.  Under some conditions the
  66. #    autoconf macro will return an include directory that contains
  67. #    no include files, so double-check its result just to be safe.
  68. #--------------------------------------------------------------------
  69.  
  70. AC_PATH_X
  71. not_really_there=""
  72. if test "$no_x" = ""; then
  73.     if test "$x_includes" = ""; then
  74.     AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
  75.     else
  76.     if test ! -r $x_includes/X11/Intrinsic.h; then
  77.         not_really_there="yes"
  78.     fi
  79.     fi
  80. fi
  81. if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
  82.     echo checking for X11 header files
  83.     XINCLUDES="# no special path needed"
  84.     AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
  85.     if test "$XINCLUDES" = nope; then
  86.         dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/include/X11R4 /usr/X11R5/include /usr/include/X11R5 /usr/openwin/include /usr/X11/include /usr/sww/include"
  87.         for i in $dirs ; do
  88.         if test -r $i/X11/Intrinsic.h; then
  89.             XINCLUDES=" -I$i"
  90.         fi
  91.         done
  92.     fi
  93. else
  94.     if test "$x_includes" != ""; then
  95.     XINCLUDES=-I$x_includes
  96.     else
  97.     XINCLUDES="# no special path needed"
  98.     fi
  99. fi
  100. if test "$XINCLUDES" = nope; then
  101.   echo "Warning:  couldn't find any X11 include files."
  102.   XINCLUDES="# no include files found"
  103. fi
  104. AC_SUBST(XINCLUDES)
  105.  
  106. if test "$no_x" = yes; then
  107.     XLIBSW=nope
  108.     if test "$XLIBSW" = nope; then
  109.     dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/lib/X11R4 /usr/X11R5/lib /usr/lib/X11R5 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
  110.     for i in $dirs ; do
  111.         if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
  112.         XLIBSW="-L$i -lX11"
  113.         fi
  114.     done
  115.     fi
  116. else
  117.     if test "$x_libraries" = ""; then
  118.     XLIBSW=-lX11
  119.     else
  120.     XLIBSW="-L$x_libraries -lX11"
  121.     fi
  122. fi
  123. if test "$XLIBSW" = nope ; then
  124.     AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
  125. fi
  126. if test "$XLIBSW" = nope ; then
  127.     echo "Warning:  couldn't find the X11 library archive.  Using -lX11."
  128.     XLIBSW=-lX11
  129. fi
  130. AC_SUBST(XLIBSW)
  131.  
  132. #--------------------------------------------------------------------
  133. #    Check for the existence of various libraries.  The order here
  134. #    is important, so that then end up in the right order in the
  135. #    command line generated by make.  The -lsocket and -lnsl libraries
  136. #    require a couple of special tricks:
  137. #    1. Use "connect" and "accept" to check for -lsocket, and
  138. #       "gethostbyname" to check for -lnsl.
  139. #    2. Use each function name only once:  can't redo a check because
  140. #       autoconf caches the results of the last check and won't redo it.
  141. #    3. Use -lnsl and -lsocket only if they supply procedures that
  142. #       aren't already present in the normal libraries.  This is because
  143. #       IRIX 5.2 has libraries, but they aren't needed and they're
  144. #       bogus:  they goof up name resolution if used.
  145. #    4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  146. #       To get around this problem, check for both libraries together
  147. #       if -lsocket doesn't work by itself.
  148. #--------------------------------------------------------------------
  149.  
  150. AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
  151.  
  152. tk_checkBoth=0
  153. AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
  154. if test "$tk_checkSocket" = 1; then
  155.     AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
  156. fi
  157. if test "$tk_checkBoth" = 1; then
  158.     tk_oldLibs=$LIBS
  159.     LIBS="$LIBS -lsocket -lnsl"
  160.     AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
  161. fi
  162. AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
  163.  
  164. #--------------------------------------------------------------------
  165. # One more check related to the X libraries.  The standard releases
  166. # of Ultrix don't support the "xauth" mechanism, so send won't work
  167. # unless TK_NO_SECURITY is defined.  However, there are usually copies
  168. # of the MIT X server available as well, which do support xauth.
  169. # Check for the MIT stuff and use it if it exists.
  170. #
  171. # Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
  172. # because it can't deal with the "-" in the library name.
  173. #--------------------------------------------------------------------
  174.  
  175. if test -d /usr/include/mit ; then
  176.     AC_MSG_CHECKING([MIT X libraries])
  177.     tk_oldCFlags=$CFLAGS
  178.     CFLAGS="$CFLAGS -I/usr/include/mit"
  179.     tk_oldLibs=$LIBS
  180.     LIBS="$LIBS -lX11-mit"
  181.     AC_TRY_LINK([
  182.     #include <X11/Xlib.h>
  183.     ], [
  184.     XOpenDisplay(0);
  185.     ], [
  186.     AC_MSG_RESULT(yes)
  187.     XLIBSW="-lX11-mit"
  188.     XINCLUDES="-I/usr/include/mit"
  189.     ], AC_MSG_RESULT(no))
  190.     CFLAGS=$tk_oldCFlags
  191.     LIBS=$tk_oldLibs
  192. fi
  193.  
  194. #--------------------------------------------------------------------
  195. #    Figure out how to find out whether a FILE structure contains
  196. #    buffered readable data.  Some known names for the count field:
  197. #        _cnt:        Most UNIX systems
  198. #        __cnt:        HPUX
  199. #        _r:        BSD
  200. #        readCount:    Sprite
  201. #    Or, in GNU libc there are two fields, _gptr and _egptr, which
  202. #    have to be compared.
  203. #--------------------------------------------------------------------
  204.  
  205. AC_MSG_CHECKING([count field in FILE structures])
  206. AC_TRY_COMPILE([#include <stdio.h>],
  207.     [FILE *f = stdin; f->_cnt = 0;], fcnt="_cnt", )
  208. if test "$fcnt" = ""; then
  209.     AC_TRY_COMPILE([#include <stdio.h>],
  210.     [FILE *f = stdin; f->__cnt = 0;], fcnt="__cnt", )
  211. fi
  212. if test "$fcnt" = ""; then
  213.     AC_TRY_COMPILE([#include <stdio.h>],
  214.     [FILE *f = stdin; f->_r = 0;], fcnt="_r", )
  215. fi
  216. if test "$fcnt" = ""; then
  217.     AC_TRY_COMPILE([#include <stdio.h>],
  218.     [FILE *f = stdin; f->readCount = 0;], fcnt="readCount", )
  219. fi
  220. if test "$fcnt" != ""; then
  221.     AC_DEFINE_UNQUOTED(TK_FILE_COUNT, $fcnt)
  222. fi
  223. if test "$fcnt" = ""; then
  224.     AC_TRY_COMPILE([#include <stdio.h>],
  225.     [FILE *f = stdin; f->_gptr = f->_egptr;],
  226.     tk_ok=yes, tk_ok=no)
  227.     if test $tk_ok = yes; then
  228.     AC_DEFINE(TK_FILE_GPTR)
  229.     fcnt="_gptr/_egptr"
  230.     fi
  231. fi
  232. if test "$fcnt" = ""; then
  233.     AC_TRY_COMPILE([#include <stdio.h>],
  234.     [FILE *f = stdin; f->_IO_read_ptr = f->_IO_read_end;],
  235.     tk_ok=yes, tk_ok=no)
  236.     if test $tk_ok = yes; then
  237.     AC_DEFINE(TK_FILE_READ_PTR)
  238.     fcnt="_IO_read_ptr/_IO_read_end"
  239.     fi
  240. fi
  241. if test "$fcnt" = ""; then
  242.     AC_MSG_RESULT([not found; must supply TkReadDataPending procedure])
  243. else
  244.     AC_MSG_RESULT("$fcnt")
  245. fi
  246.  
  247. #--------------------------------------------------------------------
  248. #    On a few very rare systems, all of the libm.a stuff is
  249. #    already in libc.a.  Set compiler flags accordingly.
  250. #    Also, Linux requires the "ieee" library for math to
  251. #    work right (and it must appear before "-lm").
  252. #--------------------------------------------------------------------
  253.  
  254. MATH_LIBS=""
  255. AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
  256. AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
  257. AC_SUBST(MATH_LIBS)
  258.  
  259. #--------------------------------------------------------------------
  260. #    If this system doesn't have a memmove procedure, use memcpy
  261. #    instead.
  262. #--------------------------------------------------------------------
  263.  
  264. AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)])
  265.  
  266. #--------------------------------------------------------------------
  267. #    Figure out whether "char" is unsigned.  If so, set a
  268. #    #define for __CHAR_UNSIGNED__.
  269. #--------------------------------------------------------------------
  270.  
  271. AC_C_CHAR_UNSIGNED
  272.  
  273. #--------------------------------------------------------------------
  274. #    SGI systems don't use the BSD form of the gettimeofday function,
  275. #    but they have a BSDgettimeofday function that can be used instead.
  276. #
  277. #    Also, check for the existence of a gettimeofday declaration,
  278. #    to tkPort.h can declare it if it isn't already declared.
  279. #--------------------------------------------------------------------
  280.  
  281. AC_CHECK_FUNC(BSDgettimeofday, AC_DEFINE(HAVE_BSDGETTIMEOFDAY))
  282. AC_MSG_CHECKING([for gettimeofday declaration])
  283. AC_EGREP_HEADER(gettimeofday, sys/time.h, AC_MSG_RESULT(present), [
  284.     AC_MSG_RESULT(missing)
  285.     AC_DEFINE(GETTOD_NOT_DECLARED)
  286. ])
  287.  
  288. #--------------------------------------------------------------------
  289. #    Under Solaris 2.4, strtod returns the wrong value for the
  290. #    terminating character under some conditions.  Check for this
  291. #    and if the problem exists use a substitute procedure
  292. #    "fixstrtod" (provided by Tcl) that corrects the error.
  293. #--------------------------------------------------------------------
  294.  
  295. AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
  296. if test "$tk_strtod" = 1; then
  297.     AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
  298.     AC_TRY_RUN([
  299.     extern double strtod();
  300.     int main()
  301.     {
  302.         char *string = "NaN";
  303.         char *term;
  304.         strtod(string, &term);
  305.         if ((term != string) && (term[-1] == 0)) {
  306.         exit(1);
  307.         }
  308.         exit(0);
  309.     }], tk_ok=1, tk_ok=0, tk_ok=0)
  310.     if test "$tk_ok" = 1; then
  311.     AC_MSG_RESULT(ok)
  312.     else
  313.     AC_MSG_RESULT(buggy)
  314.     AC_DEFINE(strtod, fixstrtod)
  315.     fi
  316. fi
  317.  
  318. #--------------------------------------------------------------------
  319. #    Read in configuration information generated by Tcl for shared
  320. #    libraries, and arrange for it to be substituted into our
  321. #    Makefile.
  322. #--------------------------------------------------------------------
  323.  
  324. AC_SUBST(CC)
  325. AC_SUBST(SHLIB_CFLAGS)
  326. AC_SUBST(SHLIB_LD)
  327. AC_SUBST(SHLIB_SUFFIX)
  328. AC_SUBST(DL_LIBS)
  329. AC_SUBST(LD_FLAGS)
  330.  
  331. AC_OUTPUT(Makefile)
  332.