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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT([SciTECO], [0.6.4],
[robin.haberkorn@googlemail.com],
[sciteco],
[http://sciteco.sf.net/])
PACKAGE_URL_DEV=https://github.com/rhaberkorn/sciteco
AC_SUBST(PACKAGE_URL_DEV)
AC_DEFINE_UNQUOTED(PACKAGE_URL_DEV, ["$PACKAGE_URL_DEV"],
[Package development homepage.])
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
# SciTECO library macro directory
scitecolibdir=$datadir/$PACKAGE/lib
AC_SUBST(scitecolibdir)
# Auxiliary functions
# expand $1 and print its absolute path
# similar to GNU readlink -e but portable
canonicalize() {
(eval cd $1 2>/dev/null && pwd -P)
}
# Checks for programs.
LT_INIT
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_GREP
AC_PROG_INSTALL
# Additionally required by the Scintilla build process:
AC_CHECK_TOOL(AR, ar)
AC_PROG_RANLIB
# Check for Windows resource compiler and define
# WIN32 conditional
case $host in
*-mingw*)
LT_LANG([Windows Resource])
AM_CONDITIONAL(WIN32, [true])
;;
*)
AM_CONDITIONAL(WIN32, [false])
;;
esac
# Emscripten uses Clang as well
AM_CONDITIONAL(CLANG, [$CXX --version | $GREP -E "clang|Emscripten" >/dev/null])
AC_CHECK_PROG(DATE, date, date)
if [[ x$DATE = x ]]; then
AC_MSG_ERROR([Required tool date not found!])
fi
# not necessarily required (depends on --enable-html-manual)
AC_CHECK_PROG(GROFF, groff, groff)
# not necessarily required (depends on --enable-developer-doc)
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen)
AC_CHECK_PROG(DOT, dot, dot)
DOXYGEN_HAVE_DOT=YES
if [[ x$DOT = x ]]; then DOXYGEN_HAVE_DOT=NO; fi
AC_SUBST(DOXYGEN_HAVE_DOT)
# For bootstrapping via installed sciteco
AC_CHECK_PROG(SCITECO, sciteco, sciteco)
# Checks for libraries.
PKG_CHECK_MODULES(LIBGLIB, [glib-2.0 >= 2.28], [
CFLAGS="$CFLAGS $LIBGLIB_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBGLIB_CFLAGS"
LIBS="$LIBS $LIBGLIB_LIBS"
])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([bsd/sys/queue.h])
AM_CONDITIONAL(NEED_COMPAT, [test $ac_cv_header_bsd_sys_queue_h = no])
case $host in
*-mingw*)
AC_CHECK_HEADERS([windows.h], , [
AC_MSG_ERROR([Missing Windows headers!])
])
;;
esac
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
# They must exist on every target system.
AC_CHECK_FUNCS([memset setlocale strchr strrchr fstat], , [
AC_MSG_ERROR([Missing libc function])
])
# Library functions that should exist on UNIX/Linux
# and UNIXoid systems
case $host in
*-*-darwin* | *-*-linux* | *-*-cygwin* | *-*-haiku*)
AC_CHECK_FUNCS([realpath fchown dup dup2], , [
AC_MSG_ERROR([Missing libc function])
])
;;
esac
# Check for optional GNU libc features.
# Will probably only be found on Linux.
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_FUNCS([malloc_trim])
#
# Config options
#
AC_ARG_WITH(scintilla,
AS_HELP_STRING([--with-scintilla=PATH],
[Specify Scintilla's path [default=./scintilla]]),
[SCINTILLA_PATH=$withval], [SCINTILLA_PATH=./scintilla])
SCINTILLA_PATH=`canonicalize $SCINTILLA_PATH`
AC_SUBST(SCINTILLA_PATH)
CPPFLAGS="$CPPFLAGS -I$SCINTILLA_PATH/include -DSCI_LEXER"
AC_ARG_WITH(scinterm,
AS_HELP_STRING([--with-scinterm=PATH],
[Specify Scinterm's path [default=SCINTILLA_PATH/scinterm]]),
[SCINTERM_PATH=$withval], [SCINTERM_PATH=$SCINTILLA_PATH/scinterm])
SCINTERM_PATH=`canonicalize $SCINTERM_PATH`
AC_SUBST(SCINTERM_PATH)
AC_ARG_WITH(interface,
AS_HELP_STRING([--with-interface=ncurses|xcurses|pdcurses|gtk],
[Specify user interface [default=ncurses]]),
[INTERFACE=$withval], [INTERFACE=ncurses])
case $INTERFACE in
*curses)
case $INTERFACE in
ncurses)
PKG_CHECK_MODULES(NCURSES, [ncurses], [
CFLAGS="$CFLAGS $NCURSES_CFLAGS"
CXXFLAGS="$CXXFLAGS $NCURSES_CFLAGS"
LIBS="$LIBS $NCURSES_LIBS"
], [
AC_CHECK_LIB(ncurses, initscr, , [
AC_MSG_ERROR([libncurses missing!])
])
])
AC_CHECK_FUNCS([tigetstr])
;;
xcurses)
AC_CHECK_PROG(XCURSES_CONFIG, xcurses-config, xcurses-config)
AC_ARG_VAR(XCURSES_CFLAGS, [
C compiler flags for XCurses,
overriding the autoconf check
])
if [[ "x$XCURSES_CFLAGS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then
XCURSES_CFLAGS=`$XCURSES_CONFIG --cflags`
fi
CFLAGS="$CFLAGS $XCURSES_CFLAGS"
CXXFLAGS="$CXXFLAGS $XCURSES_CFLAGS"
AC_ARG_VAR(XCURSES_LIBS, [
linker flags for XCurses,
overriding the autoconf check
])
AC_MSG_CHECKING([checking for XCurses])
if [[ "x$XCURSES_LIBS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then
XCURSES_LIBS=`$XCURSES_CONFIG --libs`
fi
if [[ "x$XCURSES_LIBS" = "x" ]]; then
AC_MSG_ERROR([libXCurses not configured correctly!
xcurses-config must be present or XCURSES_LIBS must be specified.])
fi
AC_MSG_RESULT([$XCURSES_LIBS])
LIBS="$LIBS $XCURSES_LIBS"
# This is also used by the curses.h itself:
AC_DEFINE(XCURSES, , [Enable PDCurses/XCurses extensions])
;;
pdcurses)
AC_ARG_VAR(PDCURSES_CFLAGS, [
C compiler flags for PDCurses,
overriding the autoconf check
])
CFLAGS="$CFLAGS $PDCURSES_CFLAGS"
CXXFLAGS="$CXXFLAGS $PDCURSES_CFLAGS"
AC_ARG_VAR(PDCURSES_LIBS, [
linker flags for PDCurses,
overriding the autoconf check
])
if [[ "x$PDCURSES_LIBS" = "x" ]]; then
AC_CHECK_LIB(pdcurses, initscr, , [
AC_MSG_ERROR([libpdcurses missing!
Perhaps it is not named correctly or has wrong permissions.])
])
else
AC_MSG_CHECKING([checking for PDCurses (PDCURSES_LIBS)])
AC_MSG_RESULT([$PDCURSES_LIBS])
LIBS="$LIBS $PDCURSES_LIBS"
fi
AC_CHECK_FUNC([PDC_set_resize_limits], [
AC_DEFINE(PDCURSES_WIN32A, , [PDCurses supports Win32a extensions])
])
;;
esac
AC_CHECK_HEADERS([curses.h], , [
AC_MSG_ERROR([Curses header missing!])
])
AC_DEFINE(INTERFACE_CURSES, , [Build with curses support])
# For Scintilla:
CPPFLAGS="$CPPFLAGS -DCURSES -I$SCINTERM_PATH"
;;
gtk)
PKG_CHECK_MODULES(LIBGTK, [gtk+-2.0 gmodule-2.0], [
CFLAGS="$CFLAGS $LIBGTK_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBGTK_CFLAGS"
LIBS="$LIBS $LIBGTK_LIBS"
])
AC_CHECK_PROG(GOB2, gob2, gob2)
if [[ x$GOB2 = x ]]; then
AC_MSG_ERROR([Gob2 (GObject Builder) not found!])
fi
AC_DEFINE(INTERFACE_GTK, , [Build with GTK+ 2.0 support])
# For Scintilla:
CPPFLAGS="$CPPFLAGS -DGTK"
;;
*)
AC_MSG_ERROR([Invalid user interface specified!])
;;
esac
AM_CONDITIONAL(INTERFACE_GTK, [test x$INTERFACE = xgtk])
AC_ARG_WITH(teco-integer,
AS_HELP_STRING([--with-teco-integer=SIZE],
[Storage size of TECO integers in bits [default=64]]),
[TECO_INTEGER=$withval], [TECO_INTEGER=64])
AC_SUBST(TECO_INTEGER)
AC_DEFINE_UNQUOTED(TECO_INTEGER, $TECO_INTEGER, [Storage size of TECO integers])
AC_ARG_ENABLE(html-manual,
AS_HELP_STRING([--enable-html-manual],
[Generate and install HTML manuals using Groff [default=no]]),
[html_man=$enableval], [html_man=no])
if [[ $html_man = yes -a x$GROFF = x ]]; then
AC_MSG_ERROR([Enabled generating HTML manuals, but Groff cannot be found!
Try --disable-html-manual.])
fi
AM_CONDITIONAL(BUILD_HTMLMAN, [test $html_man = yes])
AC_ARG_ENABLE(developer-doc,
AS_HELP_STRING([--enable-developer-doc],
[Generate developer documentation using Doxygen [default=no]]),
[dev_doc=$enableval], [dev_doc=no])
if [[ $dev_doc = yes -a x$DOXYGEN = x ]]; then
AC_MSG_ERROR([Enabled generating developer documentation,
but Doxygen cannot be found!
Try --disable-developer-doc.])
fi
AM_CONDITIONAL(BUILD_DEVDOC, [test $dev_doc = yes])
AC_ARG_ENABLE(bootstrap,
AS_HELP_STRING([--disable-bootstrap],
[Bootstrap using sciteco-minimal,
otherwise use preinstalled sciteco [default=yes]]),
[bootstrap=$enableval], [bootstrap=yes])
if [[ $bootstrap = no -a x$SCITECO = x ]]; then
AC_MSG_ERROR([Disabled bootstrapping, but preinstalled SciTECO cannot be found!
Try --enable-bootstrap.])
fi
AM_CONDITIONAL(BOOTSTRAP, [test x$bootstrap = xyes])
# This cannot be done with --enable-static as it only controls
# which kind of libraries libtool builds.
# Also, it cannot be controlled reliably by setting LDFLAGS for
# ./configure, as this would be used for linking the test cases
# without libtool and libtool would ignore it.
# It is only possible to call `make LDFLAGS="-all-static"` but
# this is inconvenient...
AC_ARG_ENABLE(static-executables,
AS_HELP_STRING([--enable-static-executables],
[Link in as many runtime dependencies as possible
statically [default=no]]),
[static_executables=$enableval], [static_executables=no])
AM_CONDITIONAL(STATIC_EXECUTABLES, [test x$static_executables = xyes])
AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile])
AC_CONFIG_FILES([doc/Makefile doc/Doxyfile])
AC_OUTPUT
|