Mercurial > hg
comparison mcabber/macros/curslib.m4 @ 927:ec1e14702d8a
Add curslib.m4
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 03 Jul 2006 19:02:08 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
926:8a31dd49130d | 927:ec1e14702d8a |
---|---|
1 dnl --------------------------------------------------------------------------- | |
2 dnl Look for the curses libraries. Older curses implementations may require | |
3 dnl termcap/termlib to be linked as well. | |
4 AC_DEFUN([CF_CURSES_LIBS],[ | |
5 AC_CHECK_FUNC(initscr,,[ | |
6 case $host_os in #(vi | |
7 freebsd*) #(vi | |
8 AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"]) | |
9 ;; | |
10 hpux10.*|hpux11.*) | |
11 AC_CHECK_LIB(cur_colr,initscr,[ | |
12 LIBS="-lcur_colr $LIBS" | |
13 CFLAGS="-I/usr/include/curses_colr $CFLAGS" | |
14 ac_cv_func_initscr=yes | |
15 ],[ | |
16 AC_CHECK_LIB(Hcurses,initscr,[ | |
17 # HP's header uses __HP_CURSES, but user claims _HP_CURSES. | |
18 LIBS="-lHcurses $LIBS" | |
19 CFLAGS="-D__HP_CURSES -D_HP_CURSES $CFLAGS" | |
20 ac_cv_func_initscr=yes | |
21 ])]) | |
22 ;; | |
23 linux*) # Suse Linux does not follow /usr/lib convention | |
24 LIBS="$LIBS -L/lib" | |
25 ;; | |
26 esac | |
27 | |
28 if test ".$With5lib" != ".no" ; then | |
29 if test -d /usr/5lib ; then | |
30 # SunOS 3.x or 4.x | |
31 CPPFLAGS="$CPPFLAGS -I/usr/5include" | |
32 LIBS="$LIBS -L/usr/5lib" | |
33 fi | |
34 fi | |
35 | |
36 if test ".$ac_cv_func_initscr" != .yes ; then | |
37 cf_save_LIBS="$LIBS" | |
38 cf_term_lib="" | |
39 cf_curs_lib="" | |
40 | |
41 # Check for library containing tgoto. Do this before curses library | |
42 # because it may be needed to link the test-case for initscr. | |
43 AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ | |
44 for cf_term_lib in termcap termlib unknown | |
45 do | |
46 AC_CHECK_LIB($cf_term_lib,tgoto,[break]) | |
47 done | |
48 ]) | |
49 | |
50 # Check for library containing initscr | |
51 test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" | |
52 for cf_curs_lib in cursesX curses ncurses xcurses jcurses unknown | |
53 do | |
54 AC_CHECK_LIB($cf_curs_lib,initscr,[break]) | |
55 done | |
56 test $cf_curs_lib = unknown && AC_ERROR(no curses library found) | |
57 | |
58 LIBS="-l$cf_curs_lib $cf_save_LIBS" | |
59 if test "$cf_term_lib" = unknown ; then | |
60 AC_MSG_CHECKING(if we can link with $cf_curs_lib library) | |
61 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], | |
62 [initscr()], | |
63 [cf_result=yes], | |
64 [cf_result=no]) | |
65 AC_MSG_RESULT($cf_result) | |
66 test $cf_result = no && AC_ERROR(Cannot link curses library) | |
67 elif test "$cf_term_lib" != predefined ; then | |
68 AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries) | |
69 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], | |
70 [initscr(); tgoto((char *)0, 0, 0);], | |
71 [cf_result=no], | |
72 [ | |
73 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" | |
74 AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], | |
75 [initscr()], | |
76 [cf_result=yes], | |
77 [cf_result=error]) | |
78 ]) | |
79 AC_MSG_RESULT($cf_result) | |
80 fi | |
81 fi | |
82 | |
83 ])]) |