-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathconfigure.ac
248 lines (213 loc) · 6.37 KB
/
configure.ac
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(ht,[2.1.1],[https://sourceforge.net/tracker/?group_id=1066])
AC_PREREQ(2.59)
dnl Check the system.
AC_CANONICAL_SYSTEM
AC_ARG_ENABLE(x11-textmode,
[ --enable-x11-textmode build with x11 textmode support [default=yes]],,enable_x11_textmode="yes")
AC_ARG_ENABLE(maintainermode,
[ --enable-maintainermode minimise autodetection for package mantainers [default=no]],,enable_maintainermode="no")
AC_ARG_ENABLE(release,
[ --enable-release make a release build [default=yes]],,enable_release="yes")
AC_ARG_ENABLE(profiling,
[ --enable-profiling make a profile build [default=no]],,enable_profiling="no")
if test "x$enable_maintainermode" = "xno"; then
if test "x$enable_release" = "xyes"; then
FLAGS_ALL="-O3 -fomit-frame-pointer -Wall -fsigned-char"
else
FLAGS_ALL="-ggdb -g3 -O0 -Wall -fsigned-char"
fi
if test "x$enable_profiling" = "xyes"; then
FLAGS_ALL="$FLAGS_ALL -pg -g"
fi
fi
dnl FLAGS_ALL="$FLAGS_ALL -fsanitize=address"
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS([config.h])
dnl Check OS specifica
NEED_CURSES=0
HAVE_PIPE=0
HT_X11BASE="-L/usr/X11/lib -L/usr/X11R6/lib"
case "$target_os" in
linux*)
IO_DIR=posix
echo "*** LINUX, building POSIX version. we need (n)curses." 1>&2
NEED_CURSES=1
HAVE_PIPE=1
FLAGS_ALL="$FLAGS_ALL -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
;;
*freebsd*)
IO_DIR=posix
echo "*** FREEBSD, building native FreeBSD version. we need (n)curses." 1>&2
NEED_CURSES=1
HAVE_PIPE=1
FLAGS_ALL="$FLAGS_ALL -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
;;
*openbsd*)
IO_DIR=posix
echo "*** OpenBSD, building native OpenBSD version. we need (n)curses." 1>&2
NEED_CURSES=1
HAVE_PIPE=1
HT_X11BASE="-L${X11BASE}/lib"
FLAGS_ALL="$FLAGS_ALL -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
;;
cygwin*)
IO_DIR=win32
echo "*** CYGWIN, building native Win32 version (no cygwin.dll)" 1>&2
FLAGS_ALL="$FLAGS_ALL -mno-cygwin"
NEED_CURSES=0
HAVE_PIPE=1
;;
mingw32*)
IO_DIR=win32
echo "*** MINGW32, building native Win32 version" 1>&2
HT_LDFLAGS="$HT_LDFLAGS -static-libgcc -static-libstdc++"
NEED_CURSES=0
HAVE_PIPE=1
;;
*)
echo "configure: warning: $target_os: unknown target OS, assuming POSIX-compatible..." 1>&2
IO_DIR=posix
echo "*** POSIX-generic, we need (n)curses, '-pipe' disabled for safety" 1>&2
NEED_CURSES=1
HAVE_PIPE=0
FLAGS_ALL="$FLAGS_ALL -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
;;
esac
if test "x$HAVE_PIPE" = "x1"; then
FLAGS_PIPE="-pipe";
fi
CXXFLAGS="-DNOMACROS $FLAGS_PIPE $FLAGS_ALL -std=c++14 -Woverloaded-virtual -Wnon-virtual-dtor $CXXFLAGS"
CFLAGS="-DNOMACROS $FLAGS_PIPE $FLAGS_ALL $CFLAGS"
AC_DEFINE_UNQUOTED(SYSTEM_OSAPI_SPECIFIC_TYPES_HDR, "io/$IO_DIR/types.h", [Location of io/$IO_DIR/types.h])
AM_CONDITIONAL(USE_POSIX_DIR, test x$IO_DIR = xposix)
AM_CONDITIONAL(USE_WIN32_DIR, test x$IO_DIR = xwin32)
dnl Checks for programs.
AC_PROG_RANLIB
AC_PATH_PROGS(MAKE, gmake make, :)
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_YACC
AM_PROG_LEX
AM_PROG_AR
if test "x$AR" = "x"; then
AC_MSG_ERROR([*** 'ar' and 'gar' missing, please install one of them or fix your \$PATH ***])
fi
if test "x$enable_maintainermode" = "xno"; then
if test "${GXX}" = yes; then
gxx_version=`${CXX} -v 2>&1 | grep "^.*g.. version" | \\
sed -e 's/^.*g.. version *//'`
case ${gxx_version} in
1.*|2.*|3.*|4.0|4.1|4.2|4.3)
;;
*)
FLAGS_ALL="$FLAGS_ALL -march=native"
;;
esac
fi
fi
dnl Checks for libraries.
minilzo_enabled=no
AC_ARG_WITH(included-lzo,
AS_HELP_STRING([--with-included-lzo],
[use included minilzo]),
minilzo_enabled=$withval,
minilzo_enabled=no)
AC_MSG_CHECKING([whether to use the included lzo compression library])
AC_MSG_RESULT($minilzo_enabled)
LZO_LIBS=
if test "$minilzo_enabled" != "yes"; then
AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2)
if test "$LZO_LIBS" = ""; then
AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo, [
minilzo_enabled=yes
AC_MSG_WARN(
***
*** Could not find liblzo or liblzo2. Will use the included minilzo.
)
])
fi
fi
AC_SUBST(LZO_LIBS)
if test "$LZO_LIBS" = "-llzo"; then
AC_CHECK_HEADERS(lzo1x.h)
elif test "$LZO_LIBS" = "-llzo2"; then
AC_CHECK_HEADERS(lzo/lzo1x.h)
fi
if test "$minilzo_enabled" = "yes"; then
AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
fi
AM_CONDITIONAL(USE_LZO, test "$use_lzo" = "yes")
AM_CONDITIONAL(ENABLE_INCLUDED_LZO, test "$minilzo_enabled" = "yes")
HAVE_X11=0
if test "x$enable_x11_textmode" = "xyes"; then
TEMP_LDFLAGS=$LDFLAGS
LDFLAGS="$HT_LDFLAGS $HT_X11BASE"
AC_CHECK_LIB(X11, XOpenDisplay, HAVE_X11=1)
LDFLAGS=$TEMP_LDFLAGS
if test "x$HAVE_X11" = "x1"; then
AC_DEFINE(HAVE_TEXTMODE_X11, 1, [This system has Xlib support and we shall use it])
HT_LIBS="$HT_LIBS -lX11"
HT_LDFLAGS="$HT_LDFLAGS $HT_X11BASE"
fi
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([stdint.h])
dnl AC_CONFIG_HEADER(config.h)
CURSES_LIB=
if test "x$NEED_CURSES" = "x1"; then
AC_CHECK_HEADERS(ncurses.h, AC_DEFINE(CURSES_HDR, <ncurses.h>, [This system provides (n)curses.h/wide]) CURSES_LIB=ncurses)
if test "x$CURSES_LIB" = "x"; then
AC_CHECK_HEADERS(curses.h, AC_DEFINE(CURSES_HDR, <curses.h>, [This system provides (n)curses.h]) CURSES_LIB=curses)
if test "x$CURSES_LIB" = "x"; then
AC_MSG_ERROR([*** (n)curses.h needed ***])
fi
fi
HT_LIBS="$HT_LIBS -l$CURSES_LIB"
fi
dnl Makefile vars.
AC_SUBST(IO_DIR)
AC_SUBST(HT_LDFLAGS)
AC_SUBST(HT_LIBS)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long int, 4)
dnl Checks for library functions.
AC_CHECK_FUNCS(asinh acosh atanh)
AC_OUTPUT([
Makefile
analyser/Makefile
asm/Makefile
doc/Makefile
eval/Makefile
info/Makefile
io/Makefile
io/posix/Makefile
io/win32/Makefile
minilzo/Makefile
output/Makefile
tools/Makefile
])
echo 1>&2
echo "$0 successful." 1>&2
echo 1>&2
echo "=====================" 1>&2
echo "Configuration summary" 1>&2
echo "=====================" 1>&2
echo 1>&2
if test "x$HAVE_X11" = "x1"; then
echo "X11 textmode support available: yes" 1>&2
else
echo "X11 textmode support available: no" 1>&2
fi
echo "enable profiling: $enable_profiling" 1>&2
echo "make a release build: $enable_release" 1>&2
echo "using included minilzo: $minilzo_enabled" 1>&2