forked from Orc/ndialog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·120 lines (104 loc) · 3.22 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#! /bin/sh
# local options: ac_help is the help message that describes them
# and LOCAL_AC_OPTIONS is the script that interprets them. LOCAL_AC_OPTIONS
# is a script that's processed with eval, so you need to be very careful to
# make certain that what you quote is what you want to quote.
ac_help='--with-bsd-curses Use BSD curses if available.
--with-getcap (--with-bsd-curses) use getcap() to get
function key definitions'
# load in the configuration file
#
TARGET=ndialog
. ./configure.inc
# and away we go
#
AC_INIT ndialog
AC_PROG_CC
check_ncurses() {
if AC_CHECK_HEADERS ncurses/curses.h; then
AC_SUB CURSES_HEADER ncurses/curses.h
# if the ncurses directory is there, we've probably got a winnah.
elif AC_CHECK_HEADERS curses.h; then
AC_SUB CURSES_HEADER curses.h
# possibly.
else
# no ncurses OR curses header. Goodbye, cruel world.
$__fail 1
fi
if LIBS="-lncurses" AC_CHECK_FUNCS start_color; then
WITH_NCURSES=1
AC_LIBS="$AC_LIBS -lncurses"
return 0
elif LIBS="-lcurses" AC_CHECK_FUNCS start_color; then
WITH_NCURSES=1
AC_LIBS="$AC_LIBS -lcurses"
return 0
elif LIBS="-lcurses" AC_CHECK_FUNCS initscr; then
WITH_BSD_CURSES=1
AC_LIBS="$AC_LIBS -lcurses"
return 1 # have a curses lib, but it's not ncurses.
elif LIBS="-lcurses -ltermcap" AC_CHECK_FUNCS initscr; then
WITH_BSD_CURSES=1
AC_LIBS="$AC_LIBS -lcurses -ltermcap"
return 1 # have a curses lib, but it's not ncurses.
fi
$__fail 1
}
check_curses() {
if AC_CHECK_HEADERS curses.h; then
AC_SUB CURSES_HEADER curses.h
# possibly.
if LIBS="-lcurses" AC_CHECK_FUNCS initscr; then
WITH_BSD_CURSES=1
AC_LIBS="$AC_LIBS -lcurses"
return 0
elif LIBS="-lcurses -ltermcap" AC_CHECK_FUNCS initscr; then
WITH_BSD_CURSES=1
AC_LIBS="$AC_LIBS -lcurses -ltermcap"
return 0
fi
fi
$__fail 1
}
if [ "${WITH_BSD_CURSES:-0}" -eq 1 ]; then
check_curses
elif check_ncurses; then
# if ncurses, then check for the panel library
if AC_CHECK_HEADERS ncurses/panel.h; then
panel_header=ncurses/panel.h
check_panel=T
elif AC_CHECK_HEADERS panel.h; then
panel_header=panel.h
check_panel=T
fi
if [ "$check_panel" ]; then
if LIBS="-lpanel $AC_LIBS" AC_CHECK_FUNCS new_panel; then
HAVE_PANEL=1
AC_LIBS="-lpanel $AC_LIBS"
AC_SUB PANEL_HEADER $panel_header
elif LIBS="$AC_LIBS -lpanel" AC_CHECK_FUNCS new_panel; then
HAVE_PANEL=1
AC_LIBS="$AC_LIBS -lpanel"
AC_SUB PANEL_HEADER $panel_header
fi
fi
fi
AC_CHECK_HEADERS errno.h
test "$WITH_GETCAP" && AC_DEFINE WITH_GETCAP $WITH_GETCAP
AC_DEFINE WITH_NCURSES ${WITH_NCURSES:-0}
AC_DEFINE WITH_BSD_CURSES ${WITH_BSD_CURSES:-0}
AC_DEFINE HAVE_PANEL ${HAVE_PANEL:-0}
if [ ! "$WITH_BSD_CURSES" ]; then
# check for particular ncurses functions so we can dummy them
# if need be.
LIBS="$AC_LIBS" AC_CHECK_FUNCS wattr_set
LIBS="$AC_LIBS" AC_CHECK_FUNCS waddnstr
LIBS="$AC_LIBS" AC_CHECK_FUNCS beep
LIBS="$AC_LIBS" AC_CHECK_FUNCS curs_set
LIBS="$AC_LIBS" AC_CHECK_FUNCS ripoffline
LIBS="$AC_LIBS" AC_CHECK_FUNCS start_color
fi
LIBS="$AC_LIBS" AC_CHECK_FUNCS doupdate
LIBS="$AC_LIBS" AC_CHECK_FUNCS keypad
MF_PATH_INCLUDE RANLIB ranlib true || AC_CONFIG RANLIB ':'
AC_OUTPUT src/Makefile src/curse.h