1dnl Copyright (c) 2000-2009, 2014-2018, 2020 Paul Mattes.
2dnl All rights reserved.
3dnl
4dnl Redistribution and use in source and binary forms, with or without
5dnl modification, are permitted provided that the following conditions
6dnl are met:
7dnl     * Redistributions of source code must retain the above copyright
8dnl       notice, this list of conditions and the following disclaimer.
9dnl     * Redistributions in binary form must reproduce the above copyright
10dnl       notice, this list of conditions and the following disclaimer in the
11dnl       documentation and/or other materials provided with the distribution.
12dnl     * Neither the name of Paul Mattes nor his contributors may be used
13dnl       to endorse or promote products derived from this software without
14dnl       specific prior written permission.
15dnl
16dnl THIS SOFTWARE IS PROVIDED BY PAUL MATTES "AS IS" AND ANY EXPRESS
17dnl OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19dnl DISCLAIMED. IN NO EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT,
20dnl INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21dnl (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24dnl STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25dnl IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26dnl POSSIBILITY OF SUCH DAMAGE.
27
28dnl Process this file with autoconf to produce a configure script.
29AC_INIT(s3270,4.0)
30AC_PREREQ(2.50)
31
32dnl Checks for programs.
33AC_PROG_INSTALL
34AC_PROG_CC
35
36dnl Figure out what sort of host and compiler this is.
37AC_CANONICAL_HOST
38ansi="-std=c99 -pedantic"
39case "$host_os" in
40*cygwin*)	ansi=""
41		;;
42solaris2*)	CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
43		;;
44darwin*)	CCOPTIONS="$CPPFLAGS -no-cpp-precomp -Wno-deprecated-declarations"
45		;;
46linux*)		CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE"
47		;;
48esac
49if test "$GCC" = yes
50then	# Add common gcc options, plus flags for dependency generation.
51	CCOPTIONS="$CCOPTIONS -Wall -Wsign-compare $ansi -Wno-variadic-macros -MMD -MP"
52fi
53AC_SUBST(host)
54AC_SUBST(CCOPTIONS)
55
56dnl Check for libraries.
57dnl Note that the order here is important.  The last libraries should appear
58dnl first, so that objects in them can be used by subsequent libraries.
59AC_SEARCH_LIBS(forkpty, util)
60AC_CHECK_FUNCS(forkpty)
61AC_SEARCH_LIBS(gethostbyname, nsl)
62AC_SEARCH_LIBS(socket, socket)
63
64dnl Checks for header files.
65AC_CHECK_HEADERS(sys/select.h)
66AC_CHECK_HEADERS(pty.h)
67AC_CHECK_HEADERS(libutil.h)
68AC_CHECK_HEADERS(util.h)
69AC_CHECK_HEADERS(getopt.h)
70if test "$with_readline" != no; then
71AC_CHECK_HEADERS(readline/history.h)
72fi
73
74dnl Check for --without-readline
75AC_ARG_WITH(readline, [  --without-readline      Don't use the readline library])
76
77dnl Checks for library functions.
78AC_CHECK_FUNCS(vasprintf)
79AC_FUNC_FSEEKO
80if test "$with_readline" != no; then
81AC_CHECK_LIB(readline, rl_initialize)
82fi
83
84dnl Set up the configuration directory.
85LIBX3270DIR='${sysconfdir}/x3270'
86AC_SUBST(LIBX3270DIR)
87
88dnl Check for unwanted parts.
89AC_ARG_ENABLE(dbcs,[  --disable-dbcs          leave out DBCS support])
90case "$enable_dbcs" in
91no)	;;
92*)	AC_DEFINE(X3270_DBCS,1)
93	;;
94esac
95AC_ARG_ENABLE(local_process,[  --disable-local-process leave out local process support])
96case "$enable_local_process" in
97""|yes)	AC_DEFINE(X3270_LOCAL_PROCESS,1)
98	;;
99esac
100AC_ARG_ENABLE(ipv6,[  --disable-ipv6          leave out IPv6 support])
101case "$enable_ipv6" in
102""|yes)	AC_DEFINE(X3270_IPV6,1)
103	;;
104esac
105
106dnl Generate conf.h.
107AC_CONFIG_HEADER(conf.h)
108
109dnl Generate the Makefiles.
110AC_CONFIG_FILES(Makefile Makefile.obj)
111AC_OUTPUT
112