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