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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nano.c)
AM_INIT_AUTOMAKE(nano, 0.9.12-cvs)
AM_CONFIG_HEADER(config.h:config.h.in)
ALL_LINGUAS="es de fr it id fi"
dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h)
dnl options
AC_ARG_ENABLE(tiny,
[ --enable-tiny Disables features for the sake of size
(currently disables detailed help and i18n)],
[if test x$enableval = xyes; then
AC_DEFINE(NANO_SMALL) tiny_support=yes
fi])
AC_MSG_CHECKING(whether to use slang)
CURSES_LIB_NAME=""
AC_ARG_WITH(slang,
[ --with-slang[=DIR] Use the slang library instead of curses],
[ case "$with_slang" in
yes)
AC_MSG_RESULT(yes)
AC_CHECK_HEADER(slcurses.h,
AC_CHECK_LIB(slang, SLcurses_newwin,
[AC_DEFINE(USE_SLANG) slang_support=yes
CURSES_LIB="-lslang" CURSES_LIB_NAME=slang]),
AC_MSG_ERROR([
*** The header file slcurses.h was not found. If you wish to use
*** slang support this header file is required. Please either
*** install a version of slang that includes the slcurses.h file or
*** do not call the configure script with --with-slang
]))
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
# Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
# alternate readline path
_ldflags=${LDFLAGS}
_cppflags=${CPPFLAGS}
# Add additional search path
LDFLAGS="-L$with_slang/lib $LDFLAGS"
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
AC_CHECK_HEADER(slcurses.h,
AC_CHECK_LIB(slang, SLcurses_newwin,
[AC_DEFINE(USE_SLANG) slang_support=yes
CURSES_LIB="-L${with_slang}/lib -lslang"
CURSES_LIB_NAME=slang],
AC_MSG_ERROR([
*** The slang library was not found or the version you have installed
*** is incorrect.
])),
AC_MSG_ERROR([
*** The header file slcurses.h was not found. If you wish to use
*** slang support this header file is required. Please either
*** install a version of slang that includes the slcurses.h file or
*** do not call the configure script with --with-slang
]))
LDFLAGS=${_ldflags}
;;
esac])
dnl Checks for functions
AC_CHECK_FUNCS(snprintf vsnprintf)
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
then
AM_PATH_GLIB(1.2.4,,
AC_MSG_ERROR([
*** snprintf() and/or vsnprintf() not found. GLIB not found either.
*** You need both snprintf() and vsnprintf(). Alternatively you can
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
glib)
glib_cflags=`$GLIB_CONFIG --cflags glib`
glib_libs=`$GLIB_CONFIG --libs glib`
fi
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getopt_long)
dnl Checks for libraries.
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_HEADERS(curses.h ncurses.h)
AC_CHECK_LIB(ncurses, tgetent,[CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses
dnl Only ncurses seems to have a working TABSIZE function.
AC_DEFINE(HAVE_TABSIZE)])
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(curses, tgetent, CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses)
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_CHECK_LIB(termcap, tgetent, CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap)
fi
if eval "test x$CURSES_LIB_NAME = x"
then
AC_MSG_WARN([
*** No termcap lib available, consider getting the official ncurses
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
*** errors compiling nano.])
else
AC_MSG_RESULT("Using $CURSES_LIB_NAME as the termcap library")
fi
AC_CHECK_LIB($CURSES_LIB_NAME, wresize, AC_DEFINE(HAVE_WRESIZE))
dnl Parse any configure options
LIBS="$LIBS $CURSES_LIB"
AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging (def disabled)],)
AC_SUBST(CURSES_LIB)
if test "x$glib_cflags" != "x"
then
CFLAGS="$CFLAGS $glib_cflags"
fi
if test "x$glib_libs" != "x"
then
LDFLAGS="$LDFLAGS $glib_libs"
fi
dnl i18n stuff - pretty incomplete for now
AM_GNU_GETTEXT
AC_OUTPUT([Makefile intl/Makefile po/Makefile.in])