home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Shells / zsh-3.0.5-MIHS / src / configure.in < prev    next >
Encoding:
Text File  |  1997-09-25  |  24.0 KB  |  779 lines

  1. dnl
  2. dnl  $Id: configure.in,v 2.28 1996/10/20 00:08:41 hzoli Exp $
  3. dnl
  4. dnl  Configure template for zsh.
  5. dnl  Process this file with autoconf to produce a configure script.
  6. dnl
  7. dnl  Copyright (c) 1996 Richard Coleman
  8. dnl  All rights reserved.
  9. dnl
  10. dnl  Permission is hereby granted, without written agreement and without
  11. dnl  license or royalty fees, to use, copy, modify, and distribute this
  12. dnl  software and to distribute modified versions of this software for any
  13. dnl  purpose, provided that the above copyright notice and the following
  14. dnl  two paragraphs appear in all copies of this software.
  15. dnl
  16. dnl  In no event shall Richard Coleman or the Zsh Development Group be liable
  17. dnl  to any party for direct, indirect, special, incidental, or consequential
  18. dnl  damages arising out of the use of this software and its documentation,
  19. dnl  even if Richard Coleman and the Zsh Development Group have been advised of
  20. dnl  the possibility of such damage.
  21. dnl
  22. dnl  Richard Coleman and the Zsh Development Group specifically disclaim any
  23. dnl  warranties, including, but not limited to, the implied warranties of
  24. dnl  merchantability and fitness for a particular purpose.  The software
  25. dnl  provided hereunder is on an "as is" basis, and Richard Coleman and the
  26. dnl  Zsh Development Group have no obligation to provide maintenance,
  27. dnl  support, updates, enhancements, or modifications.
  28.  
  29. AC_INIT(Src/zsh.h)
  30. AC_CONFIG_HEADER(config.h)
  31.  
  32. dnl What version of zsh are we building ?
  33. VERSION=`sed -e 's/^.*"\(.*\)"$/\1/' ${srcdir}/Src/version.h`
  34. echo "configuring for zsh $VERSION"
  35. AC_SUBST(VERSION)dnl
  36.  
  37. dnl ----------------------------------------------
  38. dnl CHECK FOR MACHINE/VENDOR/OPERATING SYSTEM TYPE
  39. dnl ----------------------------------------------
  40. dnl Find out machine type, vendor, and operating system
  41. dnl What type of host is this?
  42. AC_CANONICAL_HOST
  43. AC_DEFINE_UNQUOTED(OSTYPE,   "$host_os")
  44. AC_DEFINE_UNQUOTED(MACHTYPE, "$host_cpu")
  45. AC_DEFINE_UNQUOTED(VENDOR,   "$host_vendor")
  46.  
  47. dnl -----------------------------
  48. dnl CHECKING COMMAND LINE OPTIONS
  49. dnl -----------------------------
  50. dnl Do you want to debug zsh?
  51. undefine([zsh-debug])dnl
  52. AC_ARG_ENABLE(zsh-debug,
  53. [  --enable-zsh-debug         use it if you want to debug zsh],
  54. [if test x$enableval = xyes; then
  55.   AC_DEFINE(DEBUG)
  56. fi])
  57.  
  58. dnl Do you want zsh memory allocation routines.
  59. undefine([zsh-mem])dnl
  60. AC_ARG_ENABLE(zsh-mem,
  61. [  --enable-zsh-mem           use zsh memory allocation routines],
  62. [if test x$enableval = xyes; then
  63.   AC_DEFINE(ZSH_MEM)
  64. fi])
  65.  
  66. dnl Do you want to debug zsh memory allocation routines.
  67. undefine([zsh-mem-debug])dnl
  68. AC_ARG_ENABLE(zsh-mem-debug,
  69. [  --enable-zsh-mem-debug     debug zsh memory allocation routines],
  70. [if test x$enableval = xyes; then
  71.   AC_DEFINE(ZSH_MEM_DEBUG)
  72. fi])
  73.  
  74. dnl Do you want to print warnings when errors in memory allocation.
  75. undefine([zsh-mem-warning])dnl
  76. AC_ARG_ENABLE(zsh-mem-warning,
  77. [  --enable-zsh-mem-warning   print warnings when error in memory allocation],
  78. [if test x$enableval = xyes; then
  79.   AC_DEFINE(ZSH_MEM_WARNING)
  80. fi])
  81.  
  82. dnl Do you want to turn on error checking for free().
  83. undefine([zsh-secure-free])dnl
  84. AC_ARG_ENABLE(zsh-secure-free,
  85. [  --enable-zsh-secure-free   turn on error checking for free()],
  86. [if test x$enableval = xyes; then
  87.   AC_DEFINE(ZSH_SECURE_FREE)
  88. fi])
  89.  
  90. dnl Do you want debugging information on internal hash tables.
  91. dnl This turns on the `hashinfo' builtin command.
  92. undefine([zsh-hash-debug])dnl
  93. AC_ARG_ENABLE(zsh-hash-debug,
  94. [  --enable-zsh-hash-debug    turn on debugging of internal hash tables],
  95. [if test x$enableval = xyes; then
  96.   AC_DEFINE(ZSH_HASH_DEBUG)
  97. fi])
  98.  
  99. dnl Pathnames for global zsh scripts
  100. undefine([zshenv])dnl
  101. AC_ARG_ENABLE(etcdir,
  102. [  --enable-etcdir=directory  default directory for global zsh scripts],
  103. [etcdir="$enableval"], [etcdir=/etc])
  104.  
  105. undefine([zshenv])dnl
  106. AC_ARG_ENABLE(zshenv,
  107. [  --enable-zshenv=pathname   the full pathname of the global zshenv script],
  108. [zshenv="$enableval"],
  109. [if test "x$etcdir" = xno; then
  110.   zshenv=no
  111. else
  112.   zshenv="$etcdir/zshenv"
  113. fi])
  114. if test "x$zshenv" != xno; then
  115.   AC_DEFINE_UNQUOTED(GLOBAL_ZSHENV, "$zshenv")
  116. fi
  117.  
  118. undefine([zshrc])dnl
  119. AC_ARG_ENABLE(zshrc,
  120. [  --enable-zshrc=pathname    the full pathname of the global zshrc script],
  121. [zshrc="$enableval"],
  122. [if test "x$etcdir" = xno; then
  123.   zshrc=no
  124. else
  125.   zshrc="$etcdir/zshrc"
  126. fi])
  127. if test "x$zshrc" != xno; then
  128.   AC_DEFINE_UNQUOTED(GLOBAL_ZSHRC, "$zshrc")
  129. fi
  130.  
  131. undefine([zprofile])dnl
  132. AC_ARG_ENABLE(zprofile,
  133. [  --enable-zprofile=pathname the full pathname of the global zprofile script],
  134. [zprofile="$enableval"],
  135. [if test "x$etcdir" = xno; then
  136.   zprofile=no
  137. else
  138.   zprofile="$etcdir/zprofile"
  139. fi])
  140. if test "x$zprofile" != xno; then
  141.   AC_DEFINE_UNQUOTED(GLOBAL_ZPROFILE, "$zprofile")
  142. fi
  143.  
  144. undefine([zlogin])dnl
  145. AC_ARG_ENABLE(zlogin,
  146. [  --enable-zlogin=pathname   the full pathname of the global zlogin script],
  147. [zlogin="$enableval"],
  148. [if test "x$etcdir" = xno; then
  149.   zlogin=no
  150. else
  151.   zlogin="$etcdir/zlogin"
  152. fi])
  153. if test "x$zlogin" != xno; then
  154.   AC_DEFINE_UNQUOTED(GLOBAL_ZLOGIN, "$zlogin")
  155. fi
  156.  
  157. undefine([zlogout])dnl
  158. AC_ARG_ENABLE(zlogout,
  159. [  --enable-zlogout=pathname  the full pathname of the global zlogout script],
  160. [zlogout="$enableval"],
  161. [if test "x$etcdir" = xno; then
  162.   zlogout=no
  163. else
  164.   zlogout="$etcdir/zlogout"
  165. fi])
  166. if test "x$zlogout" != xno; then
  167.   AC_DEFINE_UNQUOTED(GLOBAL_ZLOGOUT, "$zlogout")
  168. fi
  169.  
  170. AC_SUBST(zshenv)dnl
  171. AC_SUBST(zshrc)dnl
  172. AC_SUBST(zprofile)dnl
  173. AC_SUBST(zlogin)dnl
  174. AC_SUBST(zlogout)dnl
  175.  
  176. dnl ------------------
  177. dnl CHECK THE COMPILER
  178. dnl ------------------
  179. dnl We want these before the checks, so the checks can modify their values.
  180. test -z "$CFLAGS"  && CFLAGS= auto_cflags=1
  181. if test "${enable_zsh_debug}" = yes; then
  182.   test -z "$LDFLAGS" && LDFLAGS=-g
  183. fi
  184.  
  185. AC_PROG_CC
  186.  
  187. dnl if the user hasn't specified CFLAGS, then
  188. dnl   if compiler is gcc, then use -O2 and some warning flags
  189. dnl   else use -O
  190. if test -n "$auto_cflags"; then
  191.   if test "${enable_zsh_debug}" = yes; then
  192.     if test -n "$GCC"; then
  193.       CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -g"
  194.     else
  195.       CFLAGS="$CFLAGS -g"
  196.     fi
  197.   else
  198.     if test -n "$GCC"; then
  199.       CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -O2"
  200.     else
  201.       CFLAGS="$CFLAGS -O"
  202.     fi
  203.   fi
  204. fi
  205.  
  206. dnl ----------
  207. dnl SCO KLUDGE
  208. dnl ----------
  209. dnl Sco doesn't define any useful compiler symbol,
  210. dnl so we will check for sco and define __sco if
  211. dnl found.
  212. if test `echo $host_os | sed 's/^\(...\).*/\1/'` = sco; then
  213.   CFLAGS="-D__sco $CFLAGS"
  214. fi
  215.  
  216. AC_SUBST(CFLAGS)dnl
  217. AC_SUBST(LDFLAGS)dnl
  218.  
  219. AC_PROG_CPP                 dnl Figure out how to run C preprocessor.
  220. AC_PROG_GCC_TRADITIONAL     dnl Do we need -traditional flag for gcc.
  221. AC_C_CONST                  dnl Does compiler support `const'.
  222. fp_C_PROTOTYPES             dnl Does compiler support ANSI prototypes.
  223. AC_CHECK_SIZEOF(long, 8)    dnl number of bytes in a long.
  224.  
  225. dnl If the compiler supports union initialisation
  226. AC_CACHE_CHECK(if the compiler supports union initialisation,
  227. zsh_cv_c_have_union_init,
  228. [AC_TRY_COMPILE([union{void *p;long l;}u={0};], [u.l=1;],
  229.   zsh_cv_c_have_union_init=yes,
  230.   zsh_cv_c_have_union_init=no)])
  231. if test $zsh_cv_c_have_union_init = yes; then
  232.   AC_DEFINE(HAVE_UNION_INIT)
  233. fi
  234.  
  235. dnl  Checking if compiler correctly cast signed to unsigned.
  236. AC_CACHE_CHECK(if signed to unsigned casting is broken,
  237. zsh_cv_c_broken_signed_to_unsigned_casting,
  238. [AC_TRY_RUN([main(){return((int)(unsigned char)((char) -1) == 255);}],
  239.   zsh_cv_c_broken_signed_to_unsigned_casting=yes,
  240.   zsh_cv_c_broken_signed_to_unsigned_casting=no,
  241.   zsh_cv_c_broken_signed_to_unsigned_casting=no)])
  242. if test $zsh_cv_c_broken_signed_to_unsigned_casting = yes; then
  243.   AC_DEFINE(BROKEN_SIGNED_TO_UNSIGNED_CASTING)
  244. fi
  245.  
  246. dnl ------------------
  247. dnl CHECK FOR PROGRAMS
  248. dnl ------------------
  249. AC_PROG_MAKE_SET            dnl Does make define $MAKE
  250. AC_PROG_INSTALL             dnl Check for BSD compatible `install'
  251. AC_PROG_AWK                 dnl Check for mawk,gawk,nawk, then awk.
  252.  
  253. dnl ------------------
  254. dnl CHECK HEADER FILES
  255. dnl ------------------
  256. AC_HEADER_DIRENT
  257. AC_HEADER_STDC
  258. AC_HEADER_TIME
  259. AC_HEADER_STAT
  260. AC_HEADER_SYS_WAIT
  261. AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
  262.          termios.h sys/param.h sys/filio.h string.h memory.h \
  263.          limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
  264.          locale.h errno.h stdlib.h unistd.h)
  265.  
  266. dnl Some SCO systems cannot include both sys/time.h and sys/select.h
  267. if test $ac_cv_header_sys_time_h = yes -a $ac_cv_header_sys_select_h = yes; then
  268.   AC_CACHE_CHECK(for conflicts in sys/time.h and sys/select.h,
  269.   zsh_cv_header_time_h_select_h_conflicts,
  270.   [AC_TRY_COMPILE([#include <sys/time.h>
  271. #include <sys/select.h>], [int i;],
  272.   zsh_cv_header_time_h_select_h_conflicts=no,
  273.   zsh_cv_header_time_h_select_h_conflicts=yes)])
  274.   if test $zsh_cv_header_time_h_select_h_conflicts = yes; then
  275.     AC_DEFINE(TIME_H_SELECT_H_CONFLICTS)
  276.   fi
  277. fi
  278.  
  279. AC_CACHE_CHECK(ut_host in struct utmp, zsh_cv_struct_utmp_ut_host,
  280. [AC_TRY_COMPILE(
  281. [#include <sys/types.h>
  282. #include <utmp.h>], [struct utmp ut; ut.ut_host;],
  283. zsh_cv_struct_utmp_ut_host=yes, zsh_cv_struct_utmp_ut_host=no)])
  284. if test $zsh_cv_struct_utmp_ut_host = yes; then
  285.   have_ut_host=1
  286.   AC_DEFINE(HAVE_UT_HOST)
  287. fi
  288.  
  289. if test -z "$have_ut_host"; then
  290.   AC_CACHE_CHECK(ut_host in struct utmpx, zsh_cv_struct_utmpx_ut_host,
  291.   [AC_TRY_COMPILE([#include <sys/types.h>
  292. #include <utmpx.h>], [struct utmpx ut; ut.ut_host;],
  293.   zsh_cv_struct_utmpx_ut_host=yes, zsh_cv_struct_utmpx_ut_host=no)])
  294.   if test $zsh_cv_struct_utmpx_ut_host = yes; then
  295.     AC_DEFINE(HAVE_UTMPX_H)
  296.     AC_DEFINE(HAVE_UT_HOST)
  297.   fi
  298. fi
  299.  
  300. AC_CACHE_CHECK(POSIX termios, zsh_cv_sys_posix_termios,
  301. [AC_TRY_LINK([#include <sys/types.h>
  302. #include <unistd.h>
  303. #include <termios.h>],
  304. [/* SunOS 4.0.3 has termios.h but not the library calls.  */
  305. tcgetattr(0, 0);],
  306.   zsh_cv_sys_posix_termios=yes, zsh_cv_sys_posix_termios=no)])
  307.  
  308. if test $zsh_cv_sys_posix_termios = yes; then
  309.   AC_CACHE_CHECK(TIOCGWINSZ in termios.h,
  310.   zsh_cv_header_termios_h_tiocgwinsz,
  311.   [AC_TRY_LINK([#include <sys/types.h>
  312. #include <termios.h>],
  313.   [int x = TIOCGWINSZ;],
  314.   zsh_cv_header_termios_h_tiocgwinsz=yes,
  315.   zsh_cv_header_termios_h_tiocgwinsz=no)])
  316. else
  317.   zsh_cv_header_termios_h_tiocgwinsz=no
  318. fi
  319.  
  320. if test $zsh_cv_header_termios_h_tiocgwinsz = no; then
  321.   AC_CACHE_CHECK(TIOCGWINSZ in sys/ioctl.h,
  322.   zsh_cv_header_sys_ioctl_h_tiocgwinsz,
  323.   [AC_TRY_LINK([#include <sys/types.h>
  324. #include <sys/ioctl.h>],
  325.   [int x = TIOCGWINSZ;],
  326.   zsh_cv_header_sys_ioctl_h_tiocgwinsz=yes,
  327.   zsh_cv_header_sys_ioctl_h_tiocgwinsz=no)])
  328.   if test $zsh_cv_header_sys_ioctl_h_tiocgwinsz = yes; then
  329.     AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
  330.   fi
  331. fi
  332.  
  333. AC_CHECK_HEADER([sys/ptem.h], AC_DEFINE(WINSIZE_IN_PTEM))
  334.  
  335. dnl -------------------
  336. dnl CHECK FOR LIBRARIES
  337. dnl -------------------
  338. dnl Prefer BSD termcap library to SysV curses library,
  339. dnl except on AIX and HP-UX 10.x.
  340. case $host_os in
  341.   aix* | hpux10* ) termcap_curses_order="curses ncurses termcap";;
  342.   *)               termcap_curses_order="termcap curses ncurses";;
  343. esac
  344.  
  345. for lib in $termcap_curses_order; do
  346.   AC_CHECK_LIB(${lib}, tgetent, [LIBS="$LIBS -l$lib"; break])
  347. done
  348.  
  349. dnl Some systems (Solaris 2.x) require libnsl (Network Services Library)
  350. dnl to find getdomainname and yp_all
  351. AC_CHECK_FUNCS(getdomainname)
  352. if test $ac_cv_func_getdomainname = no; then
  353.   AC_CHECK_LIB(nsl, getdomainname)
  354. fi
  355.  
  356. dnl I am told that told that unicos reqire these for nis_list
  357. if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then
  358.   LIBS="-lcraylm -lkrb -lnisdb -lnsl -lrpcsvc $LIBS"
  359. fi
  360.  
  361. dnl ---------------------
  362. dnl CHECK TERMCAP LIBRARY
  363. dnl ---------------------
  364. dnl Checks for external variable ospeed in the termcap library.
  365. AC_CACHE_CHECK(if an include file defines ospeed,
  366. zsh_cv_decl_ospeed_include_defines,
  367. [AC_TRY_LINK(
  368. [#include <sys/types.h>
  369. #if HAVE_TERMIOS_H
  370. #include <termios.h>
  371. #endif
  372. #if HAVE_TERMCAP_H
  373. #include <termcap.h>
  374. #endif], [ospeed = 0;],
  375. zsh_cv_decl_ospeed_include_defines=yes,
  376. zsh_cv_decl_ospeed_include_defines=no)])
  377.  
  378. if test $zsh_cv_decl_ospeed_include_defines = no; then
  379.   AC_CACHE_CHECK(if you must define ospeed,
  380.   zsh_cv_decl_ospeed_must_define,
  381.   [AC_TRY_LINK( ,[extern short ospeed; ospeed = 0;],
  382.   zsh_cv_decl_ospeed_must_define=yes,
  383.   zsh_cv_decl_ospeed_must_define=no)])
  384. fi
  385.  
  386. if test $zsh_cv_decl_ospeed_include_defines = yes; then
  387.   AC_DEFINE(HAVE_OSPEED)
  388. elif test $zsh_cv_decl_ospeed_must_define = yes; then
  389.   AC_DEFINE(HAVE_OSPEED)
  390.   AC_DEFINE(MUST_DEFINE_OSPEED)
  391. fi
  392.  
  393. dnl  Check if tgetent accepts NULL (and will allocate its own termcap buffer)
  394. AC_CACHE_CHECK(if tgetent accepts NULL,
  395. zsh_cv_func_tgetent_accepts_null,
  396. [AC_TRY_RUN([main(){int i = tgetent((char*)0,"vt100");exit(!i || i == -1);}],
  397.   zsh_cv_func_tgetent_accepts_null=yes,
  398.   zsh_cv_func_tgetent_accepts_null=no,
  399.   zsh_cv_func_tgetent_accepts_null=no)])
  400. if test $zsh_cv_func_tgetent_accepts_null = yes; then
  401.   AC_DEFINE(TGETENT_ACCEPTS_NULL)
  402. fi
  403.  
  404. dnl --------------
  405. dnl CHECK TYPEDEFS
  406. dnl --------------
  407. AC_TYPE_SIGNAL
  408. AC_TYPE_PID_T
  409. AC_TYPE_OFF_T
  410. AC_TYPE_MODE_T
  411. AC_TYPE_UID_T
  412. AC_TYPE_SIZE_T
  413.  
  414. dnl Check for sigset_t.  Currently I'm looking in
  415. dnl <sys/types.h> and <signal.h>.  Others might need
  416. dnl to be added.
  417. AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
  418. [AC_TRY_COMPILE(
  419. [#include <sys/types.h>
  420. #include <signal.h>], [sigset_t tempsigset;],
  421.   zsh_cv_type_sigset_t=yes, zsh_cv_type_sigset_t=no)])
  422. if test $zsh_cv_type_sigset_t = no; then
  423.   AC_DEFINE(sigset_t, unsigned int)
  424. fi
  425.  
  426. dnl Check for struct timezone since some old SCO versions do not define it
  427. AC_CACHE_CHECK(for struct timezone, zsh_cv_struct_timezone,
  428. [AC_TRY_COMPILE(
  429. [#include <sys/time.h>], [struct timezone dummy_tz;],
  430.   zsh_cv_struct_timezone=yes, zsh_cv_struct_timezone=no)])
  431. if test $zsh_cv_struct_timezone = yes; then
  432.   AC_DEFINE(HAVE_STRUCT_TIMEZONE)
  433. fi
  434.  
  435. dnl ---------------
  436. dnl CHECK FUNCTIONS
  437. dnl ---------------
  438. AC_FUNC_GETPGRP
  439. AC_FUNC_STRCOLL
  440.  
  441. dnl need to integrate this function
  442. dnl AC_FUNC_STRFTIME
  443.  
  444. AC_CHECK_FUNCS(strftime waitpid select tcsetpgrp tcgetattr strstr lstat \
  445.               getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime \
  446.               sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit \
  447.               sigprocmask setuid seteuid setreuid setresuid strerror nis_list \
  448.               initgroups)
  449.  
  450.  
  451. dnl -------------
  452. dnl CHECK SIGNALS
  453. dnl -------------
  454. dnl What style of signal do you have (POSIX, BSD, or SYSV)?
  455. AC_MSG_CHECKING(what style of signals to use)
  456. if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
  457.   signals_style=POSIX_SIGNALS
  458.   AC_DEFINE(POSIX_SIGNALS)
  459. elif test $ac_cv_func_sigblock = yes -a $ac_cv_func_sigsetmask = yes; then
  460.   signals_style=BSD_SIGNALS
  461.   AC_DEFINE(BSD_SIGNALS)
  462. elif test $ac_cv_func_sighold = yes -a $ac_cv_func_sigrelse = yes; then
  463.   signals_style=SYSV_SIGNALS
  464.   AC_DEFINE(SYSV_SIGNALS)
  465. else
  466.   signals_style=NO_SIGNAL_BLOCKING
  467.   AC_DEFINE(NO_SIGNAL_BLOCKING)
  468. fi
  469. AC_DEFINE_UNQUOTED($signals_style)
  470. AC_MSG_RESULT($signals_style)
  471.  
  472. dnl Where is <signal.h> located?  Needed as input for signals.awk
  473. AC_CACHE_CHECK(where signal.h is located, zsh_cv_path_signal_h,
  474. [for SIGNAL_H in /usr/include/bsd/sys/signal.h  dnl Next
  475.                  /usr/include/asm/signum.h      dnl alpha-Linux
  476.                  /usr/include/asm/signal.h      dnl Linux 1.3.0 and above
  477.                  /usr/include/linux/signal.h    dnl Linux up to 1.2.11
  478.                  /usr/include/sys/signal.h      dnl Almost everybody else
  479.                  /dev/null;                     dnl Just in case we fall through
  480. do
  481.   test -f $SIGNAL_H && \
  482.   grep '#[     ]*define[     ][     ]*SIG[0-9A-Z]*[     ]*[0-9][0-9]*' $SIGNAL_H > /dev/null && \
  483.   break
  484. done
  485. zsh_cv_path_signal_h=$SIGNAL_H
  486. ])
  487. SIGNAL_H=$zsh_cv_path_signal_h
  488. AC_SUBST(SIGNAL_H)dnl
  489.  
  490. dnl -----------------------------------------------------
  491. dnl Look for the file containing the RLIMIT_* definitions
  492. dnl -----------------------------------------------------
  493. dnl CALL FOR MORE (FEWER?) LOCATIONS:  I've just copied the signal checking.
  494. AC_CACHE_CHECK(where the RLIMIT macros are located,zsh_cv_path_rlimit_h,
  495. [for RESOURCE_H in /usr/include/bsd/sys/resource.h   dnl
  496.                    /usr/include/asm/resource.h         dnl
  497.                    /usr/include/linux/resource.h     dnl
  498.                    /usr/include/sys/resource.h       dnl
  499.                    /usr/include/resourcebits.h       dnl
  500.                    /dev/null;
  501. do
  502.   test -f $RESOURCE_H && \
  503.   grep '#[     ]*define[     ][     ]*RLIMIT_[A-Z]*[     ]*[0-9A-Z][0-9]*' $RESOURCE_H > /dev/null && \
  504.   break
  505. done
  506. zsh_cv_path_rlimit_h=$RESOURCE_H
  507. if test $RESOURCE_H = "/dev/null" -a $ac_cv_func_getrlimit = yes; then
  508.   echo "RLIMIT MACROS NOT FOUND:  please report to developers"
  509. fi])
  510. RLIMITS_INC_H=$zsh_cv_path_rlimit_h
  511. dnl rlimits.h only appears in dependencies if we are actually using it.
  512. dnl We are using it any time we have getrlimit, though if the macros were
  513. dnl not found we simply awk through /dev/null and fail to find them.
  514. dnl Thus, limit won't work, but at least the shell will compile.
  515. if test $zsh_cv_path_rlimit_h = /dev/null -a $ac_cv_func_getrlimit = no; then
  516.   RLIMITS_SRC_H=
  517. else
  518.   RLIMITS_SRC_H=rlimits.h
  519. fi
  520. AC_SUBST(RLIMITS_SRC_H)dnl
  521. AC_SUBST(RLIMITS_INC_H)dnl
  522.  
  523. dnl ------------------
  524. dnl rlimit type checks
  525. dnl ------------------
  526. DEFAULT_RLIM_T=long
  527. AC_CACHE_CHECK(if rlim_t is quad_t,
  528. zsh_cv_rlim_t_is_quad_t,
  529. [AC_TRY_RUN([
  530. #ifdef HAVE_SYS_TIME_H
  531. #include <sys/time.h>
  532. #endif
  533. #include <sys/resource.h>
  534. main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}],
  535. zsh_cv_rlim_t_is_quad_t=yes,
  536. zsh_cv_rlim_t_is_quad_t=no,
  537. zsh_cv_rlim_t_is_quad_t=yes)])
  538. if test $zsh_cv_rlim_t_is_quad_t = yes; then
  539.   AC_DEFINE(RLIM_T_IS_QUAD_T)
  540.   DEFAULT_RLIM_T=quad_t
  541. else
  542.   AC_CACHE_CHECK(if the rlim_t is unsigned,
  543.   zsh_cv_type_rlim_t_is_unsigned,
  544.   [AC_TRY_RUN([
  545. #ifdef HAVE_SYS_TIME_H
  546. #include <sys/time.h>
  547. #endif
  548. #include <sys/resource.h>
  549.   main(){struct rlimit r;r.rlim_cur=-1;exit(r.rlim_cur<0);}],
  550.   zsh_cv_type_rlim_t_is_unsigned=yes,
  551.   zsh_cv_type_rlim_t_is_unsigned=no,
  552.   zsh_cv_type_rlim_t_is_unsigned=no)])
  553.   if test $zsh_cv_type_rlim_t_is_unsigned = yes; then
  554.     AC_DEFINE(RLIM_T_IS_UNSIGNED)
  555.     DEFAULT_RLIM_T="unsigned $DEFAULT_RLIM_T"
  556.   fi
  557. fi
  558.  
  559. AC_CACHE_CHECK(for rlim_t, zsh_cv_type_rlim_t,
  560. [AC_TRY_COMPILE([
  561. #include <sys/types.h>
  562. #ifdef HAVE_SYS_TIME_H
  563. #include <sys/time.h>
  564. #endif
  565. #include <sys/resource.h>],
  566. [rlim_t l;],
  567. zsh_cv_type_rlim_t=yes,
  568. zsh_cv_type_rlim_t=no)])
  569. if test $zsh_cv_type_rlim_t = no; then
  570.   AC_DEFINE_UNQUOTED(rlim_t, $DEFAULT_RLIM_T)
  571. fi
  572.  
  573. dnl ----------------------------
  574. dnl CHECK FOR /dev/fd FILESYSTEM
  575. dnl ----------------------------
  576. AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
  577. [for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
  578.    test x`echo ok|cat $zsh_cv_sys_path_dev_fd/0 2>/dev/null` = xok && break
  579.  done])
  580. if test $zsh_cv_sys_path_dev_fd != no; then
  581.   AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd")
  582. fi
  583.  
  584. dnl ---------------------------------
  585. dnl CHECK FOR RFS SUPERROOT DIRECTORY
  586. dnl ---------------------------------
  587. AC_CACHE_CHECK(for RFS superroot directory, zsh_cv_sys_superroot,
  588. [test -d /../.LOCALROOT && zsh_cv_sys_superroot=yes || zsh_cv_sys_superroot=no])
  589. if test $zsh_cv_sys_superroot = yes; then
  590.   AC_DEFINE(HAVE_SUPERROOT)
  591. fi
  592.  
  593. dnl -------------
  594. dnl CHECK FOR NIS
  595. dnl -------------
  596. AC_CACHE_CHECK(for NIS, zsh_cv_sys_nis,
  597. [test -f /usr/bin/ypcat && /usr/bin/ypcat passwd.byname > /dev/null 2>&1 && \
  598. zsh_cv_sys_nis=yes || zsh_cv_sys_nis=no])
  599. if test $zsh_cv_sys_nis = yes; then
  600.   AC_DEFINE(HAVE_NIS)
  601. fi
  602.  
  603. dnl -----------------
  604. dnl CHECK FOR NISPLUS
  605. dnl -----------------
  606. AC_CACHE_CHECK(for NIS+, zsh_cv_sys_nis_plus,
  607. [test $ac_cv_func_nis_list = yes && test -f /usr/bin/nisls && \
  608.  /usr/bin/nisls > /dev/null 2>&1 && \
  609. zsh_cv_sys_nis_plus=yes || zsh_cv_sys_nis_plus=no])
  610. if test $zsh_cv_sys_nis_plus = yes; then
  611.   AC_DEFINE(HAVE_NIS_PLUS)
  612. fi
  613.  
  614. dnl -------------------------------
  615. dnl CHECK FOR LOCATION OF UTMP FILE
  616. dnl -------------------------------
  617. AC_CACHE_CHECK(where utmp is located, zsh_cv_path_utmp,
  618. [for utmp_file in /etc/utmp      dnl
  619.                  /usr/etc/utmp   dnl
  620.                  /var/adm/utmp   dnl
  621.                  /usr/adm/utmp   dnl
  622.                  /var/run/utmp   dnl
  623.                  /dev/null;      dnl Just in case we fall through
  624. do
  625.   test -f $utmp_file && break
  626. done
  627. zsh_cv_path_utmp=$utmp_file
  628. ])
  629. AC_DEFINE_UNQUOTED(UTMP_FILE_CONFIG, "$zsh_cv_path_utmp")
  630.  
  631. dnl -------------------------------
  632. dnl CHECK FOR LOCATION OF WTMP FILE
  633. dnl -------------------------------
  634. AC_CACHE_CHECK(where wtmp is located, zsh_cv_path_wtmp,
  635. [for wtmp_file in /etc/wtmp     dnl
  636.                  /usr/etc/wtmp  dnl
  637.                  /var/adm/wtmp  dnl
  638.                  /usr/adm/wtmp  dnl
  639.                  /var/log/wtmp  dnl
  640.                  /dev/null;     dnl Just in case we fall through
  641. do
  642.   test -f $wtmp_file && break
  643. done
  644. zsh_cv_path_wtmp=$wtmp_file
  645. ])
  646. AC_DEFINE_UNQUOTED(WTMP_FILE_CONFIG, "$zsh_cv_path_wtmp")
  647.  
  648. dnl ----------------
  649. dnl TYPEAHEAD KLUDGE
  650. dnl ----------------
  651. dnl Some systems clobber typeahead when you go from canonical input
  652. dnl processing to non-canonical, so we need a FIONREAD ioctl.
  653. dnl I don't know how to check this with configure, so I am using the
  654. dnl system names directly.
  655. dnl The doubled square brackets are necessary because autoconf uses m4.
  656. AC_CACHE_CHECK(if typeahead needs FIONREAD, zsh_cv_sys_clobbers_typeahead,
  657. [case x-$host_os in
  658.     x-ultrix* | x-dgux*)
  659.     zsh_cv_sys_clobbers_typeahead=yes;;
  660.     *)
  661.     zsh_cv_sys_clobbers_typeahead=no;;
  662. esac])
  663. if test $zsh_cv_sys_clobbers_typeahead = yes; then
  664.   AC_DEFINE(CLOBBERS_TYPEAHEAD)
  665. fi
  666.  
  667. dnl -------------------
  668. dnl brk/sbrk PROTOTYPES
  669. dnl -------------------
  670. AC_CACHE_CHECK(for brk() prototype in <unistd.h>,
  671. zsh_cv_header_unistd_h_brk_proto,
  672. [AC_TRY_COMPILE([#include <unistd.h>
  673. double brk();], [int i;],
  674. zsh_cv_header_unistd_h_brk_proto=no, zsh_cv_header_unistd_h_brk_proto=yes)])
  675. if test $zsh_cv_header_unistd_h_brk_proto = yes; then
  676.   AC_DEFINE(HAVE_BRK_PROTO)
  677. fi
  678.  
  679. AC_CACHE_CHECK(for sbrk() prototype in <unistd.h>,
  680. zsh_cv_header_unistd_h_sbrk_proto,
  681. [AC_TRY_COMPILE([#include <unistd.h>
  682. double sbrk();], [int i;],
  683. zsh_cv_header_unistd_h_sbrk_proto=no, zsh_cv_header_unistd_h_sbrk_proto=yes)])
  684. if test $zsh_cv_header_unistd_h_sbrk_proto = yes; then
  685.   AC_DEFINE(HAVE_SBRK_PROTO)
  686. fi
  687.  
  688. dnl ------------------------
  689. dnl ioctl prototypes for OSF
  690. dnl ------------------------
  691.  
  692. if test "$ac_cv_prog_cc_stdc" != no; then
  693.   AC_CACHE_CHECK(for ioctl prototype in <sys/ioctl.h>,
  694.   zsh_cv_header_sys_ioctl_h_ioctl_proto,
  695.   [AC_TRY_COMPILE([#include <sys/ioctl.h>
  696.    int ioctl(double x);], [int i;],
  697.   zsh_cv_header_sys_ioctl_h_ioctl_proto=no,
  698.   zsh_cv_header_sys_ioctl_h_ioctl_proto=yes)])
  699.   if test $zsh_cv_header_sys_ioctl_h_ioctl_proto = yes; then
  700.     AC_DEFINE(HAVE_IOCTL_PROTO)
  701.   fi
  702. fi
  703.  
  704. dnl -----------
  705. dnl named FIFOs
  706. dnl -----------
  707. AC_CACHE_CHECK(if named FIFOs work,
  708. zsh_cv_sys_fifo,
  709. [AC_TRY_RUN([
  710. #include <fcntl.h>
  711. #include <signal.h>
  712. main()
  713. {
  714.     char c;
  715.     int fd;
  716.     int pid, ret;
  717.     unlink("/tmp/fifo$$");
  718. #ifdef HAVE_MKFIFO
  719.     if(mkfifo("/tmp/fifo$$", 0600) < 0)
  720. #else
  721.     if(mknod("/tmp/fifo$$", 0010600, 0) < 0)
  722. #endif
  723.     exit(1);
  724.     pid = fork();
  725.     if(pid < 0)
  726.     exit(1);
  727.     if(pid) {
  728.     fd = open("/tmp/fifo$$", O_RDONLY);
  729.     exit(fd < 0 || read(fd, &c, 1) != 1 || c != 'x');
  730.     }
  731.     fd = open("/tmp/fifo$$", O_WRONLY);
  732.     ret = (fd < 0 || write(fd, "x", 1) < 1);
  733.     unlink("/tmp/fifo$$");
  734.     exit(ret);
  735. }
  736. ],
  737.   zsh_cv_sys_fifo=yes,
  738.   zsh_cv_sys_fifo=no,
  739.   zsh_cv_sys_fifo=yes)])
  740. if test $zsh_cv_sys_fifo = yes; then
  741.   AC_DEFINE(HAVE_FIFOS)
  742. fi
  743. dnl ---------------------
  744. dnl echo style of /bin/sh
  745. dnl ---------------------
  746. AC_CACHE_CHECK(if echo in /bin/sh interprets escape sequences,
  747. zsh_cv_prog_sh_echo_escape,
  748. [if test "`/bin/sh -c \"echo '\\n'\"`" = "\\n"; then
  749.   zsh_cv_prog_sh_echo_escape=no
  750. else
  751.   zsh_cv_prog_sh_echo_escape=yes
  752. fi])
  753. if test $zsh_cv_prog_sh_echo_escape = no; then
  754.   AC_DEFINE(SH_USE_BSD_ECHO)
  755. fi
  756.  
  757. AC_OUTPUT(Makefile Src/Makefile Doc/Makefile Etc/Makefile Misc/Makefile \
  758. Util/Makefile Functions/Makefile StartupFiles/Makefile, \
  759. [test -z "$CONFIG_HEADERS" || echo > stamp-h])
  760.  
  761. eval "zshbin1=${bindir}"
  762. eval "zshbin2=${zshbin1}"
  763. eval "zshman=${mandir}"
  764. eval "zshinfo=${infodir}"
  765.  
  766. echo "
  767. zsh configuration
  768. -----------------
  769. zsh version           : ${VERSION}
  770. host operating system : ${host_os}
  771. source code location  : ${srcdir}
  772. compiler              : ${CC}
  773. compiler flags        : ${CFLAGS}
  774. binary install path   : ${zshbin2}
  775. man page install path : ${zshman}
  776. info install path     : ${zshinfo}"
  777. echo ""
  778.  
  779.