1
dnl Copyright 2000, 2001, 2002, 2003, 2005, 2006 by Paul Mattes.
2
dnl Permission to use, copy, modify, and distribute this software and its
3
dnl documentation for any purpose and without fee is hereby granted,
4
dnl provided that the above copyright notice appear in all copies and that
5
dnl both that copyright notice and this permission notice appear in
6
dnl supporting documentation.
8
dnl c3270 is distributed in the hope that it will be useful, but WITHOUT ANY
9
dnl WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10
dnl FOR A PARTICULAR PURPOSE. See the file LICENSE for more details.
1
dnl Copyright (c) 2000-2009, Paul Mattes.
2
dnl All rights reserved.
4
dnl Redistribution and use in source and binary forms, with or without
5
dnl modification, are permitted provided that the following conditions are met:
6
dnl * Redistributions of source code must retain the above copyright
7
dnl notice, this list of conditions and the following disclaimer.
8
dnl * Redistributions in binary form must reproduce the above copyright
9
dnl notice, this list of conditions and the following disclaimer in the
10
dnl documentation and/or other materials provided with the distribution.
11
dnl * Neither the names of Paul Mattes nor the names of his contributors
12
dnl may be used to endorse or promote products derived from this software
13
dnl without specific prior written permission.
15
dnl THIS SOFTWARE IS PROVIDED BY PAUL MATTES "AS IS" AND ANY EXPRESS OR IMPLIED
16
dnl WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17
dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
18
dnl EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19
dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
20
dnl TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21
dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22
dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23
dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
26
dnl Process this file with autoconf to produce a configure script.
46
60
dnl Check for --without-readline
47
61
AC_ARG_WITH(readline, [ --without-readline Don't use the readline library])
49
dnl Check for --without-pr3287
50
AC_ARG_WITH(pr3287,[ --without-pr3287 don't build pr3287])
51
if test -d pr3287 -a "$with_pr3287" != "no"
63
dnl Check for ISO 10646 (wchar_t is Unicode) and --with-iconv
64
AC_CHECK_DECLS(__STDC_ISO_10646__, unset unkw, unkw=1)
65
AC_ARG_WITH(iconv,[ --with-iconv ignore __STDC_ISO_10646__ and use iconv() instead])
69
AC_DEFINE(USE_ICONV,1)
59
75
dnl Check for libraries.
60
76
dnl Note that the order here is important. The last libraries should appear
61
77
dnl first, so that objects in them can be used by subsequent libraries.
62
AC_CHECK_LIB(util, forkpty)
78
AC_SEARCH_LIBS(forkpty, util)
79
AC_CHECK_FUNCS(forkpty)
63
80
AC_CHECK_LIB(ncursesw, newterm, , [AC_CHECK_LIB(ncurses, newterm, , [AC_CHECK_LIB(curses, newterm, , [AC_MSG_ERROR(Can't find libncurses or new-enough libcurses)])])])
64
81
if test "$with_readline" != no; then
65
82
AC_CHECK_LIB(readline, rl_initialize)
67
AC_CHECK_LIB(nsl, gethostbyname)
68
AC_CHECK_LIB(socket, socket)
84
AC_SEARCH_LIBS(gethostbyname, nsl)
85
AC_SEARCH_LIBS(socket, socket)
86
AC_CHECK_HEADERS(iconv.h)
87
AC_SEARCH_LIBS(libiconv, iconv, , AC_SEARCH_LIBS(iconv, iconv, , if test "$unkw"; then AC_MSG_ERROR("No iconv library function"); fi))
70
89
dnl If we're on AIX and have ncurses, cancel BROKEN_NEWTERM.
71
90
if test -n "$BROKEN_NEWTERM"
85
104
AC_CHECK_HEADERS(libutil.h)
86
105
AC_CHECK_HEADERS(util.h)
87
106
AC_CHECK_HEADERS(getopt.h)
88
dnl Check for curses library / header file consistency.
89
if test "$ac_cv_lib_ncursesw_newterm" = yes
90
then AC_CHECK_HEADERS(ncursesw/ncurses.h, , [AC_MSG_ERROR(Found ncursesw library but not <ncursesw/ncurses.h>)])
91
elif test "$ac_cv_lib_ncurses_newterm" = yes
92
then AC_CHECK_HEADERS(ncurses/ncurses.h, , [AC_MSG_ERROR(Found ncurses library but not <ncurses/ncurses.h>)])
93
else AC_CHECK_HEADERS(curses.h, , [AC_MSG_ERROR(Found curses library but not <curses.h>)])
107
dnl Find the best curses header file and hope it's consistent with the library
109
AC_CHECK_HEADERS(ncursesw/ncurses.h, ,
110
[AC_CHECK_HEADERS(ncurses/ncurses.h, ,
111
[AC_CHECK_HEADERS(ncurses.h, ,
112
[AC_CHECK_HEADERS(curses.h, , [AC_MSG_ERROR(No curses header file)])])])])
96
114
dnl Check for SSL header file.
97
115
AC_ARG_WITH(ssl,[ --with-ssl=DIR specify OpenSSL install directory])
128
dnl Check for ICU header file.
129
AC_ARG_WITH(icu,[ --with-icu=DIR specify ICU install directory])
130
if test "$enable_dbcs" = yes
131
then orig_CPPFLAGS="$CPPFLAGS"
133
for dir in "$with_icu" /usr/local /usr/local/icu /usr/lib/icu /usr/pkg/icu /usr/icu /var/icu /opt/icu
135
if test -n "$dir" -a ! -d "$dir/include"
140
then AC_MSG_NOTICE(retrying with -I$dir/include)
143
then CPPFLAGS="$orig_CPPFLAGS -I$dir/include"
145
AC_CHECK_HEADERS(unicode/ucnv.h, ,[header_fail=1])
146
if test "$header_fail" -eq 0
149
unset `echo ac_cv_header_unicode/ucnv_h | $as_tr_sh`
150
CPPFLAGS="$orig_CPPFLAGS"
153
if test $header_fail -eq 1
154
then AC_MSG_WARN(Disabling DBCS)
159
# Figure out the ICU version, which depends on having found the ICU header
161
if test "$enable_dbcs" = "yes"
162
then AC_MSG_CHECKING([for ICU version strings])
163
cat >/tmp/icutst$$.c <<EOF
165
#include "unicode/ucnv.h"
166
#define xstr(s) str(s)
169
main(int argc, char *argv[])
171
printf("%s %s\n", xstr(U_ICU_VERSION_SUFFIX), U_ICUDATA_NAME);
176
${CC} ${CPPFLAGS} -o /tmp/icutst$$ /tmp/icutst$$.c || fail=1
177
rm -f /tmp/icutst$$.c
179
then icu_suffix=`/tmp/icutst$$ | awk '{print $1}'`
180
ICU_DATA_PREFIX=`/tmp/icutst$$ | awk '{print $2}'`
182
if test -z "$icu_suffix" -o -z "$ICU_DATA_PREFIX"
186
if test "$fail" -eq 0
187
then AC_MSG_RESULT([$icu_suffix, $ICU_DATA_PREFIX])
188
else AC_MSG_RESULT([not found])
189
AC_MSG_WARN(Disabling DBCS)
192
if test "$enable_dbcs" = "yes"
193
then icu_enough=`expr $icu_suffix '>=' _2_2`
194
if test $icu_enough -eq 0
195
then AC_MSG_WARN(ICU version must be 2.2 or later)
196
AC_MSG_WARN(Disabling DBCS)
200
if test "$enable_dbcs" != "no"
201
then icu_needp=`expr $icu_suffix '<' _3_6`
202
if test $icu_needp -eq 1
203
then ICU_DASHP="-p $ICU_DATA_PREFIX"
204
ICU_DATA_PREFIX_=${ICU_DATA_PREFIX}_
211
146
dnl Checks for typedefs, structures, and compiler characteristics.
213
148
dnl AC_TYPE_PID_T
260
# Check for ICU libraries.
261
if test "$enable_dbcs" = yes
262
then orig_LDFLAGS="$LDFLAGS"
264
for dir in "$with_icu" /usr/local /usr/local/icu /usr/pkg/icu /usr/icu /var/icu /opt/icu
266
if test -n "$dir" -a ! -d "$dir/lib"
271
then AC_MSG_NOTICE(retrying with -L$dir/lib)
274
then LDFLAGS="$orig_LDFLAGS -L$dir/lib"
276
AC_CHECK_LIB(icui18n, ucnv_open${icu_suffix}, , [lib_fail=1])
277
if test "$lib_fail" -eq 0
280
unset `echo ac_cv_lib_icui18n_ucnv_open${icu_suffix} | $as_tr_sh`
281
LDFLAGS="$orig_LDFLAGS"
284
if test $lib_fail -eq 1
285
then AC_MSG_WARN(Disabling DBCS)
290
195
dnl Check for curses wide character support.
291
if test "ac_cv_lib_ncursesw_newterm" = yes
292
then AC_CHECK_LIB(ncursesw, wadd_wch, [AC_DEFINE(CURSES_WIDE,1)])
293
elif test "ac_cv_lib_ncurses_newterm" = yes
294
then AC_CHECK_LIB(ncurses, wadd_wch, [AC_DEFINE(CURSES_WIDE,1)])
295
elif test "ac_cv_lib_curses_newterm" = yes
296
then AC_CHECK_LIB(curses, wadd_wch, [AC_DEFINE(CURSES_WIDE,1)])
196
if test "$ac_cv_lib_ncursesw_newterm" = yes
197
then AC_CHECK_LIB(ncursesw, wadd_wch, [AC_DEFINE(CURSES_WIDE,1)
199
elif test "$ac_cv_lib_ncurses_newterm" = yes
200
then AC_CHECK_LIB(ncurses, wadd_wch, [AC_DEFINE(CURSES_WIDE,1)
202
elif test "$ac_cv_lib_curses_newterm" = yes
203
then AC_CHECK_LIB(curses, wadd_wch, [AC_DEFINE(CURSES_WIDE,1)
208
then AC_MSG_WARN(Wide curses not found -- c3270 will not be able to support multi-byte character encodings)
298
210
AC_SUBST(CURSES_WIDE)
318
230
""|yes) AC_DEFINE(X3270_APL,1)
321
AC_ARG_ENABLE(dbcs,[ --enable-dbcs include DBCS support])
233
AC_ARG_ENABLE(dbcs,[ --disable-dbcs leave out DBCS support])
322
234
case "$enable_dbcs" in
323
yes) AC_DEFINE(X3270_DBCS,1)
236
*) AC_DEFINE(X3270_DBCS,1)
327
237
DBCS=-DX3270_DBCS=1
335
AC_SUBST(ICU_DATA_PREFIX_)
338
241
AC_ARG_ENABLE(ft,[ --disable-ft leave out file transfer support])
339
242
case "$enable_ft" in