home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / configure.in < prev    next >
Text File  |  1993-09-17  |  6KB  |  183 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. AC_INIT(tcl.h)
  5. AC_PROG_INSTALL
  6. AC_PROG_RANLIB
  7. CC=${CC-cc}
  8. AC_SUBST(CC)
  9.  
  10. #--------------------------------------------------------------------
  11. #    Supply substitutes for missing POSIX library procedures, or
  12. #    set flags so Tcl uses alternate procedures.
  13. #--------------------------------------------------------------------
  14.  
  15. AC_REPLACE_FUNCS(getcwd opendir strerror strstr)
  16. AC_REPLACE_FUNCS(strtol tmpnam waitpid)
  17. AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
  18. AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
  19. AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))
  20.  
  21. #--------------------------------------------------------------------
  22. #    Supply substitutes for missing POSIX header files.  Special
  23. #    notes:
  24. #        - Sprite's dirent.h exists but is bogus.
  25. #        - stdlib.h doesn't define strtol, strtoul, or
  26. #          strtod insome versions of SunOS
  27. #        - some versions of string.h don't declare procedures such
  28. #          as strstr
  29. #--------------------------------------------------------------------
  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. ], tcl_ok=1, tcl_ok=0)
  42. AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=0)
  43. if test $tcl_ok = 0; then
  44.     AC_DEFINE(NO_DIRENT_H)
  45. fi
  46. AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H))
  47. AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
  48. AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
  49. AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
  50. AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
  51. AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
  52. AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
  53. if test $tcl_ok = 0; then
  54.     AC_DEFINE(NO_STDLIB_H)
  55. fi
  56. AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
  57. AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
  58. AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
  59. if test $tcl_ok = 0; then
  60.     AC_DEFINE(NO_STRING_H)
  61. fi
  62. AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
  63. AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
  64.  
  65. #--------------------------------------------------------------------
  66. #    On some systems strstr is broken: it returns a pointer even
  67. #    even if the original string is empty.
  68. #--------------------------------------------------------------------
  69.  
  70. AC_TEST_PROGRAM([
  71. extern int strstr();
  72. int main()
  73. {
  74.     exit(strstr("\0test", "test") ? 1 : 0);
  75. }
  76. ],  , [LIBOBJS="$LIBOBJS strstr.o"])
  77.  
  78. #--------------------------------------------------------------------
  79. #    Check for strtoul function.  This is tricky because under some
  80. #    versions of AIX strtoul returns an incorrect terminator
  81. #    pointer for the string "0".
  82. #--------------------------------------------------------------------
  83.  
  84. AC_FUNC_CHECK(strtoul, tcl_ok=1, tcl_ok=0)
  85. AC_TEST_PROGRAM([
  86. extern int strtoul();
  87. int main()
  88. {
  89.     char *string = "0";
  90.     char *term;
  91.     int value;
  92.     value = strtoul(string, &term, 0);
  93.     if ((value != 0) || (term != (string+1))) {
  94.         exit(1);
  95.     }
  96.     exit(0);
  97. }], , tcl_ok=0)
  98. if test $tcl_ok = 0; then
  99.     LIBOBJS="$LIBOBJS strtoul.o"
  100. fi
  101.  
  102. #--------------------------------------------------------------------
  103. #    Check for the strtod function.  This is tricky because under
  104. #    some versions of Linux it mis-parses the string "+".
  105. #--------------------------------------------------------------------
  106.  
  107. AC_FUNC_CHECK(strtod, tcl_ok=1, tcl_ok=0)
  108. AC_TEST_PROGRAM([
  109. extern double strtod();
  110. int main()
  111. {
  112.     char *string = "+";
  113.     char *term;
  114.     double value;
  115.     value = strtod(string, &term);
  116.     if (term != string) {
  117.     exit(1);
  118.     }
  119.     exit(0);
  120. }], , tcl_ok=0)
  121. if test $tcl_ok = 0; then
  122.     LIBOBJS="$LIBOBJS strtod.o"
  123. fi
  124.  
  125. #--------------------------------------------------------------------
  126. #    Check for various typedefs and provide substitutes if
  127. #    they don't exist.
  128. #--------------------------------------------------------------------
  129.  
  130. AC_MODE_T
  131. AC_PID_T
  132. AC_SIZE_T
  133. AC_UID_T
  134.  
  135. #--------------------------------------------------------------------
  136. #    If a system doesn't have an opendir function (man, that's old!)
  137. #    then we have to supply a different version of dirent.h which
  138. #    is compatible with the substitute version of opendir that's
  139. #    provided.  This version only works with V7-style directories.
  140. #--------------------------------------------------------------------
  141.  
  142. AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
  143.  
  144. #--------------------------------------------------------------------
  145. #    Check for the existence of sys_errlist (this is only needed if
  146. #    there's no strerror, but I don't know how to conditionalize the
  147. #    check).
  148. #--------------------------------------------------------------------
  149.  
  150. AC_COMPILE_CHECK(sys_errlist, , [
  151. extern char *sys_errlist[];
  152. extern int sys_nerr;
  153. sys_errlist[sys_nerr-1][0] = 0;
  154. ], , AC_DEFINE(NO_SYS_ERRLIST))
  155.  
  156. #--------------------------------------------------------------------
  157. #    The check below checks whether <sys/wait.h> defines the type
  158. #    "union wait" correctly.  It's needed because of weirdness in
  159. #    HP-UX where "union wait" is defined in both the BSD and SYS-V
  160. #    environments.  Checking the usability of WIFEXITED seems to do
  161. #    the trick.
  162. #--------------------------------------------------------------------
  163.  
  164. AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
  165. #include <sys/wait.h>], [
  166. union wait x;
  167. WIFEXITED(x);        /* Generates compiler error if WIFEXITED
  168.              * uses an int. */
  169. ], , AC_DEFINE(NO_UNION_WAIT))
  170.  
  171. #--------------------------------------------------------------------
  172. #    Check to see whether the system supports the matherr function
  173. #    and its associated type "struct exception".
  174. #--------------------------------------------------------------------
  175.  
  176. AC_COMPILE_CHECK([matherr support], [#include <math.h>], [
  177. struct exception x;
  178. x.type = DOMAIN;
  179. x.type = SING;
  180. ], [LIBOBJS="$LIBOBJS tclMtherr.o"; AC_DEFINE(NEED_MATHERR)])
  181.  
  182. AC_OUTPUT(Makefile)
  183.