1
dnl Copyright 2000, 2001, 2002, 2003, 2004, 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 x3270 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
7
dnl * Redistributions of source code must retain the above copyright
8
dnl notice, this list of conditions and the following disclaimer.
9
dnl * Redistributions in binary form must reproduce the above copyright
10
dnl notice, this list of conditions and the following disclaimer in the
11
dnl documentation and/or other materials provided with the distribution.
12
dnl * Neither the name of Paul Mattes nor his contributors may be used
13
dnl to endorse or promote products derived from this software without
14
dnl specific prior written permission.
16
dnl THIS SOFTWARE IS PROVIDED BY PAUL MATTES "AS IS" AND ANY EXPRESS
17
dnl OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
dnl DISCLAIMED. IN NO EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT,
20
dnl INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24
dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25
dnl IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
dnl POSSIBILITY OF SUCH DAMAGE.
12
28
dnl Process this file with autoconf to produce a configure script.
57
73
AC_SUBST(DEFINE_UAD)
58
74
AC_SUBST(FALLBACKS_O)
60
dnl Check for --without-pr3287
61
AC_ARG_WITH(pr3287,[ --without-pr3287 don't build pr3287])
62
if test -d pr3287 -a "$with_pr3287" != "no"
63
then DEFINE_PR3287="#define PR3287 1"
65
else DEFINE_PR3287="#undef PR3287"
68
AC_SUBST(DEFINE_PR3287)
70
76
dnl Check for --with-fontdir=DIR
71
77
AC_ARG_WITH(fontdir,[ --with-fontdir=DIR install fonts in directory DIR [DIR=misc]])
72
78
case "$with_fontdir" in
87
93
AC_SUBST(CIFONTDIR)
95
dnl Check for ISO 10646 (wchar_t is Unicode) and --with-iconv
96
AC_CHECK_DECLS(__STDC_ISO_10646__, unset unkw, unkw=1)
97
AC_ARG_WITH(iconv,[ --with-iconv ignore __STDC_ISO_10646__ and use iconv() instead])
101
AC_DEFINE(USE_ICONV,1)
107
dnl Check for --without-xmkmf
108
AC_ARG_WITH(xmkmf,[ --without-xmkmf ignore xmkmf and imake])
109
case "$with_xmkmf" in
89
116
# Set up the configuration directory.
90
LIBX3270DIR='${sysconfdir}/x3270'
117
LIBX3270DIR='${sysconfdir}/3270'
91
118
AC_SUBST(LIBX3270DIR)
93
120
dnl Check for other libraries.
94
121
dnl Note that the order here is important. The last libraries should appear
95
122
dnl first, so that objects in them can be used by subsequent libraries.
96
AC_CHECK_LIB(util, forkpty)
97
AC_CHECK_LIB(nsl_s, gethostbyname)
98
AC_CHECK_LIB(nsl, gethostbyname)
99
AC_CHECK_LIB(socket, socket)
123
AC_SEARCH_LIBS(forkpty, util)
124
AC_CHECK_FUNCS(forkpty)
125
AC_SEARCH_LIBS(gethostbyname, nsl_s nsl)
126
AC_SEARCH_LIBS(socket, socket)
127
AC_CHECK_HEADERS(iconv.h)
128
AC_SEARCH_LIBS(libiconv, iconv, , AC_SEARCH_LIBS(iconv, iconv, , if test "$unkw"; then AC_MSG_ERROR("No iconv library function"); fi))
101
130
dnl Checks for header files.
102
131
dnl AC_HEADER_STDC
143
dnl Check for ICU header file.
144
AC_ARG_WITH(icu,[ --with-icu=DIR specify ICU install directory])
145
if test "$enable_dbcs" != no
146
then orig_CPPFLAGS="$CPPFLAGS"
148
for dir in "$with_icu" /usr/local /usr/local/icu /usr/lib/icu /usr/pkg/icu /usr/icu /var/icu /opt/icu
150
if test -n "$dir" -a ! -d "$dir/include"
155
then AC_MSG_NOTICE(retrying with -I$dir/include)
158
then CPPFLAGS="$orig_CPPFLAGS -I$dir/include"
160
AC_CHECK_HEADERS(unicode/ucnv.h, ,[header_fail=1])
161
if test "$header_fail" -eq 0
164
unset `echo ac_cv_header_unicode/ucnv_h | $as_tr_sh`
165
CPPFLAGS="$orig_CPPFLAGS"
168
if test $header_fail -eq 1
169
then AC_MSG_WARN(Disabling DBCS)
174
# Figure out the ICU version, which depends on having found the ICU header
176
if test "$enable_dbcs" != "no"
177
then AC_MSG_CHECKING([for ICU version strings])
178
cat >/tmp/icutst$$.c <<EOF
180
#include "unicode/ucnv.h"
181
#define xstr(s) str(s)
184
main(int argc, char *argv[])
186
printf("%s %s\n", xstr(U_ICU_VERSION_SUFFIX), U_ICUDATA_NAME);
191
${CC} ${CPPFLAGS} -o /tmp/icutst$$ /tmp/icutst$$.c || fail=1
192
rm -f /tmp/icutst$$.c
194
then icu_suffix=`/tmp/icutst$$ | awk '{print $1}'`
195
ICU_DATA_PREFIX=`/tmp/icutst$$ | awk '{print $2}'`
197
if test -z "$icu_suffix" -o -z "$ICU_DATA_PREFIX"
201
if test "$fail" -eq 0
202
then AC_MSG_RESULT([$icu_suffix, $ICU_DATA_PREFIX])
203
else AC_MSG_RESULT([not found])
204
AC_MSG_WARN(Disabling DBCS)
207
if test "$enable_dbcs" != "no"
208
then icu_enough=`expr $icu_suffix '>=' _2_2`
209
if test $icu_enough -eq 0
210
then AC_MSG_WARN(ICU version must be 2.2 or later)
211
AC_MSG_WARN(Disabling DBCS)
215
if test "$enable_dbcs" != "no"
216
then icu_needp=`expr $icu_suffix '<' _3_6`
217
if test $icu_needp -eq 1
218
then ICU_DASHP="-p $ICU_DATA_PREFIX"
219
ICU_DATA_PREFIX_=${ICU_DATA_PREFIX}_
226
172
dnl Checks for typedefs, structures, and compiler characteristics.
228
174
dnl AC_TYPE_PID_T
278
# Check for ICU libraries.
279
if test "$enable_dbcs" != no
280
then orig_LDFLAGS="$LDFLAGS"
282
is_icu3=`expr $icu_suffix '>=' _3_0`
283
if test $is_icu3 -eq 1
289
for dir in "$with_icu" /usr/local /usr/local/icu /usr/pkg/icu /usr/icu /var/icu /opt/icu
291
if test -n "$dir" -a ! -d "$dir/lib"
296
then AC_MSG_NOTICE(retrying with -L$dir/lib)
299
then LDFLAGS="$orig_LDFLAGS -L$dir/lib"
301
# Try with the suffix
302
AC_CHECK_LIB($iculib, ucnv_open${icu_suffix}, , [lib_fail=1], $icudata)
303
if test "$lib_fail" -eq 0
306
unset `echo ac_cv_lib_lib${iculib}_ucnv_open${icu_suffix} | $as_tr_sh`
307
LDFLAGS="$orig_LDFLAGS"
308
# Try without the suffix
310
AC_CHECK_LIB($iculib, ucnv_open, , [lib_fail=1], $icudata)
311
if test "$lib_fail" -eq 0
314
unset `echo ac_cv_lib_lib${iculib}_ucnv_open | $as_tr_sh`
315
LDFLAGS="$orig_LDFLAGS"
318
if test $lib_fail -eq 1
319
then AC_MSG_WARN(Disabling DBCS)
224
dnl Check for xmkmkf or bdftopcf and mkfontdir
226
then xmkmf_found="notfound"
227
else AC_CHECK_PROG(xmkmf_found,xmkmf,found,notfound)
228
dnl if test "$xmkmf_found" = "notfound"
229
dnl then AC_MSG_ERROR('Cannot find xmkmf')
325
AC_CHECK_PROG(xmkmf_found,xmkmf,found,notfound)
326
232
if test "$xmkmf_found" = "notfound"
327
then AC_MSG_ERROR('Cannot find xmkmf')
233
then AC_CHECK_PROG(bdftopcf_found,bdftopcf,found,notfound)
234
if test "$bdftopcf_found" = "notfound"
235
then AC_MSG_ERROR('Cannot find bdftopcf')
237
AC_CHECK_PROG(mkfontdir_found,mkfontdir,found,notfound)
238
if test "$mkfontdir_found" = "notfound"
239
then AC_MSG_ERROR('Cannot find mkfontdir')
330
243
dnl Check for unwanted parts.
411
dnl Save a copy of Imakefile
413
then cp Imakefile Imakefile.old
416
dnl Generate the Imakefile and the pr3287 Makefile.
417
AC_OUTPUT(Imakefile $pr3mf)
419
dnl Generate the Makefile
421
if test ! -f Makefile; then gen_Makefile=1; fi
422
if cmp Imakefile.old Imakefile 1>/dev/null 2>/dev/null; then :; else gen_Makefile=1; fi
423
if test "$gen_Makefile"
424
then echo "generating Makefile"
426
# Get rid of the @ that AIX puts in the Makefile
427
sed 's/@@*for/for/' Makefile >Makefile.aixfix
428
if cmp -s Makefile Makefile.aixfix
429
then rm Makefile.aixfix
430
else mv Makefile.aixfix Makefile
432
else echo "Makefile is unchanged"
314
if test "$xmkmf_found" = "notfound"
315
then dnl Generate the Makefile directly.
316
if test "$x_includes"
317
then XINC=-I$x_includes
319
if test "$x_libraries"
320
then XLIB=-L$x_libraries
327
dnl Save a copy of Imakefile
329
then cp Imakefile Imakefile.old
332
dnl Generate the Imakefile.
335
dnl Generate the Makefile
337
if test ! -f Makefile; then gen_Makefile=1; fi
338
if cmp Imakefile.old Imakefile 1>/dev/null 2>/dev/null; then :; else gen_Makefile=1; fi
339
if test "$gen_Makefile"
340
then echo "generating Makefile"
342
# Get rid of the @ that AIX puts in the Makefile
343
sed 's/@@*for/for/' Makefile >Makefile.aixfix
344
if cmp -s Makefile Makefile.aixfix
345
then rm Makefile.aixfix
346
else mv Makefile.aixfix Makefile
348
else echo "Makefile is unchanged"