-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
222 lines (189 loc) · 5.74 KB
/
configure.in
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
# Process this file with autoconf to produce a configure script.
# vim600:fdm=marker
AC_INIT(src/zhcon.cpp)
AM_INIT_AUTOMAKE(zhcon, 0.2.6)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)
dnl zhcon_datadir=@libdir@
dnl AC_SUBST(zhcon_datadir)
dnl AC_DEFINE_UNQUOTED(ZHCON_DATADIR,$zhcon_datadir)
AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
ac_configure_args="$ac_configure_args --prefix $prefix"
fi
AC_DEFINE_UNQUOTED(PREFIX, "$prefix")
dnl use C++ do lib checking
AC_LANG_CPLUSPLUS
dnl Check platform
AC_CANONICAL_HOST
case "$host" in
*-*-linux*)
echo "Linux detected"
ZHCON_ARCH="Linux";;
i?86-*-freebsd*)
echo "FreeBsd detected"
ZHCON_ARCH="FreeBSD"
dnl gcc 2.95 on freebsd does not search /usr/local/include
dnl while gcc 3.2 seems work fine
dnl workaround it here
LIBS="-L/usr/local/lib $LIBS"
CFLAGS="$CFLAGS -I/usr/local/include"
CXXFLAGS="$CXXFLAGS -I/usr/local/include";;
*)
echo "Sorry, zhcon only supports Linux and x86 FreeBSD for now."
exit 1 ;;
esac
AC_DEFINE_UNQUOTED(PLATFORM, "$ZHCON_ARCH")
dnl check for compiler flags and debug options {{{
AC_ARG_ENABLE(debug,
[ --enable-debug compile for debug, useful for developers. [default=no]],
[if test "x$enableval" = "xyes"; then
dnl AC_DEFINE(DEBUG)
enable_debug=yes
else
enable_debug=no
fi])
CFLAGS="$CFLAGS -funsigned-char -O2"
CXXFLAGS="$CXXFLAGS -funsigned-char -O2"
if test "x$enable_debug" = "xyes";then
CFLAGS="$CFLAGS -O0 -g3 -Wall"
CXXFLAGS="$CXXFLAGS -O0 -g3 -Wall"
else
case "$host" in
i486-pc-*)
CFLAGS="$CFLAGS -march=i486"
CXXFLAGS="$CXXFLAGS -march=i486";;
i586-pc-*)
CFLAGS="$CFLAGS -march=i586"
CXXFLAGS="$CXXFLAGS -march=i586";;
i686-pc-*)
CFLAGS="$CFLAGS -march=i686"
CXXFLAGS="$CXXFLAGS -march=i686";;
esac
CFLAGS="$CFLAGS -DNDEBUG -Wall"
CXXFLAGS="$CXXFLAGS -DNDEBUG -Wall"
fi
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LIBS)
dnl }}}
dnl check for x86 vga support
usevga=no
case "$host" in
i?86-*-*)
usevga=yes
AC_DEFINE(USING_VGA)
echo "x86 platform detected, compile with VGA support";;
*)
esac
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_C_BIGENDIAN
dnl ALL_LINGUAS="zh_CN.GB2312 zh_CN.GBK zh_CN.EUC zh_TW.Big5 ko ja"
AM_GNU_GETTEXT
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h string.h sys/ioctl.h termios.h unistd.h term.h gpm.h])
if test "$ac_cv_header_term_h" != 'yes'; then
echo ""
echo "*** term.h not found on this system, please install libncurses-dev or libcurses-dev and try again."
echo ""
exit 1
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
# Checks for library functions.
AC_FUNC_MMAP
AC_CHECK_FUNCS([memmove memset strchr])
dnl checks for libraries.
dnl bsd's gettext package is installed in /usr/local
dnl intl and termcap are needed for bsd
if test "$ZHCON_ARCH" = "FreeBSD"; then
AC_CHECK_LIB(c, i386_set_ioperm)
AC_CHECK_LIB(intl,main)
AC_CHECK_LIB(termcap,main)
fi
AC_CHECK_LIB(util, forkpty)
AC_CHECK_LIB(curses, main)
AC_CHECK_LIB(gpm, main)
if test "$ac_cv_lib_util_forkpty" != 'yes'; then
echo ""
echo "*** forkpty() in libutil not found on this system, please install libutil and try again."
echo ""
exit 1
fi
if test "$ac_cv_lib_curses_main" != 'yes'; then
echo ""
echo "*** libcurses not found on this system, please install libcurses or libncurses and try again."
echo ""
exit 1
fi
dnl check for iconv using automake macro
if test "$am_cv_func_iconv" != 'yes'; then
echo ""
echo "*** iconv() not found on this system, which is required for utf8 support"
echo "*** please install libiconv from"
echo "*** http://www.gnu.org/software/libiconv/ first!"
echo ""
exit 1
fi
dnl-----------------------------------------------------------------------
dnl Checks for unicon library from TurboLinux Chinese.
dnl-----------------------------------------------------------------------
useunicon='yes'
AC_CHECK_LIB(dl, main, ,useunicon="no")
AC_CHECK_LIB(pth, main,,useunicon="no")
AC_CHECK_LIB(immclient,main, ,useunicon="no")
AC_CHECK_LIB(imm_server, main, ,useunicon="no")
if test "$useunicon" = 'yes';then
AC_DEFINE(HAVE_UNICON_LIB)
LIBS="-L/usr/lib/unicon $LIBS"
#CPPFLAGS="$CPPFLAGS -I$ac_default_prefix/include"
LDFLAGS=" -Wl,-rpath=/usr/lib/unicon"
AC_SUBST(LIBS)
AC_SUBST(LDFLAGS)
fi
dnl-----------------------------------------------------------------------
dnl Checks for libggi
dnl-----------------------------------------------------------------------
useggi="yes"
AC_CHECK_HEADERS(ggi/ggi.h,,useggi="no")
AC_CHECK_LIB(ggi, main,,useggi="no")
if test "$useggi" = 'yes';then
AC_DEFINE(HAVE_GGI_LIB)
fi
AC_OUTPUT([Makefile
doc/Makefile
doc/zhcon.1
debian/Makefile
tools/Makefile
font/Makefile
input/Makefile
src/Makefile
src/display/Makefile])
cat <<EOF
Configuration:
Target system: ${host}
Source code location: ${srcdir}
C++ Compiler: ${CXX}
C++ Compiler flags: ${CXXFLAGS}
C Compiler: ${CC}
C Compiler flags: ${CFLAGS}
VGA support: ${usevga}
gpm moues support: ${ac_cv_header_gpm_h}
libggi support: ${useggi}
unicon support: ${useunicon}
zhcon binary dir: `eval "echo \`eval \"echo ${bindir}\"\`"`
zhcon files dir: `eval "echo \`eval \"echo ${libdir}/${PACKAGE}\"\`"`
Config complete, now type make to build zhcon.
Good Luck!
EOF