home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tcl7.0b1 / configure.in < prev    next >
Encoding:
Text File  |  1993-06-03  |  5.2 KB  |  147 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 Tcl installation
  3. dnl    to configure the system for the local environment.
  4.  
  5. AC_INIT(tcl.h)
  6. AC_PROG_INSTALL
  7. AC_PROG_RANLIB
  8.  
  9. dnl--------------------------------------------------------------------
  10. dnl    Supply substitutes for missing POSIX library procedures, or set
  11. dnl    flags so Tcl uses alternate procedures.
  12. dnl--------------------------------------------------------------------
  13.  
  14. AC_REPLACE_FUNCS(getcwd opendir strerror strstr strtod)
  15. AC_REPLACE_FUNCS(strtol strtoul tmpnam waitpid)
  16. AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
  17. AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
  18. AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))
  19.  
  20.  
  21. dnl--------------------------------------------------------------------
  22. dnl    Supply substitutes for missing POSIX header files.  Special
  23. dnl    notes:
  24. dnl        - Sprite's dirent.h exists but is bogus.
  25. dnl        - stdlib.h doesn't define strtol, strtoul, or
  26. dnl          strtod insome versions of SunOS
  27. dnl        - some versions of string.h don't declare procedures such
  28. dnl          as strstr
  29. dnl--------------------------------------------------------------------
  30.  
  31. AC_UNISTD_H
  32. AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
  33. #include <dirent.h>], [
  34. DIR *d;
  35. struct dirent *entryPtr;
  36. char *p;
  37. d = opendir("foobar");
  38. entryPtr = readdir(d);
  39. p = entryPtr->d_name;
  40. closedir(d);
  41. ], , AC_DEFINE(NO_DIRENT_H))
  42. AC_HEADER_EGREP([Sprite version.* NOT POSIX], AC_DEFINE(NO_DIRENT_H))
  43. AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
  44. AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
  45. AC_HEADER_CHECK(stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  46. AC_HEADER_EGREP(strtol, stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  47. AC_HEADER_EGREP(strtoul, stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  48. AC_HEADER_EGREP(strtod, stdlib.h, , AC_DEFINE(NO_STDLIB_H))
  49. AC_HEADER_CHECK(string.h, , AC_DEFINE(NO_STRING_H))
  50. AC_HEADER_EGREP(strstr, string.h, , AC_DEFINE(NO_STRING_H))
  51. AC_HEADER_EGREP(strerror, string.h, , AC_DEFINE(NO_STRING_H))
  52. AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
  53. AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
  54.  
  55. dnl--------------------------------------------------------------------
  56. dnl    On some systems strstr is broken: it returns a pointer even
  57. dnl    even if the original string is empty.
  58. dnl--------------------------------------------------------------------
  59.  
  60. AC_TEST_PROGRAM([
  61. extern int strstr();
  62. int main()
  63. {
  64.     exit(strstr("\0test", "test") ? 1 : 0);
  65. }
  66. ],  , [LIBOBJS="$LIBOBJS strstr.o"])
  67.  
  68. dnl--------------------------------------------------------------------
  69. dnl    Under some versions of AIX strtoul returns an incorrect terminator
  70. dnl    pointer for the string "0".
  71. dnl--------------------------------------------------------------------
  72.  
  73. AC_TEST_PROGRAM([
  74. extern int strtoul();
  75. int main()
  76. {
  77.     char *string = "0";
  78.     char *term;
  79.     int value;
  80.     value = strtoul(string, &term, 0);
  81.     if ((value != 0) || (term != (string+1))) {
  82.         exit(1);
  83.     }
  84.     exit(0);
  85. }], , [LIBOBJS="$LIBOBJS strtoul.o"])
  86.  
  87. dnl--------------------------------------------------------------------
  88. dnl    Check for missing pid_t and uid_t typedefs.
  89. dnl--------------------------------------------------------------------
  90.  
  91. AC_PID_T
  92. AC_UID_T
  93.  
  94. dnl--------------------------------------------------------------------
  95. dnl    If a system doesn't have an opendir function (man, that's old!)
  96. dnl    then we have to supply a different version of dirent.h which
  97. dnl    is compatible with the substitute version of opendir that's
  98. dnl    provided.  This version only works with V7-style directories.
  99. dnl--------------------------------------------------------------------
  100.  
  101. AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
  102.  
  103. dnl--------------------------------------------------------------------
  104. dnl    Check for the existence of sys_errlist (this is only needed if
  105. dnl    there's no strerror, but I don't know how to conditionalize the
  106. dnl    check).
  107. dnl--------------------------------------------------------------------
  108.  
  109. AC_COMPILE_CHECK(sys_errlist, , [
  110. extern char *sys_errlist[];
  111. extern int sys_nerr;
  112. sys_errlist[sys_nerr-1][0] = 0;
  113. ], , AC_DEFINE(NO_SYS_ERRLIST))
  114.  
  115. dnl--------------------------------------------------------------------
  116. dnl    The check below checks whether <sys/wait.h> defines the type
  117. dnl    "union wait" correctly.  It's needed because of weirdness in
  118. dnl    HP-UX where "union wait" is defined in both the BSD and SYS-V
  119. dnl    environments.  Checking the usability of WIFEXITED seems to do
  120. dnl    the trick.
  121. dnl--------------------------------------------------------------------
  122.  
  123. AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
  124. #include <sys/wait.h>], [
  125. union wait x;
  126. WIFEXITED(x);        /* Generates compiler error if WIFEXITED
  127.              * uses an int. */
  128. ], , AC_DEFINE(NO_UNION_WAIT))
  129.  
  130. dnl--------------------------------------------------------------------
  131. dnl    The code below cleans up the DEFS variable to eliminate
  132. dnl    duplicate entries.  This makes the eventual make output
  133. dnl    look a bit cleaner.
  134. dnl--------------------------------------------------------------------
  135.  
  136. newDefs=""
  137. for i in $DEFS; do
  138.     if test -z "$newDefs"; then
  139.         newDefs=$i
  140.     elif echo $newDefs | fgrep -v -e $i >/dev/null 2>&1; then
  141.         newDefs="$newDefs $i"
  142.     fi
  143. done
  144. DEFS=$newDefs
  145.  
  146. AC_OUTPUT(Makefile)
  147.