home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / the25.zip / thesrc251.zip / aclocal.m4 next >
M4 Source File  |  1998-07-29  |  20KB  |  870 lines

  1. dnl ---------------------------------------------------------------------------
  2. dnl Determine if curses library supports various functions
  3. dnl ---------------------------------------------------------------------------
  4. AC_DEFUN([MH_CURSES_FUNCS],
  5. [
  6. dnl
  7. dnl Ensure that when compiling with XCurses, we have set the
  8. dnl required extern for program name.
  9. dnl
  10. cat > xxxxx.h <<EOF
  11. #ifdef XCURSES
  12.     char *XCursesProgramName="test";
  13. #endif
  14. EOF
  15. dnl
  16. dnl Include before curses.h any include files required. This is
  17. dnl often stdarg.h
  18. dnl
  19. for incfile in $mh_pre_curses_h_include ; do
  20.     echo "#include <$incfile.h>" >> xxxxx.h
  21. done
  22.  
  23. mh_save_libs="$LIBS"
  24. mh_save_cflags="$CFLAGS"
  25.  
  26. if test "$curses_l" = "XCurses"; then
  27.     CFLAGS="-DXCURSES $MH_CURSES_INC"
  28.     LIBS="$LIBS $MH_CURSES_LIB $MH_XLIBS"
  29. else
  30.     CFLAGS="$MH_CURSES_INC"
  31.     LIBS="$LIBS $MH_CURSES_LIB"
  32. fi
  33.  
  34. AC_MSG_CHECKING(for System V curses)
  35. AC_CACHE_VAL(
  36. [mh_cv_sysv_curses],
  37. [
  38. AC_TRY_COMPILE(
  39. [#include "xxxxx.h"]
  40. [#include <$curses_h>],
  41. [long xxx=(long)A_NORMAL],
  42. [mh_cv_sysv_curses=yes],
  43. [mh_cv_sysv_curses=no]
  44. )
  45. ])dnl
  46. AC_MSG_RESULT($mh_cv_sysv_curses)
  47. if test "$mh_cv_sysv_curses" = no ; then
  48.     AC_DEFINE(HAVE_BSD_CURSES)
  49. fi
  50.  
  51. if test "$mh_cv_sysv_curses" = no ; then
  52.     if test "$with_extcurses" = no ; then
  53.         MH_CURSES_LIB="$MH_CURSES_LIB -ltermcap"
  54.         LIBS="$LIBS -ltermcap"
  55.     fi
  56. fi
  57.  
  58. dnl
  59. dnl If HAVE_BSD_CURSES, define BSD_STANDOUT as one of:
  60. dnl _STANDOUT, __WSTANDOUT or __STANDOUT
  61. dnl
  62. if test "$mh_cv_sysv_curses" = no ; then
  63.     bsd_standouts="_STANDOUT __WSTANDOUT __STANDOUT"
  64.     for sout in $bsd_standouts ; do
  65. AC_TRY_COMPILE(
  66. [#include <$curses_h>],
  67. [int xxx=$sout],
  68.     [mh_bsd_sout=yes],
  69.     [mh_bsd_sout=no]
  70.     )
  71.         if test "$mh_bsd_sout" = yes ; then
  72.             AC_DEFINE_UNQUOTED(BSD_STANDOUT,$sout)
  73.             break 2
  74.         fi
  75.     done
  76. fi
  77.  
  78. AC_MSG_CHECKING(for wattrset in $curses_l library)
  79. AC_CACHE_VAL(
  80. [mh_cv_func_wattrset],
  81. [
  82.     AC_TRY_LINK(
  83. [#include "xxxxx.h"]
  84. [#include <$curses_h>],
  85. [wattrset(stdscr,0)],
  86.     [mh_cv_func_wattrset=yes],
  87.     [mh_cv_func_wattrset=no]
  88.     )
  89. ])dnl
  90. AC_MSG_RESULT($mh_cv_func_wattrset)
  91. if test "$mh_cv_func_wattrset" = yes ; then
  92.     AC_DEFINE(HAVE_WATTRSET)
  93. fi
  94.  
  95. AC_MSG_CHECKING(for keypad in $curses_l library)
  96. AC_CACHE_VAL(
  97. [mh_cv_func_keypad],
  98. [
  99.     AC_TRY_LINK(
  100. [#include "xxxxx.h"]
  101. [#include <$curses_h>],
  102. [keypad(stdscr,TRUE)],
  103.     [mh_cv_func_keypad=yes],
  104.     [mh_cv_func_keypad=no]
  105.     )
  106. ])dnl
  107. AC_MSG_RESULT($mh_cv_func_keypad)
  108. if test "$mh_cv_func_keypad" = yes ; then
  109.     AC_DEFINE(HAVE_KEYPAD)
  110. fi
  111.  
  112. AC_MSG_CHECKING(for beep in $curses_l library)
  113. AC_CACHE_VAL(
  114. [mh_cv_func_beep],
  115. [
  116.     AC_TRY_LINK(
  117. [#include "xxxxx.h"]
  118. [#include <$curses_h>],
  119. [beep()],
  120.     [mh_cv_func_beep=yes],
  121.     [mh_cv_func_beep=no]
  122.     )
  123. ])dnl
  124. AC_MSG_RESULT($mh_cv_func_beep)
  125. if test "$mh_cv_func_beep" = yes ; then
  126.     AC_DEFINE(HAVE_BEEP)
  127. fi
  128.  
  129. AC_MSG_CHECKING(for curs_set in $curses_l library)
  130. AC_CACHE_VAL(
  131. [mh_cv_func_curs_set],
  132. [
  133.     AC_TRY_LINK(
  134. [#include "xxxxx.h"]
  135. [#include <$curses_h>],
  136. [curs_set(0)],
  137.     [mh_cv_func_curs_set=yes],
  138.     [mh_cv_func_curs_set=no]
  139.     )
  140. ])dnl
  141. AC_MSG_RESULT($mh_cv_func_curs_set)
  142. if test "$mh_cv_func_curs_set" = yes ; then
  143.     AC_DEFINE(HAVE_CURS_SET)
  144. fi
  145.  
  146. AC_MSG_CHECKING(for touchline in $curses_l library)
  147. AC_CACHE_VAL(
  148. [mh_cv_func_touchline],
  149. [
  150.     AC_TRY_LINK(
  151. [#include "xxxxx.h"]
  152. [#include <$curses_h>],
  153. [touchline(stdscr,1,1)],
  154.     [mh_cv_func_touchline=yes],
  155.     [mh_cv_func_touchline=no]
  156.     )
  157. ])dnl
  158. AC_MSG_RESULT($mh_cv_func_touchline)
  159. if test "$mh_cv_func_touchline" = yes ; then
  160.     AC_DEFINE(HAVE_TOUCHLINE)
  161. fi
  162.  
  163. AC_MSG_CHECKING(for typeahead in $curses_l library)
  164. AC_CACHE_VAL(
  165. [mh_cv_func_typeahead],
  166. [
  167.     AC_TRY_LINK(
  168. [#include "xxxxx.h"]
  169. [#include <$curses_h>],
  170. [typeahead(1)],
  171.     [mh_cv_func_typeahead=yes],
  172.     [mh_cv_func_typeahead=no]
  173.     )
  174. ])dnl
  175. AC_MSG_RESULT($mh_cv_func_typeahead)
  176. if test "$mh_cv_func_typeahead" = yes ; then
  177.     AC_DEFINE(HAVE_TYPEAHEAD)
  178. fi
  179.  
  180. AC_MSG_CHECKING(for notimeout in $curses_l library)
  181. AC_CACHE_VAL(
  182. [mh_cv_func_notimeout],
  183. [
  184.     AC_TRY_LINK(
  185. [#include "xxxxx.h"]
  186. [#include <$curses_h>],
  187. [notimeout(stdscr,TRUE)],
  188.     [mh_cv_func_notimeout=yes],
  189.     [mh_cv_func_notimeout=no]
  190.     )
  191. ])dnl
  192. AC_MSG_RESULT($mh_cv_func_notimeout)
  193. if test "$mh_cv_func_notimeout" = yes ; then
  194.     AC_DEFINE(HAVE_NOTIMEOUT)
  195. fi
  196.  
  197. AC_MSG_CHECKING(for ungetch in $curses_l library)
  198. AC_CACHE_VAL(
  199. [mh_cv_func_ungetch],
  200. [
  201.     AC_TRY_LINK(
  202. [#include "xxxxx.h"]
  203. [#include <$curses_h>],
  204. [ungetch(10)],
  205.     [mh_cv_func_ungetch=yes],
  206.     [mh_cv_func_ungetch=no]
  207.     )
  208. ])dnl
  209. AC_MSG_RESULT($mh_cv_func_ungetch)
  210. if test "$mh_cv_func_ungetch" = yes ; then
  211.     AC_DEFINE(HAVE_UNGETCH)
  212. fi
  213.  
  214. AC_MSG_CHECKING(for nodelay in $curses_l library)
  215. AC_CACHE_VAL(
  216. [mh_cv_func_nodelay],
  217. [
  218.     AC_TRY_LINK(
  219. [#include "xxxxx.h"]
  220. [#include <$curses_h>],
  221. [nodelay(stdscr,TRUE)],
  222.     [mh_cv_func_nodelay=yes],
  223.     [mh_cv_func_nodelay=no]
  224.     )
  225. ])dnl
  226. AC_MSG_RESULT($mh_cv_func_nodelay)
  227. if test "$mh_cv_func_nodelay" = yes ; then
  228.     AC_DEFINE(HAVE_NODELAY)
  229. fi
  230.  
  231. AC_MSG_CHECKING(for raw in $curses_l library)
  232. AC_CACHE_VAL(
  233. [mh_cv_func_raw],
  234. [
  235.     AC_TRY_LINK(
  236. [#include "xxxxx.h"]
  237. [#include <$curses_h>],
  238. [raw()],
  239.     [mh_cv_func_raw=yes],
  240.     [mh_cv_func_raw=no]
  241.     )
  242. ])dnl
  243. AC_MSG_RESULT($mh_cv_func_raw)
  244. if test "$mh_cv_func_raw" = yes ; then
  245.     AC_DEFINE(HAVE_RAW)
  246. fi
  247.  
  248. AC_MSG_CHECKING(for cbreak in $curses_l library)
  249. AC_CACHE_VAL(
  250. [mh_cv_func_cbreak],
  251. [
  252.     AC_TRY_LINK(
  253. [#include "xxxxx.h"]
  254. [#include <$curses_h>],
  255. [cbreak()],
  256.     [mh_cv_func_cbreak=yes],
  257.     [mh_cv_func_cbreak=no]
  258.     )
  259. ])dnl
  260. AC_MSG_RESULT($mh_cv_func_cbreak)
  261. if test "$mh_cv_func_cbreak" = yes ; then
  262.     AC_DEFINE(HAVE_CBREAK)
  263. fi
  264.  
  265. AC_MSG_CHECKING(for nocbreak in $curses_l library)
  266. AC_CACHE_VAL(
  267. [mh_cv_func_nocbreak],
  268. [
  269.     AC_TRY_LINK(
  270. [#include "xxxxx.h"]
  271. [#include <$curses_h>],
  272. [nocbreak()],
  273.     [mh_cv_func_nocbreak=yes],
  274.     [mh_cv_func_nocbreak=no]
  275.     )
  276. ])dnl
  277. AC_MSG_RESULT($mh_cv_func_nocbreak)
  278. if test "$mh_cv_func_nocbreak" = yes ; then
  279.     AC_DEFINE(HAVE_NOCBREAK)
  280. fi
  281.  
  282. AC_MSG_CHECKING(for wnoutrefresh in $curses_l library)
  283. AC_CACHE_VAL(
  284. [mh_cv_func_wnoutrefresh],
  285. [
  286.     AC_TRY_LINK(
  287. [#include "xxxxx.h"]
  288. [#include <$curses_h>],
  289. [wnoutrefresh(stdscr)],
  290.     [mh_cv_func_wnoutrefresh=yes],
  291.     [mh_cv_func_wnoutrefresh=no]
  292.     )
  293. ])dnl
  294. AC_MSG_RESULT($mh_cv_func_wnoutrefresh)
  295. if test "$mh_cv_func_wnoutrefresh" = yes ; then
  296.     AC_DEFINE(HAVE_WNOUTREFRESH)
  297. fi
  298.  
  299. AC_MSG_CHECKING(for doupdate in $curses_l library)
  300. AC_CACHE_VAL(
  301. [mh_cv_func_doupdate],
  302. [
  303.     AC_TRY_LINK(
  304. [#include "xxxxx.h"]
  305. [#include <$curses_h>],
  306. [doupdate()],
  307.     [mh_cv_func_doupdate=yes],
  308.     [mh_cv_func_doupdate=no]
  309.     )
  310. ])dnl
  311. AC_MSG_RESULT($mh_cv_func_doupdate)
  312. if test "$mh_cv_func_doupdate" = yes ; then
  313.     AC_DEFINE(HAVE_DOUPDATE)
  314. fi
  315.  
  316. AC_MSG_CHECKING(for reset_shell_mode in $curses_l library)
  317. AC_CACHE_VAL(
  318. [mh_cv_func_reset_shell_mode],
  319. [
  320.     AC_TRY_LINK(
  321. [#include "xxxxx.h"]
  322. [#include <$curses_h>],
  323. [reset_shell_mode()],
  324.     [mh_cv_func_reset_shell_mode=yes],
  325.     [mh_cv_func_reset_shell_mode=no]
  326.     )
  327. ])dnl
  328. AC_MSG_RESULT($mh_cv_func_reset_shell_mode)
  329. if test "$mh_cv_func_reset_shell_mode" = yes ; then
  330.     AC_DEFINE(HAVE_RESET_SHELL_MODE)
  331. fi
  332.  
  333. AC_MSG_CHECKING(for reset_prog_mode in $curses_l library)
  334. AC_CACHE_VAL(
  335. [mh_cv_func_reset_prog_mode],
  336. [
  337.     AC_TRY_LINK(
  338. [#include "xxxxx.h"]
  339. [#include <$curses_h>],
  340. [reset_prog_mode()],
  341.     [mh_cv_func_reset_prog_mode=yes],
  342.     [mh_cv_func_reset_prog_mode=no]
  343.     )
  344. ])dnl
  345. AC_MSG_RESULT($mh_cv_func_reset_prog_mode)
  346. if test "$mh_cv_func_reset_prog_mode" = yes ; then
  347.     AC_DEFINE(HAVE_RESET_PROG_MODE)
  348. fi
  349.  
  350. AC_MSG_CHECKING(for slk_init in $curses_l library)
  351. AC_CACHE_VAL(
  352. [mh_cv_func_slk_init],
  353. [
  354.     AC_TRY_LINK(
  355. [#include "xxxxx.h"]
  356. [#include <$curses_h>],
  357. [slk_init(0)],
  358.     [mh_cv_func_slk_init=yes],
  359.     [mh_cv_func_slk_init=no]
  360.     )
  361. ])dnl
  362. AC_MSG_RESULT($mh_cv_func_slk_init)
  363. if test "$mh_cv_func_slk_init" = yes ; then
  364.     AC_DEFINE(HAVE_SLK_INIT)
  365. fi
  366.  
  367. AC_MSG_CHECKING(for slk_attrset in $curses_l library)
  368. AC_CACHE_VAL(
  369. [mh_cv_func_slk_attrset],
  370. [
  371.     AC_TRY_LINK(
  372. [#include "xxxxx.h"]
  373. [#include <$curses_h>],
  374. [slk_attrset(0)],
  375.     [mh_cv_func_slk_attrset=yes],
  376.     [mh_cv_func_slk_attrset=no]
  377.     )
  378. ])dnl
  379. AC_MSG_RESULT($mh_cv_func_slk_attrset)
  380. if test "$mh_cv_func_slk_attrset" = yes ; then
  381.     AC_DEFINE(HAVE_SLK_INIT)
  382. fi
  383.  
  384. AC_MSG_CHECKING(for sb_init in $curses_l library)
  385. AC_CACHE_VAL(
  386. [mh_cv_func_sb_init],
  387. [
  388.     AC_TRY_LINK(
  389. [#include "xxxxx.h"]
  390. [#include <$curses_h>],
  391. [sb_init()],
  392.     [mh_cv_func_sb_init=yes],
  393.     [mh_cv_func_sb_init=no]
  394.     )
  395. ])dnl
  396. AC_MSG_RESULT($mh_cv_func_sb_init)
  397. if test "$mh_cv_func_sb_init" = yes ; then
  398.     AC_DEFINE(HAVE_SB_INIT)
  399. fi
  400.  
  401. AC_MSG_CHECKING(for resize_term in $curses_l library)
  402. AC_CACHE_VAL(
  403. [mh_cv_func_resize_term],
  404. [
  405.     AC_TRY_LINK(
  406. [#include "xxxxx.h"]
  407. [#include <$curses_h>],
  408. [resize_term(0,0)],
  409.     [mh_cv_func_resize_term=yes],
  410.     [mh_cv_func_resize_term=no]
  411.     )
  412. ])dnl
  413. AC_MSG_RESULT($mh_cv_func_resize_term)
  414. if test "$mh_cv_func_resize_term" = yes ; then
  415.     AC_DEFINE(HAVE_RESIZE_TERM)
  416. fi
  417.  
  418. AC_MSG_CHECKING(for wvline in $curses_l library)
  419. AC_CACHE_VAL(
  420. [mh_cv_func_wvline],
  421. [
  422.     AC_TRY_LINK(
  423. [#include "xxxxx.h"]
  424. [#include <$curses_h>],
  425. [wvline(stdscr,0,1)],
  426.     [mh_cv_func_wvline=yes],
  427.     [mh_cv_func_wvline=no]
  428.     )
  429. ])dnl
  430. AC_MSG_RESULT($mh_cv_func_wvline)
  431. if test "$mh_cv_func_wvline" = yes ; then
  432.     AC_DEFINE(HAVE_WVLINE)
  433. fi
  434.  
  435. rm -f xxxxx.h
  436. LIBS="$mh_save_libs"
  437. CFLAGS="$mh_save_cflags"
  438. ])dnl
  439.  
  440. dnl ---------------------------------------------------------------------------
  441. dnl Determine if curses defines "chtype"
  442. dnl ---------------------------------------------------------------------------
  443. AC_DEFUN([MH_CHECK_CHTYPE],
  444. [
  445. mh_save_libs="$LIBS"
  446. mh_save_cflags="$CFLAGS"
  447.  
  448. cat > xxxxx.h <<EOF
  449. #ifdef XCURSES
  450.     char *XCursesProgramName="test";
  451. #endif
  452. EOF
  453. dnl
  454. dnl Include before curses.h any include files required. This is
  455. dnl often stdarg.h
  456. dnl
  457. for incfile in $mh_pre_curses_h_include ; do
  458.     echo "#include <$incfile.h>" >> xxxxx.h
  459. done
  460.  
  461. if test "$curses_l" = "xcurses"; then
  462.     CFLAGS="-DXCURSES $MH_CURSES_INC"
  463.     LIBS="$LIBS $MH_CURSES_LIB $MH_XLIBS"
  464. else
  465.     CFLAGS="$MH_CURSES_INC"
  466.     LIBS="$LIBS $MH_CURSES_LIB"
  467. fi
  468.  
  469. AC_MSG_CHECKING(if $curses_h defines "chtype")
  470. AC_TRY_COMPILE(
  471. [#include "xxxxx.h"]
  472. [#include <$curses_h>],
  473. [chtype xxx],
  474. [mh_have_chtype=yes],
  475. [mh_have_chtype=no;AC_DEFINE(chtype,int)]
  476. )
  477. rm -f xxxxx.h
  478. AC_MSG_RESULT($mh_have_chtype)
  479. LIBS="$mh_save_libs"
  480. CFLAGS="$mh_save_cflags"
  481. ])dnl
  482.  
  483. dnl ---------------------------------------------------------------------------
  484. dnl Check curses library and header files
  485. dnl ---------------------------------------------------------------------------
  486. AC_DEFUN([MH_CHECK_CURSES],
  487. [
  488. case "$target" in
  489.     *hpux*10*)
  490.             mh_curses_colr=yes
  491.             mh_pre_curses_h_include="stdarg"
  492.         ;;
  493.     *aix*4.2*)
  494.             mh_curses_colr=no
  495.             mh_pre_curses_h_include="stdarg"
  496.         ;;
  497.     *)
  498.             mh_curses_colr=no
  499.             mh_pre_curses_h_include=""
  500. esac
  501.  
  502. if test "$with_xcurses" = yes; then
  503.     AC_DEFINE(USE_XCURSES)
  504.     curses_h="xcurses.h"
  505.     curses_l="XCurses"
  506. else
  507.     if test "$with_ncurses" = yes; then
  508.         AC_DEFINE(USE_NCURSES)
  509.         curses_h="ncurses.h"
  510.         curses_l="ncurses"
  511.     else
  512.         if test "$with_extcurses" = yes; then
  513.             AC_DEFINE(USE_EXTCURSES)
  514.             curses_h="cur00.h"
  515.             curses_l="cur"
  516.         else
  517.             if test "$mh_curses_colr" = yes; then
  518.                 curses_h="curses.h"
  519.                 curses_l="cur_colr"
  520.             else
  521.                 curses_h="curses.h"
  522.                 curses_l="curses"
  523.             fi
  524.         fi
  525.     fi
  526. fi
  527.  
  528. dnl look for curses header and library, exit if not found
  529. AC_MSG_CHECKING(for location of $curses_h header file)
  530. mh_curses_inc_dir=""
  531. mh_inc_dirs="\
  532.     ${mh_sysv_incdir}         \
  533.     ${exec_prefix}/include    \
  534.     ${HOME}/include           \
  535.     /usr/local/include        \
  536.     /usr/contrib/include      \
  537.     /usr/include/curses_colr  \
  538.     /opt/include              \
  539.     /usr/include              \
  540.     /usr/ucbinclude           \
  541.     /usr/ucbinc               \
  542.     /usr/unsupported/include"
  543. dnl
  544. dnl Provide for user supplying directory
  545. dnl
  546. if test "$with_cursesincdir" != no ; then
  547.     mh_inc_dirs="$with_cursesincdir $mh_inc_dirs"
  548. fi
  549. dnl
  550. dnl Try to determine the directory containing curses header
  551. dnl
  552. for ac_dir in $mh_inc_dirs ; do
  553.   if test -r $ac_dir/$curses_h; then
  554.     mh_curses_inc_dir=$ac_dir
  555.     break
  556.   fi
  557. done
  558. if test "x$mh_curses_inc_dir" != "x" ; then
  559.     AC_MSG_RESULT(found in $mh_curses_inc_dir)
  560.     MH_CURSES_INC="-I$mh_curses_inc_dir"
  561. dnl
  562. dnl If using gcc under Solaris 2, don't use -I/usr/include
  563. dnl
  564. case "$target" in
  565.     *solaris*)
  566.         if test "$ac_cv_prog_gcc" = yes ; then
  567.             if test "x$mh_curses_inc_dir" = "x/usr/include" ; then
  568.             MH_CURSES_INC=""
  569.             fi
  570.         fi
  571.         ;;
  572. esac
  573.     AC_SUBST(MH_CURSES_INC)
  574. else
  575.     AC_MSG_ERROR(Cannot find curses header file: $curses_h; THE cannot be configured)
  576. fi
  577.  
  578. AC_MSG_CHECKING(for location of $curses_l library file)
  579. mh_curses_lib_dir=""
  580. mh_lib_dirs="\
  581.     ${mh_sysv_libdir}         \
  582.     ${exec_prefix}/lib        \
  583.     ${HOME}/lib               \
  584.     /usr/local/lib            \
  585.     /usr/contrib/lib          \
  586.     /opt/lib                  \
  587.     /usr/lib                  \
  588.     /usr/ccs/lib              \
  589.     /usr/ucblib               \
  590.     /usr/unsupported/lib"
  591. dnl
  592. dnl Provide for user supplying directory
  593. dnl
  594. if test "$with_curseslibdir" != no ; then
  595.     mh_lib_dirs="$with_curseslibdir $mh_lib_dirs"
  596. fi
  597. dnl
  598. dnl Try to determine the directory containing curses library
  599. dnl
  600. for ac_dir in $mh_lib_dirs ; do
  601.     for mh_ext in lib${curses_l}.a lib${curses_l}.so lib${curses_l}.sl; do
  602.       if test -r $ac_dir/$mh_ext; then
  603.          mh_curses_lib_dir=$ac_dir
  604.          break 2
  605.       fi
  606.     done
  607. done
  608. if test "x$mh_curses_lib_dir" != "x" ; then
  609.     MH_CURSES_LIB="-L$mh_curses_lib_dir -l$curses_l"
  610.     AC_MSG_RESULT(found in $mh_curses_lib_dir)
  611.     AC_SUBST(MH_CURSES_LIB)
  612. else
  613.     AC_MSG_ERROR(Cannot find curses library file: $curses_l; THE cannot be configured)
  614. fi
  615. ])dnl
  616.  
  617. dnl ---------------------------------------------------------------------------
  618. dnl Check for broken SYSVR4 curses implementations
  619. dnl ---------------------------------------------------------------------------
  620. AC_DEFUN([MH_CHECK_BROKEN_SYSVR4_CURSES],
  621. [
  622. AC_MSG_CHECKING(if $curses_l is a broken SYSVR4 curses)
  623. dnl
  624. dnl Known platform is Solaris 2.5+
  625. dnl
  626. case "$target" in
  627.     *solaris2.5*)
  628.         if test "$curses_l" = "curses" ; then
  629.             mh_broken_sysvr4_curses=yes
  630.         else
  631.             mh_broken_sysvr4_curses=no
  632.         fi
  633.         ;;
  634.     *solaris2.6*)
  635.         if test "$curses_l" = "curses" ; then
  636.             mh_broken_sysvr4_curses=yes
  637.         else
  638.             mh_broken_sysvr4_curses=no
  639.         fi
  640.         ;;
  641.     *)mh_broken_sysvr4_curses=no
  642. esac
  643. if test "$mh_broken_sysvr4_curses" = yes ; then
  644.     AC_DEFINE(HAVE_BROKEN_SYSVR4_CURSES)
  645. fi
  646. AC_MSG_RESULT($mh_broken_sysvr4_curses)
  647. ])dnl
  648.  
  649. dnl ---------------------------------------------------------------------------
  650. dnl Check REXX library and header files
  651. dnl ---------------------------------------------------------------------------
  652. AC_DEFUN([MH_CHECK_REXX],
  653. [
  654. if test "$with_regina" = yes; then
  655.     AC_DEFINE(USE_REGINA)
  656.     rexx_h="rexxsaa.h"
  657.     rexx_l="regina"
  658.     extra_libs=""
  659. else
  660.     if test "$with_rexximc" = yes; then
  661.         AC_DEFINE(USE_REXXIMC)
  662.         rexx_h="rexxsaa.h"
  663.         rexx_l="rexx"
  664.         extra_libs=""
  665.     else
  666.         if test "$with_rexx6000" = yes; then
  667.             AC_DEFINE(USE_REXX6000)
  668.             rexx_h="rexxtype.h"
  669.             rexx_l="rexx"
  670.             extra_libs=""
  671.         else
  672.             if test "$with_orexx" = yes; then
  673.                 AC_DEFINE(USE_OREXX)
  674.                 rexx_h="rexx.h"
  675.                 rexx_l="rexx"
  676.                 extra_libs="-lrexxapi -lpthreads"
  677.             else
  678.                 if test "$with_unirexx" = yes; then
  679.                     AC_DEFINE(USE_UNIREXX)
  680.                     rexx_h="rexxsaa.h"
  681.                     rexx_l="rx"
  682.                     extra_libs=""
  683.                 else
  684.                     AC_DEFINE(NOREXX)
  685.                     rexx_h=""
  686.                     rexx_l=""
  687.                     extra_libs=""
  688.                 fi
  689.             fi
  690.         fi
  691.     fi
  692. fi
  693.  
  694. dnl look for REXX header and library, exit if not found
  695.  
  696. if test "xx$rexx_h" = "xx" ; then
  697.     MH_REXX_LIB=""
  698.     MH_REXX_INC=""
  699.     AC_SUBST(MH_REXX_INC)
  700.     AC_SUBST(MH_REXX_LIB)
  701. else
  702. dnl look for REXX header and library, exit if not found
  703.     AC_MSG_CHECKING(for location of REXX header file)
  704.     mh_rexx_inc_dir=""
  705.     mh_inc_dirs="\
  706.         ${HOME}/include           \
  707.         /usr/local/include        \
  708.         /usr/contrib/include      \
  709.         /opt/include              \
  710.         /usr/include              \
  711.         /usr/local/orexx          \
  712.         /usr/unsupported/include"
  713. dnl
  714. dnl Provide for user supplying directory
  715. dnl
  716.     if test "$with_rexxincdir" != no ; then
  717.         mh_inc_dirs="$with_rexxincdir $mh_inc_dirs"
  718.     fi
  719. dnl
  720. dnl Try to determine the directory containing REXX header
  721. dnl
  722.     for ac_dir in $mh_inc_dirs ; do
  723.       if test -r $ac_dir/$rexx_h; then
  724.         mh_rexx_inc_dir=$ac_dir
  725.         break
  726.       fi
  727.     done
  728.     if test "x$mh_rexx_inc_dir" != "x" ; then
  729.         MH_REXX_INC="-I$mh_rexx_inc_dir"
  730.         AC_MSG_RESULT(found in $mh_rexx_inc_dir)
  731.         AC_SUBST(MH_REXX_INC)
  732.     else
  733.         AC_MSG_ERROR(Cannot find REXX header file: $rexx_h; THE cannot be configured)
  734.     fi
  735.     AC_MSG_CHECKING(for location of REXX library file)
  736.     mh_rexx_lib_dir=""
  737.     mh_lib_dirs="\
  738.         ${HOME}/lib               \
  739.         /usr/local/lib            \
  740.         /usr/contrib/lib          \
  741.         /opt/lib                  \
  742.         /usr/lib                  \
  743.         /usr/local/orexx/lib      \
  744.         /usr/unsupported/lib"
  745. dnl
  746. dnl Provide for user supplying directory
  747. dnl
  748.     if test "$with_rexxlibdir" != no ; then
  749.         mh_lib_dirs="$with_rexxlibdir $mh_lib_dirs"
  750.     fi
  751. dnl
  752. dnl Try to determine the directory containing REXX library
  753. dnl
  754.     for ac_dir in $mh_lib_dirs ; do
  755.         for mh_ext in lib${rexx_l}.a lib${rexx_l}.so lib${rexx_l}.sl; do
  756.           if test -r $ac_dir/$mh_ext; then
  757.              mh_rexx_lib_dir=$ac_dir
  758.              break 2
  759.           fi
  760.         done
  761.     done
  762.     if test "x$mh_rexx_lib_dir" != "x" ; then
  763.         MH_REXX_LIB="-L$mh_rexx_lib_dir -l$rexx_l $extra_libs"
  764.         AC_MSG_RESULT(found in $mh_rexx_lib_dir)
  765.         AC_SUBST(MH_REXX_LIB)
  766.     else
  767.         AC_MSG_ERROR(Cannot find REXX library file: $rexx_l; THE cannot be configured)
  768.     fi
  769. fi
  770. ])dnl
  771.  
  772. dnl ---------------------------------------------------------------------------
  773. dnl Check location of xterm for XCURSES version
  774. dnl ---------------------------------------------------------------------------
  775. AC_DEFUN([MH_FIND_XTERM],
  776. [
  777. if test "$with_xcurses" = yes; then
  778.     mh_xterm_found=no
  779.     AC_MSG_CHECKING(for location of xterm)
  780.     mh_xterms="\
  781.         /usr/X11R6/bin/xterm      \
  782.         /usr/bin/X11R6/xterm      \
  783.         /usr/X11R5/bin/xterm      \
  784.         /usr/bin/X11R5/xterm      \
  785.         /usr/X11/bin/xterm        \
  786.         /usr/openwin/bin/xterm    \
  787.         /usr/bin/X11/xterm        \
  788.         /usr/local/bin/xterm      \
  789.         /usr/contrib/bin/xterm"
  790.     for sout in $mh_xterms ; do
  791.         if test -x $sout ; then
  792.                 mh_xterm_found=yes
  793.             AC_DEFINE_UNQUOTED(XTERM_PROGRAM,"$sout")
  794.             AC_MSG_RESULT(found in $sout)
  795.             break 2
  796.         fi
  797.     done
  798.     if test "$mh_xterm_found" = no ; then
  799.         AC_DEFINE_UNQUOTED(XTERM_PROGRAM,"N/A")
  800.         AC_MSG_RESULT(not found. You will need to run SET XTERMINAL before invoking a shell command within THE)
  801.     fi
  802. fi
  803. ])dnl
  804.  
  805. dnl ---------------------------------------------------------------------------
  806. dnl Check for acl_get function under AIX
  807. dnl ---------------------------------------------------------------------------
  808. AC_DEFUN([MH_FUNC_ACL_GET],
  809. [
  810. mh_save_libs="$LIBS"
  811. LIBS="$LIBS -ls"
  812. mh_save_cflags="$CFLAGS"
  813. CFLAGS="$CFLAGS -D_ALL_SOURCE"
  814. AC_MSG_CHECKING(for function acl_get)
  815. AC_CACHE_VAL(
  816. [mh_cv_func_acl_get],
  817. [
  818.     AC_TRY_LINK(
  819. [#include <sys/acl.h>],
  820. [char *ptr=(char *)acl_get("XXX")],
  821.     [mh_cv_func_acl_get=yes],
  822.     [mh_cv_func_acl_get=no]
  823.     )
  824. ])dnl
  825. LIBS="$mh_save_libs"
  826. CFLAGS="$mh_save_cflags"
  827. AC_MSG_RESULT($mh_cv_func_acl_get)
  828. if test "$mh_cv_func_acl_get" = yes ; then
  829.     AC_DEFINE(HAVE_ACL_GET)
  830. #    MH_EXTRA_LIBS="-ls"
  831. #    AC_SUBST(MH_EXTRA_LIBS)
  832. fi
  833. ])dnl
  834.  
  835. dnl ---------------------------------------------------------------------------
  836. dnl Check for presense of various libraries
  837. dnl ---------------------------------------------------------------------------
  838. AC_DEFUN([MH_CHECK_LIB],
  839. [
  840. MH_EXTRA_LIBS=""
  841. for mh_lib in $1; do
  842. #    AC_MSG_CHECKING(for library -l${mh_lib})
  843.     AC_CHECK_LIB($mh_lib,main,mh_lib_found=yes,mh_lib_found=no)
  844.     if test "$mh_lib_found" = yes; then
  845. #        AC_MSG_RESULT(found)
  846.         MH_EXTRA_LIBS="${MH_EXTRA_LIBS} -l${mh_lib}"
  847. #    else
  848. #        AC_MSG_RESULT(not found)
  849.     fi
  850. done
  851. ])dnl
  852.  
  853. dnl ---------------------------------------------------------------------------
  854. dnl Check for where yywrap lives
  855. dnl ---------------------------------------------------------------------------
  856. AC_DEFUN([MH_CHECK_LEX],
  857. [
  858. MHLEXLIB=""
  859. for mh_lib in $1; do
  860.     AC_CHECK_LIB($mh_lib,yywrap,mh_lib_found=yes,mh_lib_found=no)
  861.     if test "$mh_lib_found" = yes; then
  862.         MHLEXLIB="-l$mh_lib"
  863.         break
  864.     fi
  865. done
  866. if test "$MHLEXLIB" = ""; then
  867.     AC_MSG_ERROR(Cannot find a library that contains yywrap; unable to build THE with Regina)
  868. fi
  869. ])dnl
  870.