1*4882a593SmuzhiyunFrom c5e5d7e93c6f3302adf5821c29c4efdb7630e418 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Darik Horn <dajhorn@vanadac.com>
3*4882a593SmuzhiyunDate: Sat, 12 Apr 2014 17:46:04 -0400
4*4882a593SmuzhiyunSubject: [PATCH] Create autotools plumbing for SoftEther.
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunAdd autoconf and automake capabilities to SoftEther so that it can be built
7*4882a593Smuzhiyunlike this:
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun	# autoreconf --force --install
10*4882a593Smuzhiyun	# ./configure
11*4882a593Smuzhiyun	# make install DESTDIR=/tmp/softether
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunAll standard configure parameters are supported, plus:
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun	# ./configure --enable-debug
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunAutotools support makes porting, cross compiling, and optimization much easier.
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunThese GNU autoconf-archive components are used for dependency checking:
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun  * ax_check_openssl.m4
22*4882a593Smuzhiyun  * ax_check_zlib.m4
23*4882a593Smuzhiyun  * ax_lib_readline.m4
24*4882a593Smuzhiyun  * ax_pthread.m4
25*4882a593Smuzhiyun  * ax_with_curses.m4
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunNB: http://www.gnu.org/software/autoconf-archive/
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun[Upstream commit: https://github.com/dajhorn/SoftEtherVPN/commit/c5e5d7e93c6f3302adf5821c29c4efdb7630e418]
30*4882a593SmuzhiyunSigned-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
31*4882a593Smuzhiyun[Fabrice: update for 4.30-9700-beta]
32*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
33*4882a593Smuzhiyun---
34*4882a593Smuzhiyun Makefile.am                    |  21 ++
35*4882a593Smuzhiyun autotools/ax_check_openssl.m4  | 124 ++++++++++
36*4882a593Smuzhiyun autotools/ax_check_zlib.m4     | 142 +++++++++++
37*4882a593Smuzhiyun autotools/ax_lib_readline.m4   | 107 +++++++++
38*4882a593Smuzhiyun autotools/ax_pthread.m4        | 332 ++++++++++++++++++++++++++
39*4882a593Smuzhiyun autotools/ax_with_curses.m4    | 518 +++++++++++++++++++++++++++++++++++++++++
40*4882a593Smuzhiyun autotools/softether.am         |  39 ++++
41*4882a593Smuzhiyun configure.ac                   |  96 ++++++++
42*4882a593Smuzhiyun configure => manual_configure  |   0
43*4882a593Smuzhiyun src/Cedar/Makefile.am          |  82 +++++++
44*4882a593Smuzhiyun src/Makefile.am                |  26 +++
45*4882a593Smuzhiyun src/Mayaqua/Makefile.am        |  43 ++++
46*4882a593Smuzhiyun src/bin/hamcore/Makefile.am    |  29 +++
47*4882a593Smuzhiyun src/hamcorebuilder/Makefile.am |  29 +++
48*4882a593Smuzhiyun src/vpnbridge/Makefile.am      |  29 +++
49*4882a593Smuzhiyun src/vpnclient/Makefile.am      |  29 +++
50*4882a593Smuzhiyun src/vpncmd/Makefile.am         |  29 +++
51*4882a593Smuzhiyun src/vpnserver/Makefile.am      |  29 +++
52*4882a593Smuzhiyun 18 files changed, 1704 insertions(+)
53*4882a593Smuzhiyun create mode 100644 Makefile.am
54*4882a593Smuzhiyun create mode 100644 autotools/ax_check_openssl.m4
55*4882a593Smuzhiyun create mode 100644 autotools/ax_check_zlib.m4
56*4882a593Smuzhiyun create mode 100644 autotools/ax_lib_readline.m4
57*4882a593Smuzhiyun create mode 100644 autotools/ax_pthread.m4
58*4882a593Smuzhiyun create mode 100644 autotools/ax_with_curses.m4
59*4882a593Smuzhiyun create mode 100644 autotools/softether.am
60*4882a593Smuzhiyun create mode 100644 configure.ac
61*4882a593Smuzhiyun rename configure => manual_configure (100%)
62*4882a593Smuzhiyun create mode 100644 src/Cedar/Makefile.am
63*4882a593Smuzhiyun create mode 100644 src/Makefile.am
64*4882a593Smuzhiyun create mode 100644 src/Mayaqua/Makefile.am
65*4882a593Smuzhiyun create mode 100644 src/bin/hamcore/Makefile.am
66*4882a593Smuzhiyun create mode 100644 src/hamcorebuilder/Makefile.am
67*4882a593Smuzhiyun create mode 100644 src/vpnbridge/Makefile.am
68*4882a593Smuzhiyun create mode 100644 src/vpnclient/Makefile.am
69*4882a593Smuzhiyun create mode 100644 src/vpncmd/Makefile.am
70*4882a593Smuzhiyun create mode 100644 src/vpnserver/Makefile.am
71*4882a593Smuzhiyun
72*4882a593Smuzhiyundiff --git a/Makefile.am b/Makefile.am
73*4882a593Smuzhiyunnew file mode 100644
74*4882a593Smuzhiyunindex 00000000..aa73b2ba
75*4882a593Smuzhiyun--- /dev/null
76*4882a593Smuzhiyun+++ b/Makefile.am
77*4882a593Smuzhiyun@@ -0,0 +1,21 @@
78*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
79*4882a593Smuzhiyun+#
80*4882a593Smuzhiyun+#  This file is part of SoftEther.
81*4882a593Smuzhiyun+#
82*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
83*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
84*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
85*4882a593Smuzhiyun+#  any later version.
86*4882a593Smuzhiyun+#
87*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
88*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
89*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
90*4882a593Smuzhiyun+#  details.
91*4882a593Smuzhiyun+#
92*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
93*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
94*4882a593Smuzhiyun+
95*4882a593Smuzhiyun+
96*4882a593Smuzhiyun+ACLOCAL_AMFLAGS = -I autotools
97*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
98*4882a593Smuzhiyun+SUBDIRS = src
99*4882a593Smuzhiyundiff --git a/autotools/ax_check_openssl.m4 b/autotools/ax_check_openssl.m4
100*4882a593Smuzhiyunnew file mode 100644
101*4882a593Smuzhiyunindex 00000000..a87c5a6b
102*4882a593Smuzhiyun--- /dev/null
103*4882a593Smuzhiyun+++ b/autotools/ax_check_openssl.m4
104*4882a593Smuzhiyun@@ -0,0 +1,124 @@
105*4882a593Smuzhiyun+# ===========================================================================
106*4882a593Smuzhiyun+#     http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
107*4882a593Smuzhiyun+# ===========================================================================
108*4882a593Smuzhiyun+#
109*4882a593Smuzhiyun+# SYNOPSIS
110*4882a593Smuzhiyun+#
111*4882a593Smuzhiyun+#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
112*4882a593Smuzhiyun+#
113*4882a593Smuzhiyun+# DESCRIPTION
114*4882a593Smuzhiyun+#
115*4882a593Smuzhiyun+#   Look for OpenSSL in a number of default spots, or in a user-selected
116*4882a593Smuzhiyun+#   spot (via --with-openssl).  Sets
117*4882a593Smuzhiyun+#
118*4882a593Smuzhiyun+#     OPENSSL_INCLUDES to the include directives required
119*4882a593Smuzhiyun+#     OPENSSL_LIBS to the -l directives required
120*4882a593Smuzhiyun+#     OPENSSL_LDFLAGS to the -L or -R flags required
121*4882a593Smuzhiyun+#
122*4882a593Smuzhiyun+#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
123*4882a593Smuzhiyun+#
124*4882a593Smuzhiyun+#   This macro sets OPENSSL_INCLUDES such that source files should use the
125*4882a593Smuzhiyun+#   openssl/ directory in include directives:
126*4882a593Smuzhiyun+#
127*4882a593Smuzhiyun+#     #include <openssl/hmac.h>
128*4882a593Smuzhiyun+#
129*4882a593Smuzhiyun+# LICENSE
130*4882a593Smuzhiyun+#
131*4882a593Smuzhiyun+#   Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
132*4882a593Smuzhiyun+#   Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
133*4882a593Smuzhiyun+#
134*4882a593Smuzhiyun+#   Copying and distribution of this file, with or without modification, are
135*4882a593Smuzhiyun+#   permitted in any medium without royalty provided the copyright notice
136*4882a593Smuzhiyun+#   and this notice are preserved. This file is offered as-is, without any
137*4882a593Smuzhiyun+#   warranty.
138*4882a593Smuzhiyun+
139*4882a593Smuzhiyun+#serial 8
140*4882a593Smuzhiyun+
141*4882a593Smuzhiyun+AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
142*4882a593Smuzhiyun+AC_DEFUN([AX_CHECK_OPENSSL], [
143*4882a593Smuzhiyun+    found=false
144*4882a593Smuzhiyun+    AC_ARG_WITH([openssl],
145*4882a593Smuzhiyun+        [AS_HELP_STRING([--with-openssl=DIR],
146*4882a593Smuzhiyun+            [root of the OpenSSL directory])],
147*4882a593Smuzhiyun+        [
148*4882a593Smuzhiyun+            case "$withval" in
149*4882a593Smuzhiyun+            "" | y | ye | yes | n | no)
150*4882a593Smuzhiyun+            AC_MSG_ERROR([Invalid --with-openssl value])
151*4882a593Smuzhiyun+              ;;
152*4882a593Smuzhiyun+            *) ssldirs="$withval"
153*4882a593Smuzhiyun+              ;;
154*4882a593Smuzhiyun+            esac
155*4882a593Smuzhiyun+        ], [
156*4882a593Smuzhiyun+            # if pkg-config is installed and openssl has installed a .pc file,
157*4882a593Smuzhiyun+            # then use that information and don't search ssldirs
158*4882a593Smuzhiyun+            AC_PATH_PROG([PKG_CONFIG], [pkg-config])
159*4882a593Smuzhiyun+            if test x"$PKG_CONFIG" != x""; then
160*4882a593Smuzhiyun+                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
161*4882a593Smuzhiyun+                if test $? = 0; then
162*4882a593Smuzhiyun+                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
163*4882a593Smuzhiyun+                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
164*4882a593Smuzhiyun+                    found=true
165*4882a593Smuzhiyun+                fi
166*4882a593Smuzhiyun+            fi
167*4882a593Smuzhiyun+
168*4882a593Smuzhiyun+            # no such luck; use some default ssldirs
169*4882a593Smuzhiyun+            if ! $found; then
170*4882a593Smuzhiyun+                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
171*4882a593Smuzhiyun+            fi
172*4882a593Smuzhiyun+        ]
173*4882a593Smuzhiyun+        )
174*4882a593Smuzhiyun+
175*4882a593Smuzhiyun+
176*4882a593Smuzhiyun+    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
177*4882a593Smuzhiyun+    # an 'openssl' subdirectory
178*4882a593Smuzhiyun+
179*4882a593Smuzhiyun+    if ! $found; then
180*4882a593Smuzhiyun+        OPENSSL_INCLUDES=
181*4882a593Smuzhiyun+        for ssldir in $ssldirs; do
182*4882a593Smuzhiyun+            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
183*4882a593Smuzhiyun+            if test -f "$ssldir/include/openssl/ssl.h"; then
184*4882a593Smuzhiyun+                OPENSSL_INCLUDES="-I$ssldir/include"
185*4882a593Smuzhiyun+                OPENSSL_LDFLAGS="-L$ssldir/lib"
186*4882a593Smuzhiyun+                OPENSSL_LIBS="-lssl -lcrypto"
187*4882a593Smuzhiyun+                found=true
188*4882a593Smuzhiyun+                AC_MSG_RESULT([yes])
189*4882a593Smuzhiyun+                break
190*4882a593Smuzhiyun+            else
191*4882a593Smuzhiyun+                AC_MSG_RESULT([no])
192*4882a593Smuzhiyun+            fi
193*4882a593Smuzhiyun+        done
194*4882a593Smuzhiyun+
195*4882a593Smuzhiyun+        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
196*4882a593Smuzhiyun+        # it will just work!
197*4882a593Smuzhiyun+    fi
198*4882a593Smuzhiyun+
199*4882a593Smuzhiyun+    # try the preprocessor and linker with our new flags,
200*4882a593Smuzhiyun+    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
201*4882a593Smuzhiyun+
202*4882a593Smuzhiyun+    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
203*4882a593Smuzhiyun+    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
204*4882a593Smuzhiyun+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
205*4882a593Smuzhiyun+
206*4882a593Smuzhiyun+    save_LIBS="$LIBS"
207*4882a593Smuzhiyun+    save_LDFLAGS="$LDFLAGS"
208*4882a593Smuzhiyun+    save_CPPFLAGS="$CPPFLAGS"
209*4882a593Smuzhiyun+    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
210*4882a593Smuzhiyun+    LIBS="$OPENSSL_LIBS $LIBS"
211*4882a593Smuzhiyun+    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
212*4882a593Smuzhiyun+    AC_LINK_IFELSE(
213*4882a593Smuzhiyun+        [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
214*4882a593Smuzhiyun+        [
215*4882a593Smuzhiyun+            AC_MSG_RESULT([yes])
216*4882a593Smuzhiyun+            $1
217*4882a593Smuzhiyun+        ], [
218*4882a593Smuzhiyun+            AC_MSG_RESULT([no])
219*4882a593Smuzhiyun+            $2
220*4882a593Smuzhiyun+        ])
221*4882a593Smuzhiyun+    CPPFLAGS="$save_CPPFLAGS"
222*4882a593Smuzhiyun+    LDFLAGS="$save_LDFLAGS"
223*4882a593Smuzhiyun+    LIBS="$save_LIBS"
224*4882a593Smuzhiyun+
225*4882a593Smuzhiyun+    AC_SUBST([OPENSSL_INCLUDES])
226*4882a593Smuzhiyun+    AC_SUBST([OPENSSL_LIBS])
227*4882a593Smuzhiyun+    AC_SUBST([OPENSSL_LDFLAGS])
228*4882a593Smuzhiyun+])
229*4882a593Smuzhiyundiff --git a/autotools/ax_check_zlib.m4 b/autotools/ax_check_zlib.m4
230*4882a593Smuzhiyunnew file mode 100644
231*4882a593Smuzhiyunindex 00000000..ae5705f6
232*4882a593Smuzhiyun--- /dev/null
233*4882a593Smuzhiyun+++ b/autotools/ax_check_zlib.m4
234*4882a593Smuzhiyun@@ -0,0 +1,142 @@
235*4882a593Smuzhiyun+# ===========================================================================
236*4882a593Smuzhiyun+#       http://www.gnu.org/software/autoconf-archive/ax_check_zlib.html
237*4882a593Smuzhiyun+# ===========================================================================
238*4882a593Smuzhiyun+#
239*4882a593Smuzhiyun+# SYNOPSIS
240*4882a593Smuzhiyun+#
241*4882a593Smuzhiyun+#   AX_CHECK_ZLIB([action-if-found], [action-if-not-found])
242*4882a593Smuzhiyun+#
243*4882a593Smuzhiyun+# DESCRIPTION
244*4882a593Smuzhiyun+#
245*4882a593Smuzhiyun+#   This macro searches for an installed zlib library. If nothing was
246*4882a593Smuzhiyun+#   specified when calling configure, it searches first in /usr/local and
247*4882a593Smuzhiyun+#   then in /usr, /opt/local and /sw. If the --with-zlib=DIR is specified,
248*4882a593Smuzhiyun+#   it will try to find it in DIR/include/zlib.h and DIR/lib/libz.a. If
249*4882a593Smuzhiyun+#   --without-zlib is specified, the library is not searched at all.
250*4882a593Smuzhiyun+#
251*4882a593Smuzhiyun+#   If either the header file (zlib.h) or the library (libz) is not found,
252*4882a593Smuzhiyun+#   shell commands 'action-if-not-found' is run. If 'action-if-not-found' is
253*4882a593Smuzhiyun+#   not specified, the configuration exits on error, asking for a valid zlib
254*4882a593Smuzhiyun+#   installation directory or --without-zlib.
255*4882a593Smuzhiyun+#
256*4882a593Smuzhiyun+#   If both header file and library are found, shell commands
257*4882a593Smuzhiyun+#   'action-if-found' is run. If 'action-if-found' is not specified, the
258*4882a593Smuzhiyun+#   default action appends '-I${ZLIB_HOME}/include' to CPFLAGS, appends
259*4882a593Smuzhiyun+#   '-L$ZLIB_HOME}/lib' to LDFLAGS, prepends '-lz' to LIBS, and calls
260*4882a593Smuzhiyun+#   AC_DEFINE(HAVE_LIBZ). You should use autoheader to include a definition
261*4882a593Smuzhiyun+#   for this symbol in a config.h file. Sample usage in a C/C++ source is as
262*4882a593Smuzhiyun+#   follows:
263*4882a593Smuzhiyun+#
264*4882a593Smuzhiyun+#     #ifdef HAVE_LIBZ
265*4882a593Smuzhiyun+#     #include <zlib.h>
266*4882a593Smuzhiyun+#     #endif /* HAVE_LIBZ */
267*4882a593Smuzhiyun+#
268*4882a593Smuzhiyun+# LICENSE
269*4882a593Smuzhiyun+#
270*4882a593Smuzhiyun+#   Copyright (c) 2008 Loic Dachary <loic@senga.org>
271*4882a593Smuzhiyun+#   Copyright (c) 2010 Bastien Chevreux <bach@chevreux.org>
272*4882a593Smuzhiyun+#
273*4882a593Smuzhiyun+#   This program is free software; you can redistribute it and/or modify it
274*4882a593Smuzhiyun+#   under the terms of the GNU General Public License as published by the
275*4882a593Smuzhiyun+#   Free Software Foundation; either version 2 of the License, or (at your
276*4882a593Smuzhiyun+#   option) any later version.
277*4882a593Smuzhiyun+#
278*4882a593Smuzhiyun+#   This program is distributed in the hope that it will be useful, but
279*4882a593Smuzhiyun+#   WITHOUT ANY WARRANTY; without even the implied warranty of
280*4882a593Smuzhiyun+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
281*4882a593Smuzhiyun+#   Public License for more details.
282*4882a593Smuzhiyun+#
283*4882a593Smuzhiyun+#   You should have received a copy of the GNU General Public License along
284*4882a593Smuzhiyun+#   with this program. If not, see <http://www.gnu.org/licenses/>.
285*4882a593Smuzhiyun+#
286*4882a593Smuzhiyun+#   As a special exception, the respective Autoconf Macro's copyright owner
287*4882a593Smuzhiyun+#   gives unlimited permission to copy, distribute and modify the configure
288*4882a593Smuzhiyun+#   scripts that are the output of Autoconf when processing the Macro. You
289*4882a593Smuzhiyun+#   need not follow the terms of the GNU General Public License when using
290*4882a593Smuzhiyun+#   or distributing such scripts, even though portions of the text of the
291*4882a593Smuzhiyun+#   Macro appear in them. The GNU General Public License (GPL) does govern
292*4882a593Smuzhiyun+#   all other use of the material that constitutes the Autoconf Macro.
293*4882a593Smuzhiyun+#
294*4882a593Smuzhiyun+#   This special exception to the GPL applies to versions of the Autoconf
295*4882a593Smuzhiyun+#   Macro released by the Autoconf Archive. When you make and distribute a
296*4882a593Smuzhiyun+#   modified version of the Autoconf Macro, you may extend this special
297*4882a593Smuzhiyun+#   exception to the GPL to apply to your modified version as well.
298*4882a593Smuzhiyun+
299*4882a593Smuzhiyun+#serial 14
300*4882a593Smuzhiyun+
301*4882a593Smuzhiyun+AU_ALIAS([CHECK_ZLIB], [AX_CHECK_ZLIB])
302*4882a593Smuzhiyun+AC_DEFUN([AX_CHECK_ZLIB],
303*4882a593Smuzhiyun+#
304*4882a593Smuzhiyun+# Handle user hints
305*4882a593Smuzhiyun+#
306*4882a593Smuzhiyun+[AC_MSG_CHECKING(if zlib is wanted)
307*4882a593Smuzhiyun+zlib_places="/usr/local /usr /opt/local /sw"
308*4882a593Smuzhiyun+AC_ARG_WITH([zlib],
309*4882a593Smuzhiyun+[  --with-zlib=DIR         root directory path of zlib installation @<:@defaults to
310*4882a593Smuzhiyun+                          /usr/local or /usr if not found in /usr/local@:>@
311*4882a593Smuzhiyun+  --without-zlib          to disable zlib usage completely],
312*4882a593Smuzhiyun+[if test "$withval" != no ; then
313*4882a593Smuzhiyun+  AC_MSG_RESULT(yes)
314*4882a593Smuzhiyun+  if test -d "$withval"
315*4882a593Smuzhiyun+  then
316*4882a593Smuzhiyun+    zlib_places="$withval $zlib_places"
317*4882a593Smuzhiyun+  else
318*4882a593Smuzhiyun+    AC_MSG_WARN([Sorry, $withval does not exist, checking usual places])
319*4882a593Smuzhiyun+  fi
320*4882a593Smuzhiyun+else
321*4882a593Smuzhiyun+  zlib_places=
322*4882a593Smuzhiyun+  AC_MSG_RESULT(no)
323*4882a593Smuzhiyun+fi],
324*4882a593Smuzhiyun+[AC_MSG_RESULT(yes)])
325*4882a593Smuzhiyun+
326*4882a593Smuzhiyun+#
327*4882a593Smuzhiyun+# Locate zlib, if wanted
328*4882a593Smuzhiyun+#
329*4882a593Smuzhiyun+if test -n "${zlib_places}"
330*4882a593Smuzhiyun+then
331*4882a593Smuzhiyun+	# check the user supplied or any other more or less 'standard' place:
332*4882a593Smuzhiyun+	#   Most UNIX systems      : /usr/local and /usr
333*4882a593Smuzhiyun+	#   MacPorts / Fink on OSX : /opt/local respectively /sw
334*4882a593Smuzhiyun+	for ZLIB_HOME in ${zlib_places} ; do
335*4882a593Smuzhiyun+	  if test -f "${ZLIB_HOME}/include/zlib.h"; then break; fi
336*4882a593Smuzhiyun+	  ZLIB_HOME=""
337*4882a593Smuzhiyun+	done
338*4882a593Smuzhiyun+
339*4882a593Smuzhiyun+  ZLIB_OLD_LDFLAGS=$LDFLAGS
340*4882a593Smuzhiyun+  ZLIB_OLD_CPPFLAGS=$CPPFLAGS
341*4882a593Smuzhiyun+  if test -n "${ZLIB_HOME}"; then
342*4882a593Smuzhiyun+        LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
343*4882a593Smuzhiyun+        CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
344*4882a593Smuzhiyun+  fi
345*4882a593Smuzhiyun+  AC_LANG_SAVE
346*4882a593Smuzhiyun+  AC_LANG_C
347*4882a593Smuzhiyun+  AC_CHECK_LIB([z], [inflateEnd], [zlib_cv_libz=yes], [zlib_cv_libz=no])
348*4882a593Smuzhiyun+  AC_CHECK_HEADER([zlib.h], [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
349*4882a593Smuzhiyun+  AC_LANG_RESTORE
350*4882a593Smuzhiyun+  if test "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes"
351*4882a593Smuzhiyun+  then
352*4882a593Smuzhiyun+    #
353*4882a593Smuzhiyun+    # If both library and header were found, action-if-found
354*4882a593Smuzhiyun+    #
355*4882a593Smuzhiyun+    m4_ifblank([$1],[
356*4882a593Smuzhiyun+                CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
357*4882a593Smuzhiyun+                LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
358*4882a593Smuzhiyun+                LIBS="-lz $LIBS"
359*4882a593Smuzhiyun+                AC_DEFINE([HAVE_LIBZ], [1],
360*4882a593Smuzhiyun+                          [Define to 1 if you have `z' library (-lz)])
361*4882a593Smuzhiyun+               ],[
362*4882a593Smuzhiyun+                # Restore variables
363*4882a593Smuzhiyun+                LDFLAGS="$ZLIB_OLD_LDFLAGS"
364*4882a593Smuzhiyun+                CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
365*4882a593Smuzhiyun+                $1
366*4882a593Smuzhiyun+               ])
367*4882a593Smuzhiyun+  else
368*4882a593Smuzhiyun+    #
369*4882a593Smuzhiyun+    # If either header or library was not found, action-if-not-found
370*4882a593Smuzhiyun+    #
371*4882a593Smuzhiyun+    m4_default([$2],[
372*4882a593Smuzhiyun+                AC_MSG_ERROR([either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib])
373*4882a593Smuzhiyun+                ])
374*4882a593Smuzhiyun+  fi
375*4882a593Smuzhiyun+fi
376*4882a593Smuzhiyun+])
377*4882a593Smuzhiyundiff --git a/autotools/ax_lib_readline.m4 b/autotools/ax_lib_readline.m4
378*4882a593Smuzhiyunnew file mode 100644
379*4882a593Smuzhiyunindex 00000000..056f25c2
380*4882a593Smuzhiyun--- /dev/null
381*4882a593Smuzhiyun+++ b/autotools/ax_lib_readline.m4
382*4882a593Smuzhiyun@@ -0,0 +1,107 @@
383*4882a593Smuzhiyun+# ===========================================================================
384*4882a593Smuzhiyun+#      http://www.gnu.org/software/autoconf-archive/ax_lib_readline.html
385*4882a593Smuzhiyun+# ===========================================================================
386*4882a593Smuzhiyun+#
387*4882a593Smuzhiyun+# SYNOPSIS
388*4882a593Smuzhiyun+#
389*4882a593Smuzhiyun+#   AX_LIB_READLINE
390*4882a593Smuzhiyun+#
391*4882a593Smuzhiyun+# DESCRIPTION
392*4882a593Smuzhiyun+#
393*4882a593Smuzhiyun+#   Searches for a readline compatible library. If found, defines
394*4882a593Smuzhiyun+#   `HAVE_LIBREADLINE'. If the found library has the `add_history' function,
395*4882a593Smuzhiyun+#   sets also `HAVE_READLINE_HISTORY'. Also checks for the locations of the
396*4882a593Smuzhiyun+#   necessary include files and sets `HAVE_READLINE_H' or
397*4882a593Smuzhiyun+#   `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or
398*4882a593Smuzhiyun+#   'HAVE_HISTORY_H' if the corresponding include files exists.
399*4882a593Smuzhiyun+#
400*4882a593Smuzhiyun+#   The libraries that may be readline compatible are `libedit',
401*4882a593Smuzhiyun+#   `libeditline' and `libreadline'. Sometimes we need to link a termcap
402*4882a593Smuzhiyun+#   library for readline to work, this macro tests these cases too by trying
403*4882a593Smuzhiyun+#   to link with `libtermcap', `libcurses' or `libncurses' before giving up.
404*4882a593Smuzhiyun+#
405*4882a593Smuzhiyun+#   Here is an example of how to use the information provided by this macro
406*4882a593Smuzhiyun+#   to perform the necessary includes or declarations in a C file:
407*4882a593Smuzhiyun+#
408*4882a593Smuzhiyun+#     #ifdef HAVE_LIBREADLINE
409*4882a593Smuzhiyun+#     #  if defined(HAVE_READLINE_READLINE_H)
410*4882a593Smuzhiyun+#     #    include <readline/readline.h>
411*4882a593Smuzhiyun+#     #  elif defined(HAVE_READLINE_H)
412*4882a593Smuzhiyun+#     #    include <readline.h>
413*4882a593Smuzhiyun+#     #  else /* !defined(HAVE_READLINE_H) */
414*4882a593Smuzhiyun+#     extern char *readline ();
415*4882a593Smuzhiyun+#     #  endif /* !defined(HAVE_READLINE_H) */
416*4882a593Smuzhiyun+#     char *cmdline = NULL;
417*4882a593Smuzhiyun+#     #else /* !defined(HAVE_READLINE_READLINE_H) */
418*4882a593Smuzhiyun+#       /* no readline */
419*4882a593Smuzhiyun+#     #endif /* HAVE_LIBREADLINE */
420*4882a593Smuzhiyun+#
421*4882a593Smuzhiyun+#     #ifdef HAVE_READLINE_HISTORY
422*4882a593Smuzhiyun+#     #  if defined(HAVE_READLINE_HISTORY_H)
423*4882a593Smuzhiyun+#     #    include <readline/history.h>
424*4882a593Smuzhiyun+#     #  elif defined(HAVE_HISTORY_H)
425*4882a593Smuzhiyun+#     #    include <history.h>
426*4882a593Smuzhiyun+#     #  else /* !defined(HAVE_HISTORY_H) */
427*4882a593Smuzhiyun+#     extern void add_history ();
428*4882a593Smuzhiyun+#     extern int write_history ();
429*4882a593Smuzhiyun+#     extern int read_history ();
430*4882a593Smuzhiyun+#     #  endif /* defined(HAVE_READLINE_HISTORY_H) */
431*4882a593Smuzhiyun+#       /* no history */
432*4882a593Smuzhiyun+#     #endif /* HAVE_READLINE_HISTORY */
433*4882a593Smuzhiyun+#
434*4882a593Smuzhiyun+# LICENSE
435*4882a593Smuzhiyun+#
436*4882a593Smuzhiyun+#   Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
437*4882a593Smuzhiyun+#
438*4882a593Smuzhiyun+#   Copying and distribution of this file, with or without modification, are
439*4882a593Smuzhiyun+#   permitted in any medium without royalty provided the copyright notice
440*4882a593Smuzhiyun+#   and this notice are preserved. This file is offered as-is, without any
441*4882a593Smuzhiyun+#   warranty.
442*4882a593Smuzhiyun+
443*4882a593Smuzhiyun+#serial 6
444*4882a593Smuzhiyun+
445*4882a593Smuzhiyun+AU_ALIAS([VL_LIB_READLINE], [AX_LIB_READLINE])
446*4882a593Smuzhiyun+AC_DEFUN([AX_LIB_READLINE], [
447*4882a593Smuzhiyun+  AC_CACHE_CHECK([for a readline compatible library],
448*4882a593Smuzhiyun+                 ax_cv_lib_readline, [
449*4882a593Smuzhiyun+    ORIG_LIBS="$LIBS"
450*4882a593Smuzhiyun+    for readline_lib in readline edit editline; do
451*4882a593Smuzhiyun+      for termcap_lib in "" termcap curses ncurses; do
452*4882a593Smuzhiyun+        if test -z "$termcap_lib"; then
453*4882a593Smuzhiyun+          TRY_LIB="-l$readline_lib"
454*4882a593Smuzhiyun+        else
455*4882a593Smuzhiyun+          TRY_LIB="-l$readline_lib -l$termcap_lib"
456*4882a593Smuzhiyun+        fi
457*4882a593Smuzhiyun+        LIBS="$ORIG_LIBS $TRY_LIB"
458*4882a593Smuzhiyun+        AC_TRY_LINK_FUNC(readline, ax_cv_lib_readline="$TRY_LIB")
459*4882a593Smuzhiyun+        if test -n "$ax_cv_lib_readline"; then
460*4882a593Smuzhiyun+          break
461*4882a593Smuzhiyun+        fi
462*4882a593Smuzhiyun+      done
463*4882a593Smuzhiyun+      if test -n "$ax_cv_lib_readline"; then
464*4882a593Smuzhiyun+        break
465*4882a593Smuzhiyun+      fi
466*4882a593Smuzhiyun+    done
467*4882a593Smuzhiyun+    if test -z "$ax_cv_lib_readline"; then
468*4882a593Smuzhiyun+      ax_cv_lib_readline="no"
469*4882a593Smuzhiyun+    fi
470*4882a593Smuzhiyun+    LIBS="$ORIG_LIBS"
471*4882a593Smuzhiyun+  ])
472*4882a593Smuzhiyun+
473*4882a593Smuzhiyun+  if test "$ax_cv_lib_readline" != "no"; then
474*4882a593Smuzhiyun+    LIBS="$LIBS $ax_cv_lib_readline"
475*4882a593Smuzhiyun+    AC_DEFINE(HAVE_LIBREADLINE, 1,
476*4882a593Smuzhiyun+              [Define if you have a readline compatible library])
477*4882a593Smuzhiyun+    AC_CHECK_HEADERS(readline.h readline/readline.h)
478*4882a593Smuzhiyun+    AC_CACHE_CHECK([whether readline supports history],
479*4882a593Smuzhiyun+                   ax_cv_lib_readline_history, [
480*4882a593Smuzhiyun+      ax_cv_lib_readline_history="no"
481*4882a593Smuzhiyun+      AC_TRY_LINK_FUNC(add_history, ax_cv_lib_readline_history="yes")
482*4882a593Smuzhiyun+    ])
483*4882a593Smuzhiyun+    if test "$ax_cv_lib_readline_history" = "yes"; then
484*4882a593Smuzhiyun+      AC_DEFINE(HAVE_READLINE_HISTORY, 1,
485*4882a593Smuzhiyun+                [Define if your readline library has \`add_history'])
486*4882a593Smuzhiyun+      AC_CHECK_HEADERS(history.h readline/history.h)
487*4882a593Smuzhiyun+    fi
488*4882a593Smuzhiyun+  fi
489*4882a593Smuzhiyun+])dnl
490*4882a593Smuzhiyundiff --git a/autotools/ax_pthread.m4 b/autotools/ax_pthread.m4
491*4882a593Smuzhiyunnew file mode 100644
492*4882a593Smuzhiyunindex 00000000..d383ad5c
493*4882a593Smuzhiyun--- /dev/null
494*4882a593Smuzhiyun+++ b/autotools/ax_pthread.m4
495*4882a593Smuzhiyun@@ -0,0 +1,332 @@
496*4882a593Smuzhiyun+# ===========================================================================
497*4882a593Smuzhiyun+#        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
498*4882a593Smuzhiyun+# ===========================================================================
499*4882a593Smuzhiyun+#
500*4882a593Smuzhiyun+# SYNOPSIS
501*4882a593Smuzhiyun+#
502*4882a593Smuzhiyun+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
503*4882a593Smuzhiyun+#
504*4882a593Smuzhiyun+# DESCRIPTION
505*4882a593Smuzhiyun+#
506*4882a593Smuzhiyun+#   This macro figures out how to build C programs using POSIX threads. It
507*4882a593Smuzhiyun+#   sets the PTHREAD_LIBS output variable to the threads library and linker
508*4882a593Smuzhiyun+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
509*4882a593Smuzhiyun+#   flags that are needed. (The user can also force certain compiler
510*4882a593Smuzhiyun+#   flags/libs to be tested by setting these environment variables.)
511*4882a593Smuzhiyun+#
512*4882a593Smuzhiyun+#   Also sets PTHREAD_CC to any special C compiler that is needed for
513*4882a593Smuzhiyun+#   multi-threaded programs (defaults to the value of CC otherwise). (This
514*4882a593Smuzhiyun+#   is necessary on AIX to use the special cc_r compiler alias.)
515*4882a593Smuzhiyun+#
516*4882a593Smuzhiyun+#   NOTE: You are assumed to not only compile your program with these flags,
517*4882a593Smuzhiyun+#   but also link it with them as well. e.g. you should link with
518*4882a593Smuzhiyun+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
519*4882a593Smuzhiyun+#
520*4882a593Smuzhiyun+#   If you are only building threads programs, you may wish to use these
521*4882a593Smuzhiyun+#   variables in your default LIBS, CFLAGS, and CC:
522*4882a593Smuzhiyun+#
523*4882a593Smuzhiyun+#     LIBS="$PTHREAD_LIBS $LIBS"
524*4882a593Smuzhiyun+#     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
525*4882a593Smuzhiyun+#     CC="$PTHREAD_CC"
526*4882a593Smuzhiyun+#
527*4882a593Smuzhiyun+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
528*4882a593Smuzhiyun+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
529*4882a593Smuzhiyun+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
530*4882a593Smuzhiyun+#
531*4882a593Smuzhiyun+#   Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
532*4882a593Smuzhiyun+#   PTHREAD_PRIO_INHERIT symbol is defined when compiling with
533*4882a593Smuzhiyun+#   PTHREAD_CFLAGS.
534*4882a593Smuzhiyun+#
535*4882a593Smuzhiyun+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
536*4882a593Smuzhiyun+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
537*4882a593Smuzhiyun+#   is not found. If ACTION-IF-FOUND is not specified, the default action
538*4882a593Smuzhiyun+#   will define HAVE_PTHREAD.
539*4882a593Smuzhiyun+#
540*4882a593Smuzhiyun+#   Please let the authors know if this macro fails on any platform, or if
541*4882a593Smuzhiyun+#   you have any other suggestions or comments. This macro was based on work
542*4882a593Smuzhiyun+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
543*4882a593Smuzhiyun+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
544*4882a593Smuzhiyun+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
545*4882a593Smuzhiyun+#   grateful for the helpful feedback of numerous users.
546*4882a593Smuzhiyun+#
547*4882a593Smuzhiyun+#   Updated for Autoconf 2.68 by Daniel Richard G.
548*4882a593Smuzhiyun+#
549*4882a593Smuzhiyun+# LICENSE
550*4882a593Smuzhiyun+#
551*4882a593Smuzhiyun+#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
552*4882a593Smuzhiyun+#   Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
553*4882a593Smuzhiyun+#
554*4882a593Smuzhiyun+#   This program is free software: you can redistribute it and/or modify it
555*4882a593Smuzhiyun+#   under the terms of the GNU General Public License as published by the
556*4882a593Smuzhiyun+#   Free Software Foundation, either version 3 of the License, or (at your
557*4882a593Smuzhiyun+#   option) any later version.
558*4882a593Smuzhiyun+#
559*4882a593Smuzhiyun+#   This program is distributed in the hope that it will be useful, but
560*4882a593Smuzhiyun+#   WITHOUT ANY WARRANTY; without even the implied warranty of
561*4882a593Smuzhiyun+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
562*4882a593Smuzhiyun+#   Public License for more details.
563*4882a593Smuzhiyun+#
564*4882a593Smuzhiyun+#   You should have received a copy of the GNU General Public License along
565*4882a593Smuzhiyun+#   with this program. If not, see <http://www.gnu.org/licenses/>.
566*4882a593Smuzhiyun+#
567*4882a593Smuzhiyun+#   As a special exception, the respective Autoconf Macro's copyright owner
568*4882a593Smuzhiyun+#   gives unlimited permission to copy, distribute and modify the configure
569*4882a593Smuzhiyun+#   scripts that are the output of Autoconf when processing the Macro. You
570*4882a593Smuzhiyun+#   need not follow the terms of the GNU General Public License when using
571*4882a593Smuzhiyun+#   or distributing such scripts, even though portions of the text of the
572*4882a593Smuzhiyun+#   Macro appear in them. The GNU General Public License (GPL) does govern
573*4882a593Smuzhiyun+#   all other use of the material that constitutes the Autoconf Macro.
574*4882a593Smuzhiyun+#
575*4882a593Smuzhiyun+#   This special exception to the GPL applies to versions of the Autoconf
576*4882a593Smuzhiyun+#   Macro released by the Autoconf Archive. When you make and distribute a
577*4882a593Smuzhiyun+#   modified version of the Autoconf Macro, you may extend this special
578*4882a593Smuzhiyun+#   exception to the GPL to apply to your modified version as well.
579*4882a593Smuzhiyun+
580*4882a593Smuzhiyun+#serial 21
581*4882a593Smuzhiyun+
582*4882a593Smuzhiyun+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
583*4882a593Smuzhiyun+AC_DEFUN([AX_PTHREAD], [
584*4882a593Smuzhiyun+AC_REQUIRE([AC_CANONICAL_HOST])
585*4882a593Smuzhiyun+AC_LANG_PUSH([C])
586*4882a593Smuzhiyun+ax_pthread_ok=no
587*4882a593Smuzhiyun+
588*4882a593Smuzhiyun+# We used to check for pthread.h first, but this fails if pthread.h
589*4882a593Smuzhiyun+# requires special compiler flags (e.g. on True64 or Sequent).
590*4882a593Smuzhiyun+# It gets checked for in the link test anyway.
591*4882a593Smuzhiyun+
592*4882a593Smuzhiyun+# First of all, check if the user has set any of the PTHREAD_LIBS,
593*4882a593Smuzhiyun+# etcetera environment variables, and if threads linking works using
594*4882a593Smuzhiyun+# them:
595*4882a593Smuzhiyun+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
596*4882a593Smuzhiyun+        save_CFLAGS="$CFLAGS"
597*4882a593Smuzhiyun+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
598*4882a593Smuzhiyun+        save_LIBS="$LIBS"
599*4882a593Smuzhiyun+        LIBS="$PTHREAD_LIBS $LIBS"
600*4882a593Smuzhiyun+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
601*4882a593Smuzhiyun+        AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
602*4882a593Smuzhiyun+        AC_MSG_RESULT([$ax_pthread_ok])
603*4882a593Smuzhiyun+        if test x"$ax_pthread_ok" = xno; then
604*4882a593Smuzhiyun+                PTHREAD_LIBS=""
605*4882a593Smuzhiyun+                PTHREAD_CFLAGS=""
606*4882a593Smuzhiyun+        fi
607*4882a593Smuzhiyun+        LIBS="$save_LIBS"
608*4882a593Smuzhiyun+        CFLAGS="$save_CFLAGS"
609*4882a593Smuzhiyun+fi
610*4882a593Smuzhiyun+
611*4882a593Smuzhiyun+# We must check for the threads library under a number of different
612*4882a593Smuzhiyun+# names; the ordering is very important because some systems
613*4882a593Smuzhiyun+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
614*4882a593Smuzhiyun+# libraries is broken (non-POSIX).
615*4882a593Smuzhiyun+
616*4882a593Smuzhiyun+# Create a list of thread flags to try.  Items starting with a "-" are
617*4882a593Smuzhiyun+# C compiler flags, and other items are library names, except for "none"
618*4882a593Smuzhiyun+# which indicates that we try without any flags at all, and "pthread-config"
619*4882a593Smuzhiyun+# which is a program returning the flags for the Pth emulation library.
620*4882a593Smuzhiyun+
621*4882a593Smuzhiyun+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
622*4882a593Smuzhiyun+
623*4882a593Smuzhiyun+# The ordering *is* (sometimes) important.  Some notes on the
624*4882a593Smuzhiyun+# individual items follow:
625*4882a593Smuzhiyun+
626*4882a593Smuzhiyun+# pthreads: AIX (must check this before -lpthread)
627*4882a593Smuzhiyun+# none: in case threads are in libc; should be tried before -Kthread and
628*4882a593Smuzhiyun+#       other compiler flags to prevent continual compiler warnings
629*4882a593Smuzhiyun+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
630*4882a593Smuzhiyun+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
631*4882a593Smuzhiyun+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
632*4882a593Smuzhiyun+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
633*4882a593Smuzhiyun+# -pthreads: Solaris/gcc
634*4882a593Smuzhiyun+# -mthreads: Mingw32/gcc, Lynx/gcc
635*4882a593Smuzhiyun+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
636*4882a593Smuzhiyun+#      doesn't hurt to check since this sometimes defines pthreads too;
637*4882a593Smuzhiyun+#      also defines -D_REENTRANT)
638*4882a593Smuzhiyun+#      ... -mt is also the pthreads flag for HP/aCC
639*4882a593Smuzhiyun+# pthread: Linux, etcetera
640*4882a593Smuzhiyun+# --thread-safe: KAI C++
641*4882a593Smuzhiyun+# pthread-config: use pthread-config program (for GNU Pth library)
642*4882a593Smuzhiyun+
643*4882a593Smuzhiyun+case ${host_os} in
644*4882a593Smuzhiyun+        solaris*)
645*4882a593Smuzhiyun+
646*4882a593Smuzhiyun+        # On Solaris (at least, for some versions), libc contains stubbed
647*4882a593Smuzhiyun+        # (non-functional) versions of the pthreads routines, so link-based
648*4882a593Smuzhiyun+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
649*4882a593Smuzhiyun+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
650*4882a593Smuzhiyun+        # a function called by this macro, so we could check for that, but
651*4882a593Smuzhiyun+        # who knows whether they'll stub that too in a future libc.)  So,
652*4882a593Smuzhiyun+        # we'll just look for -pthreads and -lpthread first:
653*4882a593Smuzhiyun+
654*4882a593Smuzhiyun+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
655*4882a593Smuzhiyun+        ;;
656*4882a593Smuzhiyun+
657*4882a593Smuzhiyun+        darwin*)
658*4882a593Smuzhiyun+        ax_pthread_flags="-pthread $ax_pthread_flags"
659*4882a593Smuzhiyun+        ;;
660*4882a593Smuzhiyun+esac
661*4882a593Smuzhiyun+
662*4882a593Smuzhiyun+# Clang doesn't consider unrecognized options an error unless we specify
663*4882a593Smuzhiyun+# -Werror. We throw in some extra Clang-specific options to ensure that
664*4882a593Smuzhiyun+# this doesn't happen for GCC, which also accepts -Werror.
665*4882a593Smuzhiyun+
666*4882a593Smuzhiyun+AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
667*4882a593Smuzhiyun+save_CFLAGS="$CFLAGS"
668*4882a593Smuzhiyun+ax_pthread_extra_flags="-Werror"
669*4882a593Smuzhiyun+CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
670*4882a593Smuzhiyun+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
671*4882a593Smuzhiyun+                  [AC_MSG_RESULT([yes])],
672*4882a593Smuzhiyun+                  [ax_pthread_extra_flags=
673*4882a593Smuzhiyun+                   AC_MSG_RESULT([no])])
674*4882a593Smuzhiyun+CFLAGS="$save_CFLAGS"
675*4882a593Smuzhiyun+
676*4882a593Smuzhiyun+if test x"$ax_pthread_ok" = xno; then
677*4882a593Smuzhiyun+for flag in $ax_pthread_flags; do
678*4882a593Smuzhiyun+
679*4882a593Smuzhiyun+        case $flag in
680*4882a593Smuzhiyun+                none)
681*4882a593Smuzhiyun+                AC_MSG_CHECKING([whether pthreads work without any flags])
682*4882a593Smuzhiyun+                ;;
683*4882a593Smuzhiyun+
684*4882a593Smuzhiyun+                -*)
685*4882a593Smuzhiyun+                AC_MSG_CHECKING([whether pthreads work with $flag])
686*4882a593Smuzhiyun+                PTHREAD_CFLAGS="$flag"
687*4882a593Smuzhiyun+                ;;
688*4882a593Smuzhiyun+
689*4882a593Smuzhiyun+                pthread-config)
690*4882a593Smuzhiyun+                AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
691*4882a593Smuzhiyun+                if test x"$ax_pthread_config" = xno; then continue; fi
692*4882a593Smuzhiyun+                PTHREAD_CFLAGS="`pthread-config --cflags`"
693*4882a593Smuzhiyun+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
694*4882a593Smuzhiyun+                ;;
695*4882a593Smuzhiyun+
696*4882a593Smuzhiyun+                *)
697*4882a593Smuzhiyun+                AC_MSG_CHECKING([for the pthreads library -l$flag])
698*4882a593Smuzhiyun+                PTHREAD_LIBS="-l$flag"
699*4882a593Smuzhiyun+                ;;
700*4882a593Smuzhiyun+        esac
701*4882a593Smuzhiyun+
702*4882a593Smuzhiyun+        save_LIBS="$LIBS"
703*4882a593Smuzhiyun+        save_CFLAGS="$CFLAGS"
704*4882a593Smuzhiyun+        LIBS="$PTHREAD_LIBS $LIBS"
705*4882a593Smuzhiyun+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
706*4882a593Smuzhiyun+
707*4882a593Smuzhiyun+        # Check for various functions.  We must include pthread.h,
708*4882a593Smuzhiyun+        # since some functions may be macros.  (On the Sequent, we
709*4882a593Smuzhiyun+        # need a special flag -Kthread to make this header compile.)
710*4882a593Smuzhiyun+        # We check for pthread_join because it is in -lpthread on IRIX
711*4882a593Smuzhiyun+        # while pthread_create is in libc.  We check for pthread_attr_init
712*4882a593Smuzhiyun+        # due to DEC craziness with -lpthreads.  We check for
713*4882a593Smuzhiyun+        # pthread_cleanup_push because it is one of the few pthread
714*4882a593Smuzhiyun+        # functions on Solaris that doesn't have a non-functional libc stub.
715*4882a593Smuzhiyun+        # We try pthread_create on general principles.
716*4882a593Smuzhiyun+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
717*4882a593Smuzhiyun+                        static void routine(void *a) { a = 0; }
718*4882a593Smuzhiyun+                        static void *start_routine(void *a) { return a; }],
719*4882a593Smuzhiyun+                       [pthread_t th; pthread_attr_t attr;
720*4882a593Smuzhiyun+                        pthread_create(&th, 0, start_routine, 0);
721*4882a593Smuzhiyun+                        pthread_join(th, 0);
722*4882a593Smuzhiyun+                        pthread_attr_init(&attr);
723*4882a593Smuzhiyun+                        pthread_cleanup_push(routine, 0);
724*4882a593Smuzhiyun+                        pthread_cleanup_pop(0) /* ; */])],
725*4882a593Smuzhiyun+                [ax_pthread_ok=yes],
726*4882a593Smuzhiyun+                [])
727*4882a593Smuzhiyun+
728*4882a593Smuzhiyun+        LIBS="$save_LIBS"
729*4882a593Smuzhiyun+        CFLAGS="$save_CFLAGS"
730*4882a593Smuzhiyun+
731*4882a593Smuzhiyun+        AC_MSG_RESULT([$ax_pthread_ok])
732*4882a593Smuzhiyun+        if test "x$ax_pthread_ok" = xyes; then
733*4882a593Smuzhiyun+                break;
734*4882a593Smuzhiyun+        fi
735*4882a593Smuzhiyun+
736*4882a593Smuzhiyun+        PTHREAD_LIBS=""
737*4882a593Smuzhiyun+        PTHREAD_CFLAGS=""
738*4882a593Smuzhiyun+done
739*4882a593Smuzhiyun+fi
740*4882a593Smuzhiyun+
741*4882a593Smuzhiyun+# Various other checks:
742*4882a593Smuzhiyun+if test "x$ax_pthread_ok" = xyes; then
743*4882a593Smuzhiyun+        save_LIBS="$LIBS"
744*4882a593Smuzhiyun+        LIBS="$PTHREAD_LIBS $LIBS"
745*4882a593Smuzhiyun+        save_CFLAGS="$CFLAGS"
746*4882a593Smuzhiyun+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
747*4882a593Smuzhiyun+
748*4882a593Smuzhiyun+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
749*4882a593Smuzhiyun+        AC_MSG_CHECKING([for joinable pthread attribute])
750*4882a593Smuzhiyun+        attr_name=unknown
751*4882a593Smuzhiyun+        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
752*4882a593Smuzhiyun+            AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
753*4882a593Smuzhiyun+                           [int attr = $attr; return attr /* ; */])],
754*4882a593Smuzhiyun+                [attr_name=$attr; break],
755*4882a593Smuzhiyun+                [])
756*4882a593Smuzhiyun+        done
757*4882a593Smuzhiyun+        AC_MSG_RESULT([$attr_name])
758*4882a593Smuzhiyun+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
759*4882a593Smuzhiyun+            AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
760*4882a593Smuzhiyun+                               [Define to necessary symbol if this constant
761*4882a593Smuzhiyun+                                uses a non-standard name on your system.])
762*4882a593Smuzhiyun+        fi
763*4882a593Smuzhiyun+
764*4882a593Smuzhiyun+        AC_MSG_CHECKING([if more special flags are required for pthreads])
765*4882a593Smuzhiyun+        flag=no
766*4882a593Smuzhiyun+        case ${host_os} in
767*4882a593Smuzhiyun+            aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
768*4882a593Smuzhiyun+            osf* | hpux*) flag="-D_REENTRANT";;
769*4882a593Smuzhiyun+            solaris*)
770*4882a593Smuzhiyun+            if test "$GCC" = "yes"; then
771*4882a593Smuzhiyun+                flag="-D_REENTRANT"
772*4882a593Smuzhiyun+            else
773*4882a593Smuzhiyun+                # TODO: What about Clang on Solaris?
774*4882a593Smuzhiyun+                flag="-mt -D_REENTRANT"
775*4882a593Smuzhiyun+            fi
776*4882a593Smuzhiyun+            ;;
777*4882a593Smuzhiyun+        esac
778*4882a593Smuzhiyun+        AC_MSG_RESULT([$flag])
779*4882a593Smuzhiyun+        if test "x$flag" != xno; then
780*4882a593Smuzhiyun+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
781*4882a593Smuzhiyun+        fi
782*4882a593Smuzhiyun+
783*4882a593Smuzhiyun+        AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
784*4882a593Smuzhiyun+            [ax_cv_PTHREAD_PRIO_INHERIT], [
785*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
786*4882a593Smuzhiyun+                                                [[int i = PTHREAD_PRIO_INHERIT;]])],
787*4882a593Smuzhiyun+                    [ax_cv_PTHREAD_PRIO_INHERIT=yes],
788*4882a593Smuzhiyun+                    [ax_cv_PTHREAD_PRIO_INHERIT=no])
789*4882a593Smuzhiyun+            ])
790*4882a593Smuzhiyun+        AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
791*4882a593Smuzhiyun+            [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
792*4882a593Smuzhiyun+
793*4882a593Smuzhiyun+        LIBS="$save_LIBS"
794*4882a593Smuzhiyun+        CFLAGS="$save_CFLAGS"
795*4882a593Smuzhiyun+
796*4882a593Smuzhiyun+        # More AIX lossage: compile with *_r variant
797*4882a593Smuzhiyun+        if test "x$GCC" != xyes; then
798*4882a593Smuzhiyun+            case $host_os in
799*4882a593Smuzhiyun+                aix*)
800*4882a593Smuzhiyun+                AS_CASE(["x/$CC"],
801*4882a593Smuzhiyun+                  [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
802*4882a593Smuzhiyun+                  [#handle absolute path differently from PATH based program lookup
803*4882a593Smuzhiyun+                   AS_CASE(["x$CC"],
804*4882a593Smuzhiyun+                     [x/*],
805*4882a593Smuzhiyun+                     [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
806*4882a593Smuzhiyun+                     [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
807*4882a593Smuzhiyun+                ;;
808*4882a593Smuzhiyun+            esac
809*4882a593Smuzhiyun+        fi
810*4882a593Smuzhiyun+fi
811*4882a593Smuzhiyun+
812*4882a593Smuzhiyun+test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
813*4882a593Smuzhiyun+
814*4882a593Smuzhiyun+AC_SUBST([PTHREAD_LIBS])
815*4882a593Smuzhiyun+AC_SUBST([PTHREAD_CFLAGS])
816*4882a593Smuzhiyun+AC_SUBST([PTHREAD_CC])
817*4882a593Smuzhiyun+
818*4882a593Smuzhiyun+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
819*4882a593Smuzhiyun+if test x"$ax_pthread_ok" = xyes; then
820*4882a593Smuzhiyun+        ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
821*4882a593Smuzhiyun+        :
822*4882a593Smuzhiyun+else
823*4882a593Smuzhiyun+        ax_pthread_ok=no
824*4882a593Smuzhiyun+        $2
825*4882a593Smuzhiyun+fi
826*4882a593Smuzhiyun+AC_LANG_POP
827*4882a593Smuzhiyun+])dnl AX_PTHREAD
828*4882a593Smuzhiyundiff --git a/autotools/ax_with_curses.m4 b/autotools/ax_with_curses.m4
829*4882a593Smuzhiyunnew file mode 100644
830*4882a593Smuzhiyunindex 00000000..e4cbd31b
831*4882a593Smuzhiyun--- /dev/null
832*4882a593Smuzhiyun+++ b/autotools/ax_with_curses.m4
833*4882a593Smuzhiyun@@ -0,0 +1,518 @@
834*4882a593Smuzhiyun+# ===========================================================================
835*4882a593Smuzhiyun+#      http://www.gnu.org/software/autoconf-archive/ax_with_curses.html
836*4882a593Smuzhiyun+# ===========================================================================
837*4882a593Smuzhiyun+#
838*4882a593Smuzhiyun+# SYNOPSIS
839*4882a593Smuzhiyun+#
840*4882a593Smuzhiyun+#   AX_WITH_CURSES
841*4882a593Smuzhiyun+#
842*4882a593Smuzhiyun+# DESCRIPTION
843*4882a593Smuzhiyun+#
844*4882a593Smuzhiyun+#   This macro checks whether a SysV or X/Open-compatible Curses library is
845*4882a593Smuzhiyun+#   present, along with the associated header file.  The NcursesW
846*4882a593Smuzhiyun+#   (wide-character) library is searched for first, followed by Ncurses,
847*4882a593Smuzhiyun+#   then the system-default plain Curses.  The first library found is the
848*4882a593Smuzhiyun+#   one returned.
849*4882a593Smuzhiyun+#
850*4882a593Smuzhiyun+#   The following options are understood: --with-ncursesw, --with-ncurses,
851*4882a593Smuzhiyun+#   --without-ncursesw, --without-ncurses.  The "--with" options force the
852*4882a593Smuzhiyun+#   macro to use that particular library, terminating with an error if not
853*4882a593Smuzhiyun+#   found.  The "--without" options simply skip the check for that library.
854*4882a593Smuzhiyun+#   The effect on the search pattern is:
855*4882a593Smuzhiyun+#
856*4882a593Smuzhiyun+#     (no options)                           - NcursesW, Ncurses, Curses
857*4882a593Smuzhiyun+#     --with-ncurses     --with-ncursesw     - NcursesW only [*]
858*4882a593Smuzhiyun+#     --without-ncurses  --with-ncursesw     - NcursesW only [*]
859*4882a593Smuzhiyun+#                        --with-ncursesw     - NcursesW only [*]
860*4882a593Smuzhiyun+#     --with-ncurses     --without-ncursesw  - Ncurses only [*]
861*4882a593Smuzhiyun+#     --with-ncurses                         - NcursesW, Ncurses [**]
862*4882a593Smuzhiyun+#     --without-ncurses  --without-ncursesw  - Curses only
863*4882a593Smuzhiyun+#                        --without-ncursesw  - Ncurses, Curses
864*4882a593Smuzhiyun+#     --without-ncurses                      - NcursesW, Curses
865*4882a593Smuzhiyun+#
866*4882a593Smuzhiyun+#   [*]  If the library is not found, abort the configure script.
867*4882a593Smuzhiyun+#
868*4882a593Smuzhiyun+#   [**] If the second library (Ncurses) is not found, abort configure.
869*4882a593Smuzhiyun+#
870*4882a593Smuzhiyun+#   The following preprocessor symbols may be defined by this macro if the
871*4882a593Smuzhiyun+#   appropriate conditions are met:
872*4882a593Smuzhiyun+#
873*4882a593Smuzhiyun+#     HAVE_CURSES             - if any SysV or X/Open Curses library found
874*4882a593Smuzhiyun+#     HAVE_CURSES_ENHANCED    - if library supports X/Open Enhanced functions
875*4882a593Smuzhiyun+#     HAVE_CURSES_COLOR       - if library supports color (enhanced functions)
876*4882a593Smuzhiyun+#     HAVE_CURSES_OBSOLETE    - if library supports certain obsolete features
877*4882a593Smuzhiyun+#     HAVE_NCURSESW           - if NcursesW (wide char) library is to be used
878*4882a593Smuzhiyun+#     HAVE_NCURSES            - if the Ncurses library is to be used
879*4882a593Smuzhiyun+#
880*4882a593Smuzhiyun+#     HAVE_CURSES_H           - if <curses.h> is present and should be used
881*4882a593Smuzhiyun+#     HAVE_NCURSESW_H         - if <ncursesw.h> should be used
882*4882a593Smuzhiyun+#     HAVE_NCURSES_H          - if <ncurses.h> should be used
883*4882a593Smuzhiyun+#     HAVE_NCURSESW_CURSES_H  - if <ncursesw/curses.h> should be used
884*4882a593Smuzhiyun+#     HAVE_NCURSES_CURSES_H   - if <ncurses/curses.h> should be used
885*4882a593Smuzhiyun+#
886*4882a593Smuzhiyun+#   (These preprocessor symbols are discussed later in this document.)
887*4882a593Smuzhiyun+#
888*4882a593Smuzhiyun+#   The following output variable is defined by this macro; it is precious
889*4882a593Smuzhiyun+#   and may be overridden on the ./configure command line:
890*4882a593Smuzhiyun+#
891*4882a593Smuzhiyun+#     CURSES_LIB  - library to add to xxx_LDADD
892*4882a593Smuzhiyun+#
893*4882a593Smuzhiyun+#   The library listed in CURSES_LIB is NOT added to LIBS by default. You
894*4882a593Smuzhiyun+#   need to add CURSES_LIB to the appropriate xxx_LDADD line in your
895*4882a593Smuzhiyun+#   Makefile.am.  For example:
896*4882a593Smuzhiyun+#
897*4882a593Smuzhiyun+#     prog_LDADD = @CURSES_LIB@
898*4882a593Smuzhiyun+#
899*4882a593Smuzhiyun+#   If CURSES_LIB is set on the configure command line (such as by running
900*4882a593Smuzhiyun+#   "./configure CURSES_LIB=-lmycurses"), then the only header searched for
901*4882a593Smuzhiyun+#   is <curses.h>.  The user may use the CPPFLAGS precious variable to
902*4882a593Smuzhiyun+#   override the standard #include search path.  If the user needs to
903*4882a593Smuzhiyun+#   specify an alternative path for a library (such as for a non-standard
904*4882a593Smuzhiyun+#   NcurseW), the user should use the LDFLAGS variable.
905*4882a593Smuzhiyun+#
906*4882a593Smuzhiyun+#   The following shell variables may be defined by this macro:
907*4882a593Smuzhiyun+#
908*4882a593Smuzhiyun+#     ax_cv_curses           - set to "yes" if any Curses library found
909*4882a593Smuzhiyun+#     ax_cv_curses_enhanced  - set to "yes" if Enhanced functions present
910*4882a593Smuzhiyun+#     ax_cv_curses_color     - set to "yes" if color functions present
911*4882a593Smuzhiyun+#     ax_cv_curses_obsolete  - set to "yes" if obsolete features present
912*4882a593Smuzhiyun+#
913*4882a593Smuzhiyun+#     ax_cv_ncursesw      - set to "yes" if NcursesW library found
914*4882a593Smuzhiyun+#     ax_cv_ncurses       - set to "yes" if Ncurses library found
915*4882a593Smuzhiyun+#     ax_cv_plaincurses   - set to "yes" if plain Curses library found
916*4882a593Smuzhiyun+#     ax_cv_curses_which  - set to "ncursesw", "ncurses", "plaincurses" or "no"
917*4882a593Smuzhiyun+#
918*4882a593Smuzhiyun+#   These variables can be used in your configure.ac to determine the level
919*4882a593Smuzhiyun+#   of support you need from the Curses library.  For example, if you must
920*4882a593Smuzhiyun+#   have either Ncurses or NcursesW, you could include:
921*4882a593Smuzhiyun+#
922*4882a593Smuzhiyun+#     AX_WITH_CURSES
923*4882a593Smuzhiyun+#     if test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes; then
924*4882a593Smuzhiyun+#         AC_MSG_ERROR([requires either NcursesW or Ncurses library])
925*4882a593Smuzhiyun+#     fi
926*4882a593Smuzhiyun+#
927*4882a593Smuzhiyun+#   If any Curses library will do (but one must be present and must support
928*4882a593Smuzhiyun+#   color), you could use:
929*4882a593Smuzhiyun+#
930*4882a593Smuzhiyun+#     AX_WITH_CURSES
931*4882a593Smuzhiyun+#     if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then
932*4882a593Smuzhiyun+#         AC_MSG_ERROR([requires an X/Open-compatible Curses library with color])
933*4882a593Smuzhiyun+#     fi
934*4882a593Smuzhiyun+#
935*4882a593Smuzhiyun+#   Certain preprocessor symbols and shell variables defined by this macro
936*4882a593Smuzhiyun+#   can be used to determine various features of the Curses library.  In
937*4882a593Smuzhiyun+#   particular, HAVE_CURSES and ax_cv_curses are defined if the Curses
938*4882a593Smuzhiyun+#   library found conforms to the traditional SysV and/or X/Open Base Curses
939*4882a593Smuzhiyun+#   definition.  Any working Curses library conforms to this level.
940*4882a593Smuzhiyun+#
941*4882a593Smuzhiyun+#   HAVE_CURSES_ENHANCED and ax_cv_curses_enhanced are defined if the
942*4882a593Smuzhiyun+#   library supports the X/Open Enhanced Curses definition.  In particular,
943*4882a593Smuzhiyun+#   the wide-character types attr_t, cchar_t and wint_t, the functions
944*4882a593Smuzhiyun+#   wattr_set() and wget_wch() and the macros WA_NORMAL and _XOPEN_CURSES
945*4882a593Smuzhiyun+#   are checked.  The Ncurses library does NOT conform to this definition,
946*4882a593Smuzhiyun+#   although NcursesW does.
947*4882a593Smuzhiyun+#
948*4882a593Smuzhiyun+#   HAVE_CURSES_COLOR and ax_cv_curses_color are defined if the library
949*4882a593Smuzhiyun+#   supports color functions and macros such as COLOR_PAIR, A_COLOR,
950*4882a593Smuzhiyun+#   COLOR_WHITE, COLOR_RED and init_pair().  These are NOT part of the
951*4882a593Smuzhiyun+#   X/Open Base Curses definition, but are part of the Enhanced set of
952*4882a593Smuzhiyun+#   functions.  The Ncurses library DOES support these functions, as does
953*4882a593Smuzhiyun+#   NcursesW.
954*4882a593Smuzhiyun+#
955*4882a593Smuzhiyun+#   HAVE_CURSES_OBSOLETE and ax_cv_curses_obsolete are defined if the
956*4882a593Smuzhiyun+#   library supports certain features present in SysV and BSD Curses but not
957*4882a593Smuzhiyun+#   defined in the X/Open definition.  In particular, the functions
958*4882a593Smuzhiyun+#   getattrs(), getcurx() and getmaxx() are checked.
959*4882a593Smuzhiyun+#
960*4882a593Smuzhiyun+#   To use the HAVE_xxx_H preprocessor symbols, insert the following into
961*4882a593Smuzhiyun+#   your system.h (or equivalent) header file:
962*4882a593Smuzhiyun+#
963*4882a593Smuzhiyun+#     #if defined HAVE_NCURSESW_CURSES_H
964*4882a593Smuzhiyun+#     #  include <ncursesw/curses.h>
965*4882a593Smuzhiyun+#     #elif defined HAVE_NCURSESW_H
966*4882a593Smuzhiyun+#     #  include <ncursesw.h>
967*4882a593Smuzhiyun+#     #elif defined HAVE_NCURSES_CURSES_H
968*4882a593Smuzhiyun+#     #  include <ncurses/curses.h>
969*4882a593Smuzhiyun+#     #elif defined HAVE_NCURSES_H
970*4882a593Smuzhiyun+#     #  include <ncurses.h>
971*4882a593Smuzhiyun+#     #elif defined HAVE_CURSES_H
972*4882a593Smuzhiyun+#     #  include <curses.h>
973*4882a593Smuzhiyun+#     #else
974*4882a593Smuzhiyun+#     #  error "SysV or X/Open-compatible Curses header file required"
975*4882a593Smuzhiyun+#     #endif
976*4882a593Smuzhiyun+#
977*4882a593Smuzhiyun+#   For previous users of this macro: you should not need to change anything
978*4882a593Smuzhiyun+#   in your configure.ac or Makefile.am, as the previous (serial 10)
979*4882a593Smuzhiyun+#   semantics are still valid.  However, you should update your system.h (or
980*4882a593Smuzhiyun+#   equivalent) header file to the fragment shown above. You are encouraged
981*4882a593Smuzhiyun+#   also to make use of the extended functionality provided by this version
982*4882a593Smuzhiyun+#   of AX_WITH_CURSES, as well as in the additional macros
983*4882a593Smuzhiyun+#   AX_WITH_CURSES_PANEL, AX_WITH_CURSES_MENU and AX_WITH_CURSES_FORM.
984*4882a593Smuzhiyun+#
985*4882a593Smuzhiyun+# LICENSE
986*4882a593Smuzhiyun+#
987*4882a593Smuzhiyun+#   Copyright (c) 2009 Mark Pulford <mark@kyne.com.au>
988*4882a593Smuzhiyun+#   Copyright (c) 2009 Damian Pietras <daper@daper.net>
989*4882a593Smuzhiyun+#   Copyright (c) 2012 Reuben Thomas <rrt@sc3d.org>
990*4882a593Smuzhiyun+#   Copyright (c) 2011 John Zaitseff <J.Zaitseff@zap.org.au>
991*4882a593Smuzhiyun+#
992*4882a593Smuzhiyun+#   This program is free software: you can redistribute it and/or modify it
993*4882a593Smuzhiyun+#   under the terms of the GNU General Public License as published by the
994*4882a593Smuzhiyun+#   Free Software Foundation, either version 3 of the License, or (at your
995*4882a593Smuzhiyun+#   option) any later version.
996*4882a593Smuzhiyun+#
997*4882a593Smuzhiyun+#   This program is distributed in the hope that it will be useful, but
998*4882a593Smuzhiyun+#   WITHOUT ANY WARRANTY; without even the implied warranty of
999*4882a593Smuzhiyun+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1000*4882a593Smuzhiyun+#   Public License for more details.
1001*4882a593Smuzhiyun+#
1002*4882a593Smuzhiyun+#   You should have received a copy of the GNU General Public License along
1003*4882a593Smuzhiyun+#   with this program. If not, see <http://www.gnu.org/licenses/>.
1004*4882a593Smuzhiyun+#
1005*4882a593Smuzhiyun+#   As a special exception, the respective Autoconf Macro's copyright owner
1006*4882a593Smuzhiyun+#   gives unlimited permission to copy, distribute and modify the configure
1007*4882a593Smuzhiyun+#   scripts that are the output of Autoconf when processing the Macro. You
1008*4882a593Smuzhiyun+#   need not follow the terms of the GNU General Public License when using
1009*4882a593Smuzhiyun+#   or distributing such scripts, even though portions of the text of the
1010*4882a593Smuzhiyun+#   Macro appear in them. The GNU General Public License (GPL) does govern
1011*4882a593Smuzhiyun+#   all other use of the material that constitutes the Autoconf Macro.
1012*4882a593Smuzhiyun+#
1013*4882a593Smuzhiyun+#   This special exception to the GPL applies to versions of the Autoconf
1014*4882a593Smuzhiyun+#   Macro released by the Autoconf Archive. When you make and distribute a
1015*4882a593Smuzhiyun+#   modified version of the Autoconf Macro, you may extend this special
1016*4882a593Smuzhiyun+#   exception to the GPL to apply to your modified version as well.
1017*4882a593Smuzhiyun+
1018*4882a593Smuzhiyun+#serial 15
1019*4882a593Smuzhiyun+
1020*4882a593Smuzhiyun+AU_ALIAS([MP_WITH_CURSES], [AX_WITH_CURSES])
1021*4882a593Smuzhiyun+AC_DEFUN([AX_WITH_CURSES], [
1022*4882a593Smuzhiyun+    AC_ARG_VAR([CURSES_LIB], [linker library for Curses, e.g. -lcurses])
1023*4882a593Smuzhiyun+    AC_ARG_WITH([ncurses], [AS_HELP_STRING([--with-ncurses],
1024*4882a593Smuzhiyun+        [force the use of Ncurses or NcursesW])],
1025*4882a593Smuzhiyun+        [], [with_ncurses=check])
1026*4882a593Smuzhiyun+    AC_ARG_WITH([ncursesw], [AS_HELP_STRING([--without-ncursesw],
1027*4882a593Smuzhiyun+        [do not use NcursesW (wide character support)])],
1028*4882a593Smuzhiyun+        [], [with_ncursesw=check])
1029*4882a593Smuzhiyun+
1030*4882a593Smuzhiyun+    ax_saved_LIBS=$LIBS
1031*4882a593Smuzhiyun+    AS_IF([test "x$with_ncurses" = xyes || test "x$with_ncursesw" = xyes],
1032*4882a593Smuzhiyun+        [ax_with_plaincurses=no], [ax_with_plaincurses=check])
1033*4882a593Smuzhiyun+
1034*4882a593Smuzhiyun+    ax_cv_curses_which=no
1035*4882a593Smuzhiyun+
1036*4882a593Smuzhiyun+    # Test for NcursesW
1037*4882a593Smuzhiyun+
1038*4882a593Smuzhiyun+    AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncursesw" != xno], [
1039*4882a593Smuzhiyun+        LIBS="$ax_saved_LIBS -lncursesw"
1040*4882a593Smuzhiyun+
1041*4882a593Smuzhiyun+        AC_CACHE_CHECK([for NcursesW wide-character library], [ax_cv_ncursesw], [
1042*4882a593Smuzhiyun+            AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])],
1043*4882a593Smuzhiyun+                [ax_cv_ncursesw=yes], [ax_cv_ncursesw=no])
1044*4882a593Smuzhiyun+        ])
1045*4882a593Smuzhiyun+        AS_IF([test "x$ax_cv_ncursesw" = xno && test "x$with_ncursesw" = xyes], [
1046*4882a593Smuzhiyun+            AC_MSG_ERROR([--with-ncursesw specified but could not find NcursesW library])
1047*4882a593Smuzhiyun+        ])
1048*4882a593Smuzhiyun+
1049*4882a593Smuzhiyun+        AS_IF([test "x$ax_cv_ncursesw" = xyes], [
1050*4882a593Smuzhiyun+            ax_cv_curses=yes
1051*4882a593Smuzhiyun+            ax_cv_curses_which=ncursesw
1052*4882a593Smuzhiyun+            CURSES_LIB="-lncursesw"
1053*4882a593Smuzhiyun+            AC_DEFINE([HAVE_NCURSESW], [1], [Define to 1 if the NcursesW library is present])
1054*4882a593Smuzhiyun+            AC_DEFINE([HAVE_CURSES],   [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
1055*4882a593Smuzhiyun+
1056*4882a593Smuzhiyun+            AC_CACHE_CHECK([for working ncursesw/curses.h], [ax_cv_header_ncursesw_curses_h], [
1057*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1058*4882a593Smuzhiyun+                        @%:@define _XOPEN_SOURCE_EXTENDED 1
1059*4882a593Smuzhiyun+                        @%:@include <ncursesw/curses.h>
1060*4882a593Smuzhiyun+                    ]], [[
1061*4882a593Smuzhiyun+                        chtype a = A_BOLD;
1062*4882a593Smuzhiyun+                        int b = KEY_LEFT;
1063*4882a593Smuzhiyun+                        chtype c = COLOR_PAIR(1) & A_COLOR;
1064*4882a593Smuzhiyun+                        attr_t d = WA_NORMAL;
1065*4882a593Smuzhiyun+                        cchar_t e;
1066*4882a593Smuzhiyun+                        wint_t f;
1067*4882a593Smuzhiyun+                        int g = getattrs(stdscr);
1068*4882a593Smuzhiyun+                        int h = getcurx(stdscr) + getmaxx(stdscr);
1069*4882a593Smuzhiyun+                        initscr();
1070*4882a593Smuzhiyun+                        init_pair(1, COLOR_WHITE, COLOR_RED);
1071*4882a593Smuzhiyun+                        wattr_set(stdscr, d, 0, NULL);
1072*4882a593Smuzhiyun+                        wget_wch(stdscr, &f);
1073*4882a593Smuzhiyun+                    ]])],
1074*4882a593Smuzhiyun+                    [ax_cv_header_ncursesw_curses_h=yes],
1075*4882a593Smuzhiyun+                    [ax_cv_header_ncursesw_curses_h=no])
1076*4882a593Smuzhiyun+            ])
1077*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xyes], [
1078*4882a593Smuzhiyun+                ax_cv_curses_enhanced=yes
1079*4882a593Smuzhiyun+                ax_cv_curses_color=yes
1080*4882a593Smuzhiyun+                ax_cv_curses_obsolete=yes
1081*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_ENHANCED],   [1], [Define to 1 if library supports X/Open Enhanced functions])
1082*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_COLOR],      [1], [Define to 1 if library supports color (enhanced functions)])
1083*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_OBSOLETE],   [1], [Define to 1 if library supports certain obsolete features])
1084*4882a593Smuzhiyun+                AC_DEFINE([HAVE_NCURSESW_CURSES_H], [1], [Define to 1 if <ncursesw/curses.h> is present])
1085*4882a593Smuzhiyun+            ])
1086*4882a593Smuzhiyun+
1087*4882a593Smuzhiyun+            AC_CACHE_CHECK([for working ncursesw.h], [ax_cv_header_ncursesw_h], [
1088*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1089*4882a593Smuzhiyun+                        @%:@define _XOPEN_SOURCE_EXTENDED 1
1090*4882a593Smuzhiyun+                        @%:@include <ncursesw.h>
1091*4882a593Smuzhiyun+                    ]], [[
1092*4882a593Smuzhiyun+                        chtype a = A_BOLD;
1093*4882a593Smuzhiyun+                        int b = KEY_LEFT;
1094*4882a593Smuzhiyun+                        chtype c = COLOR_PAIR(1) & A_COLOR;
1095*4882a593Smuzhiyun+                        attr_t d = WA_NORMAL;
1096*4882a593Smuzhiyun+                        cchar_t e;
1097*4882a593Smuzhiyun+                        wint_t f;
1098*4882a593Smuzhiyun+                        int g = getattrs(stdscr);
1099*4882a593Smuzhiyun+                        int h = getcurx(stdscr) + getmaxx(stdscr);
1100*4882a593Smuzhiyun+                        initscr();
1101*4882a593Smuzhiyun+                        init_pair(1, COLOR_WHITE, COLOR_RED);
1102*4882a593Smuzhiyun+                        wattr_set(stdscr, d, 0, NULL);
1103*4882a593Smuzhiyun+                        wget_wch(stdscr, &f);
1104*4882a593Smuzhiyun+                    ]])],
1105*4882a593Smuzhiyun+                    [ax_cv_header_ncursesw_h=yes],
1106*4882a593Smuzhiyun+                    [ax_cv_header_ncursesw_h=no])
1107*4882a593Smuzhiyun+            ])
1108*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_ncursesw_h" = xyes], [
1109*4882a593Smuzhiyun+                ax_cv_curses_enhanced=yes
1110*4882a593Smuzhiyun+                ax_cv_curses_color=yes
1111*4882a593Smuzhiyun+                ax_cv_curses_obsolete=yes
1112*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
1113*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_COLOR],    [1], [Define to 1 if library supports color (enhanced functions)])
1114*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
1115*4882a593Smuzhiyun+                AC_DEFINE([HAVE_NCURSESW_H],      [1], [Define to 1 if <ncursesw.h> is present])
1116*4882a593Smuzhiyun+            ])
1117*4882a593Smuzhiyun+
1118*4882a593Smuzhiyun+            AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h_with_ncursesw], [
1119*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1120*4882a593Smuzhiyun+                        @%:@define _XOPEN_SOURCE_EXTENDED 1
1121*4882a593Smuzhiyun+                        @%:@include <ncurses.h>
1122*4882a593Smuzhiyun+                    ]], [[
1123*4882a593Smuzhiyun+                        chtype a = A_BOLD;
1124*4882a593Smuzhiyun+                        int b = KEY_LEFT;
1125*4882a593Smuzhiyun+                        chtype c = COLOR_PAIR(1) & A_COLOR;
1126*4882a593Smuzhiyun+                        attr_t d = WA_NORMAL;
1127*4882a593Smuzhiyun+                        cchar_t e;
1128*4882a593Smuzhiyun+                        wint_t f;
1129*4882a593Smuzhiyun+                        int g = getattrs(stdscr);
1130*4882a593Smuzhiyun+                        int h = getcurx(stdscr) + getmaxx(stdscr);
1131*4882a593Smuzhiyun+                        initscr();
1132*4882a593Smuzhiyun+                        init_pair(1, COLOR_WHITE, COLOR_RED);
1133*4882a593Smuzhiyun+                        wattr_set(stdscr, d, 0, NULL);
1134*4882a593Smuzhiyun+                        wget_wch(stdscr, &f);
1135*4882a593Smuzhiyun+                    ]])],
1136*4882a593Smuzhiyun+                    [ax_cv_header_ncurses_h_with_ncursesw=yes],
1137*4882a593Smuzhiyun+                    [ax_cv_header_ncurses_h_with_ncursesw=no])
1138*4882a593Smuzhiyun+            ])
1139*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_ncurses_h_with_ncursesw" = xyes], [
1140*4882a593Smuzhiyun+                ax_cv_curses_enhanced=yes
1141*4882a593Smuzhiyun+                ax_cv_curses_color=yes
1142*4882a593Smuzhiyun+                ax_cv_curses_obsolete=yes
1143*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
1144*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_COLOR],    [1], [Define to 1 if library supports color (enhanced functions)])
1145*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
1146*4882a593Smuzhiyun+                AC_DEFINE([HAVE_NCURSES_H],       [1], [Define to 1 if <ncurses.h> is present])
1147*4882a593Smuzhiyun+            ])
1148*4882a593Smuzhiyun+
1149*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xno && test "x$ax_cv_header_ncursesw_h" = xno && test "x$ax_cv_header_ncurses_h_with_ncursesw" = xno], [
1150*4882a593Smuzhiyun+                AC_MSG_WARN([could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h])
1151*4882a593Smuzhiyun+            ])
1152*4882a593Smuzhiyun+        ])
1153*4882a593Smuzhiyun+    ])
1154*4882a593Smuzhiyun+
1155*4882a593Smuzhiyun+    # Test for Ncurses
1156*4882a593Smuzhiyun+
1157*4882a593Smuzhiyun+    AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncurses" != xno && test "x$ax_cv_curses_which" = xno], [
1158*4882a593Smuzhiyun+        LIBS="$ax_saved_LIBS -lncurses"
1159*4882a593Smuzhiyun+
1160*4882a593Smuzhiyun+        AC_CACHE_CHECK([for Ncurses library], [ax_cv_ncurses], [
1161*4882a593Smuzhiyun+            AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])],
1162*4882a593Smuzhiyun+                [ax_cv_ncurses=yes], [ax_cv_ncurses=no])
1163*4882a593Smuzhiyun+        ])
1164*4882a593Smuzhiyun+        AS_IF([test "x$ax_cv_ncurses" = xno && test "x$with_ncurses" = xyes], [
1165*4882a593Smuzhiyun+            AC_MSG_ERROR([--with-ncurses specified but could not find Ncurses library])
1166*4882a593Smuzhiyun+        ])
1167*4882a593Smuzhiyun+
1168*4882a593Smuzhiyun+        AS_IF([test "x$ax_cv_ncurses" = xyes], [
1169*4882a593Smuzhiyun+            ax_cv_curses=yes
1170*4882a593Smuzhiyun+            ax_cv_curses_which=ncurses
1171*4882a593Smuzhiyun+            CURSES_LIB="-lncurses"
1172*4882a593Smuzhiyun+            AC_DEFINE([HAVE_NCURSES], [1], [Define to 1 if the Ncurses library is present])
1173*4882a593Smuzhiyun+            AC_DEFINE([HAVE_CURSES],  [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
1174*4882a593Smuzhiyun+
1175*4882a593Smuzhiyun+            AC_CACHE_CHECK([for working ncurses/curses.h], [ax_cv_header_ncurses_curses_h], [
1176*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1177*4882a593Smuzhiyun+                        @%:@include <ncurses/curses.h>
1178*4882a593Smuzhiyun+                    ]], [[
1179*4882a593Smuzhiyun+                        chtype a = A_BOLD;
1180*4882a593Smuzhiyun+                        int b = KEY_LEFT;
1181*4882a593Smuzhiyun+                        chtype c = COLOR_PAIR(1) & A_COLOR;
1182*4882a593Smuzhiyun+                        int g = getattrs(stdscr);
1183*4882a593Smuzhiyun+                        int h = getcurx(stdscr) + getmaxx(stdscr);
1184*4882a593Smuzhiyun+                        initscr();
1185*4882a593Smuzhiyun+                        init_pair(1, COLOR_WHITE, COLOR_RED);
1186*4882a593Smuzhiyun+                    ]])],
1187*4882a593Smuzhiyun+                    [ax_cv_header_ncurses_curses_h=yes],
1188*4882a593Smuzhiyun+                    [ax_cv_header_ncurses_curses_h=no])
1189*4882a593Smuzhiyun+            ])
1190*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xyes], [
1191*4882a593Smuzhiyun+                ax_cv_curses_color=yes
1192*4882a593Smuzhiyun+                ax_cv_curses_obsolete=yes
1193*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_COLOR],     [1], [Define to 1 if library supports color (enhanced functions)])
1194*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_OBSOLETE],  [1], [Define to 1 if library supports certain obsolete features])
1195*4882a593Smuzhiyun+                AC_DEFINE([HAVE_NCURSES_CURSES_H], [1], [Define to 1 if <ncurses/curses.h> is present])
1196*4882a593Smuzhiyun+            ])
1197*4882a593Smuzhiyun+
1198*4882a593Smuzhiyun+            AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h], [
1199*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1200*4882a593Smuzhiyun+                        @%:@include <ncurses.h>
1201*4882a593Smuzhiyun+                    ]], [[
1202*4882a593Smuzhiyun+                        chtype a = A_BOLD;
1203*4882a593Smuzhiyun+                        int b = KEY_LEFT;
1204*4882a593Smuzhiyun+                        chtype c = COLOR_PAIR(1) & A_COLOR;
1205*4882a593Smuzhiyun+                        int g = getattrs(stdscr);
1206*4882a593Smuzhiyun+                        int h = getcurx(stdscr) + getmaxx(stdscr);
1207*4882a593Smuzhiyun+                        initscr();
1208*4882a593Smuzhiyun+                        init_pair(1, COLOR_WHITE, COLOR_RED);
1209*4882a593Smuzhiyun+                    ]])],
1210*4882a593Smuzhiyun+                    [ax_cv_header_ncurses_h=yes],
1211*4882a593Smuzhiyun+                    [ax_cv_header_ncurses_h=no])
1212*4882a593Smuzhiyun+            ])
1213*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_ncurses_h" = xyes], [
1214*4882a593Smuzhiyun+                ax_cv_curses_color=yes
1215*4882a593Smuzhiyun+                ax_cv_curses_obsolete=yes
1216*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_COLOR],    [1], [Define to 1 if library supports color (enhanced functions)])
1217*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
1218*4882a593Smuzhiyun+                AC_DEFINE([HAVE_NCURSES_H],       [1], [Define to 1 if <ncurses.h> is present])
1219*4882a593Smuzhiyun+            ])
1220*4882a593Smuzhiyun+
1221*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xno && test "x$ax_cv_header_ncurses_h" = xno], [
1222*4882a593Smuzhiyun+                AC_MSG_WARN([could not find a working ncurses/curses.h or ncurses.h])
1223*4882a593Smuzhiyun+            ])
1224*4882a593Smuzhiyun+        ])
1225*4882a593Smuzhiyun+    ])
1226*4882a593Smuzhiyun+
1227*4882a593Smuzhiyun+    # Test for plain Curses (or if CURSES_LIB was set by user)
1228*4882a593Smuzhiyun+
1229*4882a593Smuzhiyun+    AS_IF([test "x$with_plaincurses" != xno && test "x$ax_cv_curses_which" = xno], [
1230*4882a593Smuzhiyun+        AS_IF([test "x$CURSES_LIB" != x], [
1231*4882a593Smuzhiyun+            LIBS="$ax_saved_LIBS $CURSES_LIB"
1232*4882a593Smuzhiyun+        ], [
1233*4882a593Smuzhiyun+            LIBS="$ax_saved_LIBS -lcurses"
1234*4882a593Smuzhiyun+        ])
1235*4882a593Smuzhiyun+
1236*4882a593Smuzhiyun+        AC_CACHE_CHECK([for Curses library], [ax_cv_plaincurses], [
1237*4882a593Smuzhiyun+            AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])],
1238*4882a593Smuzhiyun+                [ax_cv_plaincurses=yes], [ax_cv_plaincurses=no])
1239*4882a593Smuzhiyun+        ])
1240*4882a593Smuzhiyun+
1241*4882a593Smuzhiyun+        AS_IF([test "x$ax_cv_plaincurses" = xyes], [
1242*4882a593Smuzhiyun+            ax_cv_curses=yes
1243*4882a593Smuzhiyun+            ax_cv_curses_which=plaincurses
1244*4882a593Smuzhiyun+            AS_IF([test "x$CURSES_LIB" = x], [
1245*4882a593Smuzhiyun+                CURSES_LIB="-lcurses"
1246*4882a593Smuzhiyun+            ])
1247*4882a593Smuzhiyun+            AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present])
1248*4882a593Smuzhiyun+
1249*4882a593Smuzhiyun+            # Check for base conformance (and header file)
1250*4882a593Smuzhiyun+
1251*4882a593Smuzhiyun+            AC_CACHE_CHECK([for working curses.h], [ax_cv_header_curses_h], [
1252*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1253*4882a593Smuzhiyun+                        @%:@include <curses.h>
1254*4882a593Smuzhiyun+                    ]], [[
1255*4882a593Smuzhiyun+                        chtype a = A_BOLD;
1256*4882a593Smuzhiyun+                        int b = KEY_LEFT;
1257*4882a593Smuzhiyun+                        initscr();
1258*4882a593Smuzhiyun+                    ]])],
1259*4882a593Smuzhiyun+                    [ax_cv_header_curses_h=yes],
1260*4882a593Smuzhiyun+                    [ax_cv_header_curses_h=no])
1261*4882a593Smuzhiyun+            ])
1262*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_curses_h" = xyes], [
1263*4882a593Smuzhiyun+                AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if <curses.h> is present])
1264*4882a593Smuzhiyun+
1265*4882a593Smuzhiyun+                # Check for X/Open Enhanced conformance
1266*4882a593Smuzhiyun+
1267*4882a593Smuzhiyun+                AC_CACHE_CHECK([for X/Open Enhanced Curses conformance], [ax_cv_plaincurses_enhanced], [
1268*4882a593Smuzhiyun+                    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1269*4882a593Smuzhiyun+                            @%:@define _XOPEN_SOURCE_EXTENDED 1
1270*4882a593Smuzhiyun+                            @%:@include <curses.h>
1271*4882a593Smuzhiyun+                            @%:@ifndef _XOPEN_CURSES
1272*4882a593Smuzhiyun+                            @%:@error "this Curses library is not enhanced"
1273*4882a593Smuzhiyun+                            "this Curses library is not enhanced"
1274*4882a593Smuzhiyun+                            @%:@endif
1275*4882a593Smuzhiyun+                        ]], [[
1276*4882a593Smuzhiyun+                            chtype a = A_BOLD;
1277*4882a593Smuzhiyun+                            int b = KEY_LEFT;
1278*4882a593Smuzhiyun+                            chtype c = COLOR_PAIR(1) & A_COLOR;
1279*4882a593Smuzhiyun+                            attr_t d = WA_NORMAL;
1280*4882a593Smuzhiyun+                            cchar_t e;
1281*4882a593Smuzhiyun+                            wint_t f;
1282*4882a593Smuzhiyun+                            initscr();
1283*4882a593Smuzhiyun+                            init_pair(1, COLOR_WHITE, COLOR_RED);
1284*4882a593Smuzhiyun+                            wattr_set(stdscr, d, 0, NULL);
1285*4882a593Smuzhiyun+                            wget_wch(stdscr, &f);
1286*4882a593Smuzhiyun+                        ]])],
1287*4882a593Smuzhiyun+                        [ax_cv_plaincurses_enhanced=yes],
1288*4882a593Smuzhiyun+                        [ax_cv_plaincurses_enhanced=no])
1289*4882a593Smuzhiyun+                ])
1290*4882a593Smuzhiyun+                AS_IF([test "x$ax_cv_plaincurses_enhanced" = xyes], [
1291*4882a593Smuzhiyun+                    ax_cv_curses_enhanced=yes
1292*4882a593Smuzhiyun+                    ax_cv_curses_color=yes
1293*4882a593Smuzhiyun+                    AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions])
1294*4882a593Smuzhiyun+                    AC_DEFINE([HAVE_CURSES_COLOR],    [1], [Define to 1 if library supports color (enhanced functions)])
1295*4882a593Smuzhiyun+                ])
1296*4882a593Smuzhiyun+
1297*4882a593Smuzhiyun+                # Check for color functions
1298*4882a593Smuzhiyun+
1299*4882a593Smuzhiyun+                AC_CACHE_CHECK([for Curses color functions], [ax_cv_plaincurses_color], [
1300*4882a593Smuzhiyun+                    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1301*4882a593Smuzhiyun+                        @%:@define _XOPEN_SOURCE_EXTENDED 1
1302*4882a593Smuzhiyun+                        @%:@include <curses.h>
1303*4882a593Smuzhiyun+                        ]], [[
1304*4882a593Smuzhiyun+                            chtype a = A_BOLD;
1305*4882a593Smuzhiyun+                            int b = KEY_LEFT;
1306*4882a593Smuzhiyun+                            chtype c = COLOR_PAIR(1) & A_COLOR;
1307*4882a593Smuzhiyun+                            initscr();
1308*4882a593Smuzhiyun+                            init_pair(1, COLOR_WHITE, COLOR_RED);
1309*4882a593Smuzhiyun+                        ]])],
1310*4882a593Smuzhiyun+                        [ax_cv_plaincurses_color=yes],
1311*4882a593Smuzhiyun+                        [ax_cv_plaincurses_color=no])
1312*4882a593Smuzhiyun+                ])
1313*4882a593Smuzhiyun+                AS_IF([test "x$ax_cv_plaincurses_color" = xyes], [
1314*4882a593Smuzhiyun+                    ax_cv_curses_color=yes
1315*4882a593Smuzhiyun+                    AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)])
1316*4882a593Smuzhiyun+                ])
1317*4882a593Smuzhiyun+
1318*4882a593Smuzhiyun+                # Check for obsolete functions
1319*4882a593Smuzhiyun+
1320*4882a593Smuzhiyun+                AC_CACHE_CHECK([for obsolete Curses functions], [ax_cv_plaincurses_obsolete], [
1321*4882a593Smuzhiyun+                AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1322*4882a593Smuzhiyun+                        @%:@include <curses.h>
1323*4882a593Smuzhiyun+                    ]], [[
1324*4882a593Smuzhiyun+                        chtype a = A_BOLD;
1325*4882a593Smuzhiyun+                        int b = KEY_LEFT;
1326*4882a593Smuzhiyun+                        int g = getattrs(stdscr);
1327*4882a593Smuzhiyun+                        int h = getcurx(stdscr) + getmaxx(stdscr);
1328*4882a593Smuzhiyun+                        initscr();
1329*4882a593Smuzhiyun+                    ]])],
1330*4882a593Smuzhiyun+                    [ax_cv_plaincurses_obsolete=yes],
1331*4882a593Smuzhiyun+                    [ax_cv_plaincurses_obsolete=no])
1332*4882a593Smuzhiyun+                ])
1333*4882a593Smuzhiyun+                AS_IF([test "x$ax_cv_plaincurses_obsolete" = xyes], [
1334*4882a593Smuzhiyun+                    ax_cv_curses_obsolete=yes
1335*4882a593Smuzhiyun+                    AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features])
1336*4882a593Smuzhiyun+                ])
1337*4882a593Smuzhiyun+            ])
1338*4882a593Smuzhiyun+
1339*4882a593Smuzhiyun+            AS_IF([test "x$ax_cv_header_curses_h" = xno], [
1340*4882a593Smuzhiyun+                AC_MSG_WARN([could not find a working curses.h])
1341*4882a593Smuzhiyun+            ])
1342*4882a593Smuzhiyun+        ])
1343*4882a593Smuzhiyun+    ])
1344*4882a593Smuzhiyun+
1345*4882a593Smuzhiyun+    AS_IF([test "x$ax_cv_curses"          != xyes], [ax_cv_curses=no])
1346*4882a593Smuzhiyun+    AS_IF([test "x$ax_cv_curses_enhanced" != xyes], [ax_cv_curses_enhanced=no])
1347*4882a593Smuzhiyun+    AS_IF([test "x$ax_cv_curses_color"    != xyes], [ax_cv_curses_color=no])
1348*4882a593Smuzhiyun+    AS_IF([test "x$ax_cv_curses_obsolete" != xyes], [ax_cv_curses_obsolete=no])
1349*4882a593Smuzhiyun+
1350*4882a593Smuzhiyun+    LIBS=$ax_saved_LIBS
1351*4882a593Smuzhiyun+])dnl
1352*4882a593Smuzhiyundiff --git a/autotools/softether.am b/autotools/softether.am
1353*4882a593Smuzhiyunnew file mode 100644
1354*4882a593Smuzhiyunindex 00000000..e5e91eeb
1355*4882a593Smuzhiyun--- /dev/null
1356*4882a593Smuzhiyun+++ b/autotools/softether.am
1357*4882a593Smuzhiyun@@ -0,0 +1,39 @@
1358*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1359*4882a593Smuzhiyun+#
1360*4882a593Smuzhiyun+#  This file is part of SoftEther.
1361*4882a593Smuzhiyun+#
1362*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1363*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1364*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1365*4882a593Smuzhiyun+#  any later version.
1366*4882a593Smuzhiyun+#
1367*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1368*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1369*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1370*4882a593Smuzhiyun+#  details.
1371*4882a593Smuzhiyun+#
1372*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1373*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1374*4882a593Smuzhiyun+
1375*4882a593Smuzhiyun+
1376*4882a593Smuzhiyun+if CONFIGURE_ENABLE_DEBUG
1377*4882a593Smuzhiyun+DEBUG_CFLAGS = -g -D_DEBUG -DDEBUG
1378*4882a593Smuzhiyun+else
1379*4882a593Smuzhiyun+DEBUG_CFLAGS = -DNDEBUG -DVPN_SPEED
1380*4882a593Smuzhiyun+endif
1381*4882a593Smuzhiyun+
1382*4882a593Smuzhiyun+AM_CFLAGS = \
1383*4882a593Smuzhiyun+	$(DEBUG_CFLAGS) \
1384*4882a593Smuzhiyun+	-I$(top_srcdir)/src \
1385*4882a593Smuzhiyun+	-I$(top_srcdir)/src/Mayaqua \
1386*4882a593Smuzhiyun+	-I$(top_srcdir)/src/Cedar \
1387*4882a593Smuzhiyun+	-DUNIX \
1388*4882a593Smuzhiyun+	-DUNIX_LINUX \
1389*4882a593Smuzhiyun+	-D_REENTRANT \
1390*4882a593Smuzhiyun+	-DREENTRANT \
1391*4882a593Smuzhiyun+	-D_THREAD_SAFE \
1392*4882a593Smuzhiyun+	-D_THREADSAFE \
1393*4882a593Smuzhiyun+	-DTHREAD_SAFE \
1394*4882a593Smuzhiyun+	-DTHREADSAFE \
1395*4882a593Smuzhiyun+	-D_FILE_OFFSET_BITS=64 \
1396*4882a593Smuzhiyun+	-fsigned-char
1397*4882a593Smuzhiyundiff --git a/configure.ac b/configure.ac
1398*4882a593Smuzhiyunnew file mode 100644
1399*4882a593Smuzhiyunindex 00000000..4a3fc2ba
1400*4882a593Smuzhiyun--- /dev/null
1401*4882a593Smuzhiyun+++ b/configure.ac
1402*4882a593Smuzhiyun@@ -0,0 +1,96 @@
1403*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1404*4882a593Smuzhiyun+#
1405*4882a593Smuzhiyun+#  This file is part of SoftEther.
1406*4882a593Smuzhiyun+#
1407*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1408*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1409*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1410*4882a593Smuzhiyun+#  any later version.
1411*4882a593Smuzhiyun+#
1412*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1413*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1414*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1415*4882a593Smuzhiyun+#  details.
1416*4882a593Smuzhiyun+#
1417*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1418*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1419*4882a593Smuzhiyun+
1420*4882a593Smuzhiyun+
1421*4882a593Smuzhiyun+AC_INIT([SoftEther], [1], [http://www.vpnusers.com/], [softether], [http://www.softether.org/])
1422*4882a593Smuzhiyun+AC_CONFIG_AUX_DIR([autotools])
1423*4882a593Smuzhiyun+AC_CONFIG_MACRO_DIR([autotools])
1424*4882a593Smuzhiyun+AM_INIT_AUTOMAKE([foreign -Wall -Werror])
1425*4882a593Smuzhiyun+AM_PROG_AR
1426*4882a593Smuzhiyun+AC_PROG_CC
1427*4882a593Smuzhiyun+AC_PROG_LIBTOOL
1428*4882a593Smuzhiyun+AC_CONFIG_HEADERS([softether_config.h])
1429*4882a593Smuzhiyun+AC_CONFIG_FILES([
1430*4882a593Smuzhiyun+	Makefile
1431*4882a593Smuzhiyun+	src/Makefile
1432*4882a593Smuzhiyun+	src/Mayaqua/Makefile
1433*4882a593Smuzhiyun+	src/Cedar/Makefile
1434*4882a593Smuzhiyun+	src/hamcorebuilder/Makefile
1435*4882a593Smuzhiyun+	src/bin/hamcore/Makefile
1436*4882a593Smuzhiyun+	src/vpnserver/Makefile
1437*4882a593Smuzhiyun+	src/vpnclient/Makefile
1438*4882a593Smuzhiyun+	src/vpnbridge/Makefile
1439*4882a593Smuzhiyun+	src/vpncmd/Makefile
1440*4882a593Smuzhiyun+])
1441*4882a593Smuzhiyun+
1442*4882a593Smuzhiyun+
1443*4882a593Smuzhiyun+AC_ARG_ENABLE(
1444*4882a593Smuzhiyun+	[debug],
1445*4882a593Smuzhiyun+	AS_HELP_STRING([--enable-debug], [build SoftEther with debugging features]),
1446*4882a593Smuzhiyun+	[debug=yes]
1447*4882a593Smuzhiyun+)
1448*4882a593Smuzhiyun+AM_CONDITIONAL([CONFIGURE_ENABLE_DEBUG], [test _"$debug" = _yes])
1449*4882a593Smuzhiyun+
1450*4882a593Smuzhiyun+
1451*4882a593Smuzhiyun+AX_PTHREAD([
1452*4882a593Smuzhiyun+	AC_SUBST(PTHREAD_CC)
1453*4882a593Smuzhiyun+	AC_SUBST(PTHREAD_CFLAGS)
1454*4882a593Smuzhiyun+	AC_SUBST(PTHREAD_LIBS)
1455*4882a593Smuzhiyun+],[
1456*4882a593Smuzhiyun+	AC_MSG_ERROR([pthread capabilities not found])
1457*4882a593Smuzhiyun+])
1458*4882a593Smuzhiyun+
1459*4882a593Smuzhiyun+CC="$PTHREAD_CC"
1460*4882a593Smuzhiyun+CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
1461*4882a593Smuzhiyun+LIBS="$PTHREAD_LIBS $LIBS"
1462*4882a593Smuzhiyun+
1463*4882a593Smuzhiyun+
1464*4882a593Smuzhiyun+AX_CHECK_OPENSSL([
1465*4882a593Smuzhiyun+	AC_SUBST(OPENSSL_LIBS)
1466*4882a593Smuzhiyun+	AC_SUBST(OPENSSL_LDFLAGS)
1467*4882a593Smuzhiyun+],[
1468*4882a593Smuzhiyun+	AC_MSG_ERROR([openssl not found])
1469*4882a593Smuzhiyun+])
1470*4882a593Smuzhiyun+
1471*4882a593Smuzhiyun+LIBS="$LIBS $OPENSSL_LIBS"
1472*4882a593Smuzhiyun+LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
1473*4882a593Smuzhiyun+
1474*4882a593Smuzhiyun+
1475*4882a593Smuzhiyun+# This macro automatically updates build variables.
1476*4882a593Smuzhiyun+AX_CHECK_ZLIB(, AC_MSG_ERROR([zlib not found]))
1477*4882a593Smuzhiyun+
1478*4882a593Smuzhiyun+
1479*4882a593Smuzhiyun+AX_WITH_CURSES
1480*4882a593Smuzhiyun+if test "_$ax_cv_curses" != _yes
1481*4882a593Smuzhiyun+then
1482*4882a593Smuzhiyun+	AC_MSG_ERROR([libcurses, libncurses, or libncursesw not found])
1483*4882a593Smuzhiyun+else
1484*4882a593Smuzhiyun+	AC_SUBST(CURSES_LIB)
1485*4882a593Smuzhiyun+	LIBS="$LIBS $CURSES_LIB"
1486*4882a593Smuzhiyun+fi
1487*4882a593Smuzhiyun+
1488*4882a593Smuzhiyun+
1489*4882a593Smuzhiyun+AX_LIB_READLINE
1490*4882a593Smuzhiyun+if test "_$ax_cv_lib_readline" = _no
1491*4882a593Smuzhiyun+then
1492*4882a593Smuzhiyun+	AC_MSG_ERROR([libreadline not found])
1493*4882a593Smuzhiyun+else
1494*4882a593Smuzhiyun+	: This macro automatically updates build variables.
1495*4882a593Smuzhiyun+fi
1496*4882a593Smuzhiyun+
1497*4882a593Smuzhiyun+
1498*4882a593Smuzhiyun+AC_OUTPUT
1499*4882a593Smuzhiyun--- a/configure	2017-07-16 04:53:31.000000000 +0200
1500*4882a593Smuzhiyun+++ b/configure	1970-01-01 01:00:00.000000000 +0100
1501*4882a593Smuzhiyun@@ -1,112 +0,0 @@
1502*4882a593Smuzhiyun-#!/bin/sh
1503*4882a593Smuzhiyun-
1504*4882a593Smuzhiyun-echo '---------------------------------------------------------------------'
1505*4882a593Smuzhiyun-echo 'SoftEther VPN for Unix'
1506*4882a593Smuzhiyun-echo
1507*4882a593Smuzhiyun-echo 'Copyright (c) Daiyuu Nobori.'
1508*4882a593Smuzhiyun-echo 'Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.'
1509*4882a593Smuzhiyun-echo 'Copyright (c) SoftEther Corporation.'
1510*4882a593Smuzhiyun-echo 'Copyright (c) all contributors on SoftEther VPN project in GitHub.'
1511*4882a593Smuzhiyun-echo
1512*4882a593Smuzhiyun-echo 'License: The Apache License, Version 2.0'
1513*4882a593Smuzhiyun-echo
1514*4882a593Smuzhiyun-echo 'Read and understand README.TXT, LICENSE.TXT and WARNING.TXT before use.'
1515*4882a593Smuzhiyun-echo '---------------------------------------------------------------------'
1516*4882a593Smuzhiyun-echo
1517*4882a593Smuzhiyun-
1518*4882a593Smuzhiyun-echo 'Welcome to the corner-cutting configure script !'
1519*4882a593Smuzhiyun-echo
1520*4882a593Smuzhiyun-
1521*4882a593Smuzhiyun-OS=""
1522*4882a593Smuzhiyun-case "`uname -s`" in
1523*4882a593Smuzhiyun-Linux)
1524*4882a593Smuzhiyun-	OS="linux"
1525*4882a593Smuzhiyun-	;;
1526*4882a593Smuzhiyun-FreeBSD)
1527*4882a593Smuzhiyun-	OS="freebsd"
1528*4882a593Smuzhiyun-	;;
1529*4882a593Smuzhiyun-SunOS)
1530*4882a593Smuzhiyun-	OS="solaris"
1531*4882a593Smuzhiyun-	;;
1532*4882a593Smuzhiyun-Darwin)
1533*4882a593Smuzhiyun-	OS="macos"
1534*4882a593Smuzhiyun-	;;
1535*4882a593Smuzhiyun-OpenBSD)
1536*4882a593Smuzhiyun-	OS="openbsd"
1537*4882a593Smuzhiyun-	;;
1538*4882a593Smuzhiyun-*)
1539*4882a593Smuzhiyun-	echo 'Select your operating system below:'
1540*4882a593Smuzhiyun-	echo ' 1: Linux'
1541*4882a593Smuzhiyun-	echo ' 2: FreeBSD'
1542*4882a593Smuzhiyun-	echo ' 3: Solaris'
1543*4882a593Smuzhiyun-	echo ' 4: Mac OS X'
1544*4882a593Smuzhiyun-	echo ' 5: OpenBSD'
1545*4882a593Smuzhiyun-	echo
1546*4882a593Smuzhiyun-	echo -n 'Which is your operating system (1 - 5) ? : '
1547*4882a593Smuzhiyun-	read TMP
1548*4882a593Smuzhiyun-	echo
1549*4882a593Smuzhiyun-	if test "$TMP" = "1"
1550*4882a593Smuzhiyun-	then
1551*4882a593Smuzhiyun-		OS="linux"
1552*4882a593Smuzhiyun-	fi
1553*4882a593Smuzhiyun-	if test "$TMP" = "2"
1554*4882a593Smuzhiyun-	then
1555*4882a593Smuzhiyun-		OS="freebsd"
1556*4882a593Smuzhiyun-	fi
1557*4882a593Smuzhiyun-	if test "$TMP" = "3"
1558*4882a593Smuzhiyun-	then
1559*4882a593Smuzhiyun-		OS="solaris"
1560*4882a593Smuzhiyun-	fi
1561*4882a593Smuzhiyun-	if test "$TMP" = "4"
1562*4882a593Smuzhiyun-	then
1563*4882a593Smuzhiyun-		OS="macos"
1564*4882a593Smuzhiyun-	fi
1565*4882a593Smuzhiyun-	if test "$TMP" = "5"
1566*4882a593Smuzhiyun-	then
1567*4882a593Smuzhiyun-		OS="openbsd"
1568*4882a593Smuzhiyun-	fi
1569*4882a593Smuzhiyun-
1570*4882a593Smuzhiyun-	if test "$OS" = ""
1571*4882a593Smuzhiyun-	then
1572*4882a593Smuzhiyun-		echo "Wrong number."
1573*4882a593Smuzhiyun-		exit 1
1574*4882a593Smuzhiyun-	fi
1575*4882a593Smuzhiyun-	;;
1576*4882a593Smuzhiyun-esac
1577*4882a593Smuzhiyun-
1578*4882a593Smuzhiyun-CPU=""
1579*4882a593Smuzhiyun-case "`uname -m`" in
1580*4882a593Smuzhiyun-x86_64|amd64|aarch64|arm64|armv8*|mips64|ppc64|sparc64|alpha|ia64)
1581*4882a593Smuzhiyun-	CPU=64bit
1582*4882a593Smuzhiyun-	;;
1583*4882a593Smuzhiyun-i?86|x86pc|i86pc|armv4*|armv5*|armv6*|armv7*)
1584*4882a593Smuzhiyun-	CPU=32bit
1585*4882a593Smuzhiyun-	;;
1586*4882a593Smuzhiyun-*)
1587*4882a593Smuzhiyun-	echo 'Select your CPU bits below:'
1588*4882a593Smuzhiyun-	echo ' 1: 32-bit'
1589*4882a593Smuzhiyun-	echo ' 2: 64-bit'
1590*4882a593Smuzhiyun-	echo
1591*4882a593Smuzhiyun-	echo -n 'Which is the type of your CPU (1 - 2) ? : '
1592*4882a593Smuzhiyun-	read TMP
1593*4882a593Smuzhiyun-	echo
1594*4882a593Smuzhiyun-	if test "$TMP" = "1"
1595*4882a593Smuzhiyun-	then
1596*4882a593Smuzhiyun-		CPU="32bit"
1597*4882a593Smuzhiyun-	fi
1598*4882a593Smuzhiyun-	if test "$TMP" = "2"
1599*4882a593Smuzhiyun-	then
1600*4882a593Smuzhiyun-		CPU="64bit"
1601*4882a593Smuzhiyun-	fi
1602*4882a593Smuzhiyun-
1603*4882a593Smuzhiyun-	if test "$CPU" = ""
1604*4882a593Smuzhiyun-	then
1605*4882a593Smuzhiyun-		echo "Wrong number."
1606*4882a593Smuzhiyun-		exit 1
1607*4882a593Smuzhiyun-	fi
1608*4882a593Smuzhiyun-	;;
1609*4882a593Smuzhiyun-esac
1610*4882a593Smuzhiyun-
1611*4882a593Smuzhiyun-cp src/makefiles/${OS}_${CPU}.mak Makefile
1612*4882a593Smuzhiyun-
1613*4882a593Smuzhiyun-echo "The Makefile is generated. Run 'make' to build SoftEther VPN."
1614*4882a593Smuzhiyun--- a/manual_configure	1970-01-01 01:00:00.000000000 +0100
1615*4882a593Smuzhiyun+++ b/manual_configure	2017-07-16 04:53:31.000000000 +0200
1616*4882a593Smuzhiyun@@ -0,0 +1,112 @@
1617*4882a593Smuzhiyun+#!/bin/sh
1618*4882a593Smuzhiyun+
1619*4882a593Smuzhiyun+echo '---------------------------------------------------------------------'
1620*4882a593Smuzhiyun+echo 'SoftEther VPN for Unix'
1621*4882a593Smuzhiyun+echo
1622*4882a593Smuzhiyun+echo 'Copyright (c) SoftEther VPN Project at University of Tsukuba, Japan.'
1623*4882a593Smuzhiyun+echo 'Copyright (c) Daiyuu Nobori. All Rights Reserved.'
1624*4882a593Smuzhiyun+echo
1625*4882a593Smuzhiyun+echo 'This program is free software; you can redistribute it and/or'
1626*4882a593Smuzhiyun+echo 'modify it under the terms of the GNU General Public License'
1627*4882a593Smuzhiyun+echo 'version 2 as published by the Free Software Foundation.'
1628*4882a593Smuzhiyun+echo
1629*4882a593Smuzhiyun+echo 'Read and understand README.TXT, LICENSE.TXT and WARNING.TXT before use.'
1630*4882a593Smuzhiyun+echo '---------------------------------------------------------------------'
1631*4882a593Smuzhiyun+echo
1632*4882a593Smuzhiyun+
1633*4882a593Smuzhiyun+echo 'Welcome to the corner-cutting configure script !'
1634*4882a593Smuzhiyun+echo
1635*4882a593Smuzhiyun+
1636*4882a593Smuzhiyun+OS=""
1637*4882a593Smuzhiyun+case "`uname -s`" in
1638*4882a593Smuzhiyun+Linux)
1639*4882a593Smuzhiyun+	OS="linux"
1640*4882a593Smuzhiyun+	;;
1641*4882a593Smuzhiyun+FreeBSD)
1642*4882a593Smuzhiyun+	OS="freebsd"
1643*4882a593Smuzhiyun+	;;
1644*4882a593Smuzhiyun+SunOS)
1645*4882a593Smuzhiyun+	OS="solaris"
1646*4882a593Smuzhiyun+	;;
1647*4882a593Smuzhiyun+Darwin)
1648*4882a593Smuzhiyun+	OS="macos"
1649*4882a593Smuzhiyun+	;;
1650*4882a593Smuzhiyun+OpenBSD)
1651*4882a593Smuzhiyun+	OS="openbsd"
1652*4882a593Smuzhiyun+	;;
1653*4882a593Smuzhiyun+*)
1654*4882a593Smuzhiyun+	echo 'Select your operating system below:'
1655*4882a593Smuzhiyun+	echo ' 1: Linux'
1656*4882a593Smuzhiyun+	echo ' 2: FreeBSD'
1657*4882a593Smuzhiyun+	echo ' 3: Solaris'
1658*4882a593Smuzhiyun+	echo ' 4: Mac OS X'
1659*4882a593Smuzhiyun+	echo ' 5: OpenBSD'
1660*4882a593Smuzhiyun+	echo
1661*4882a593Smuzhiyun+	echo -n 'Which is your operating system (1 - 5) ? : '
1662*4882a593Smuzhiyun+	read TMP
1663*4882a593Smuzhiyun+	echo
1664*4882a593Smuzhiyun+	if test "$TMP" = "1"
1665*4882a593Smuzhiyun+	then
1666*4882a593Smuzhiyun+		OS="linux"
1667*4882a593Smuzhiyun+	fi
1668*4882a593Smuzhiyun+	if test "$TMP" = "2"
1669*4882a593Smuzhiyun+	then
1670*4882a593Smuzhiyun+		OS="freebsd"
1671*4882a593Smuzhiyun+	fi
1672*4882a593Smuzhiyun+	if test "$TMP" = "3"
1673*4882a593Smuzhiyun+	then
1674*4882a593Smuzhiyun+		OS="solaris"
1675*4882a593Smuzhiyun+	fi
1676*4882a593Smuzhiyun+	if test "$TMP" = "4"
1677*4882a593Smuzhiyun+	then
1678*4882a593Smuzhiyun+		OS="macos"
1679*4882a593Smuzhiyun+	fi
1680*4882a593Smuzhiyun+	if test "$TMP" = "5"
1681*4882a593Smuzhiyun+	then
1682*4882a593Smuzhiyun+		OS="openbsd"
1683*4882a593Smuzhiyun+	fi
1684*4882a593Smuzhiyun+
1685*4882a593Smuzhiyun+	if test "$OS" = ""
1686*4882a593Smuzhiyun+	then
1687*4882a593Smuzhiyun+		echo "Wrong number."
1688*4882a593Smuzhiyun+		exit 1
1689*4882a593Smuzhiyun+	fi
1690*4882a593Smuzhiyun+	;;
1691*4882a593Smuzhiyun+esac
1692*4882a593Smuzhiyun+
1693*4882a593Smuzhiyun+CPU=""
1694*4882a593Smuzhiyun+case "`uname -m`" in
1695*4882a593Smuzhiyun+x86_64|amd64|aarch64|arm64|armv8*|mips64|ppc64|sparc64|alpha|ia64)
1696*4882a593Smuzhiyun+	CPU=64bit
1697*4882a593Smuzhiyun+	;;
1698*4882a593Smuzhiyun+i?86|x86pc|i86pc|armv4*|armv5*|armv6*|armv7*)
1699*4882a593Smuzhiyun+	CPU=32bit
1700*4882a593Smuzhiyun+	;;
1701*4882a593Smuzhiyun+*)
1702*4882a593Smuzhiyun+	echo 'Select your CPU bits below:'
1703*4882a593Smuzhiyun+	echo ' 1: 32-bit'
1704*4882a593Smuzhiyun+	echo ' 2: 64-bit'
1705*4882a593Smuzhiyun+	echo
1706*4882a593Smuzhiyun+	echo -n 'Which is the type of your CPU (1 - 2) ? : '
1707*4882a593Smuzhiyun+	read TMP
1708*4882a593Smuzhiyun+	echo
1709*4882a593Smuzhiyun+	if test "$TMP" = "1"
1710*4882a593Smuzhiyun+	then
1711*4882a593Smuzhiyun+		CPU="32bit"
1712*4882a593Smuzhiyun+	fi
1713*4882a593Smuzhiyun+	if test "$TMP" = "2"
1714*4882a593Smuzhiyun+	then
1715*4882a593Smuzhiyun+		CPU="64bit"
1716*4882a593Smuzhiyun+	fi
1717*4882a593Smuzhiyun+
1718*4882a593Smuzhiyun+	if test "$CPU" = ""
1719*4882a593Smuzhiyun+	then
1720*4882a593Smuzhiyun+		echo "Wrong number."
1721*4882a593Smuzhiyun+		exit 1
1722*4882a593Smuzhiyun+	fi
1723*4882a593Smuzhiyun+	;;
1724*4882a593Smuzhiyun+esac
1725*4882a593Smuzhiyun+
1726*4882a593Smuzhiyun+cp src/makefiles/${OS}_${CPU}.mak Makefile
1727*4882a593Smuzhiyun+
1728*4882a593Smuzhiyun+echo "The Makefile is generated. Run 'make' to build SoftEther VPN."
1729*4882a593Smuzhiyundiff --git a/src/Cedar/Makefile.am b/src/Cedar/Makefile.am
1730*4882a593Smuzhiyunnew file mode 100644
1731*4882a593Smuzhiyunindex 00000000..5346537d
1732*4882a593Smuzhiyun--- /dev/null
1733*4882a593Smuzhiyun+++ b/src/Cedar/Makefile.am
1734*4882a593Smuzhiyun@@ -0,0 +1,82 @@
1735*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1736*4882a593Smuzhiyun+#
1737*4882a593Smuzhiyun+#  This file is part of SoftEther.
1738*4882a593Smuzhiyun+#
1739*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1740*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1741*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1742*4882a593Smuzhiyun+#  any later version.
1743*4882a593Smuzhiyun+#
1744*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1745*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1746*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1747*4882a593Smuzhiyun+#  details.
1748*4882a593Smuzhiyun+#
1749*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1750*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1751*4882a593Smuzhiyun+
1752*4882a593Smuzhiyun+
1753*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
1754*4882a593Smuzhiyun+
1755*4882a593Smuzhiyun+noinst_LTLIBRARIES = libcedar.la
1756*4882a593Smuzhiyun+
1757*4882a593Smuzhiyun+libcedar_la_SOURCES = \
1758*4882a593Smuzhiyun+	Account.c \
1759*4882a593Smuzhiyun+	Admin.c \
1760*4882a593Smuzhiyun+	AzureClient.c \
1761*4882a593Smuzhiyun+	AzureServer.c \
1762*4882a593Smuzhiyun+	Bridge.c \
1763*4882a593Smuzhiyun+	BridgeUnix.c \
1764*4882a593Smuzhiyun+	BridgeWin32.c \
1765*4882a593Smuzhiyun+	Cedar.c \
1766*4882a593Smuzhiyun+	CedarPch.c \
1767*4882a593Smuzhiyun+	Client.c \
1768*4882a593Smuzhiyun+	CM.c \
1769*4882a593Smuzhiyun+	Command.c \
1770*4882a593Smuzhiyun+	Connection.c \
1771*4882a593Smuzhiyun+	Console.c \
1772*4882a593Smuzhiyun+	Database.c \
1773*4882a593Smuzhiyun+	DDNS.c \
1774*4882a593Smuzhiyun+	EM.c \
1775*4882a593Smuzhiyun+	EtherLog.c \
1776*4882a593Smuzhiyun+	Hub.c \
1777*4882a593Smuzhiyun+	Interop_OpenVPN.c \
1778*4882a593Smuzhiyun+	Interop_SSTP.c \
1779*4882a593Smuzhiyun+	IPsec.c \
1780*4882a593Smuzhiyun+	IPsec_EtherIP.c \
1781*4882a593Smuzhiyun+	IPsec_IKE.c \
1782*4882a593Smuzhiyun+	IPsec_IkePacket.c \
1783*4882a593Smuzhiyun+	IPsec_IPC.c \
1784*4882a593Smuzhiyun+	IPsec_L2TP.c \
1785*4882a593Smuzhiyun+	IPsec_PPP.c \
1786*4882a593Smuzhiyun+	IPsec_Win7.c \
1787*4882a593Smuzhiyun+	Layer3.c \
1788*4882a593Smuzhiyun+	Link.c \
1789*4882a593Smuzhiyun+	Listener.c \
1790*4882a593Smuzhiyun+	Logging.c \
1791*4882a593Smuzhiyun+	Nat.c \
1792*4882a593Smuzhiyun+	NativeStack.c \
1793*4882a593Smuzhiyun+	NM.c \
1794*4882a593Smuzhiyun+	NullLan.c \
1795*4882a593Smuzhiyun+	Protocol.c \
1796*4882a593Smuzhiyun+	Radius.c \
1797*4882a593Smuzhiyun+	Remote.c \
1798*4882a593Smuzhiyun+	Sam.c \
1799*4882a593Smuzhiyun+	SecureInfo.c \
1800*4882a593Smuzhiyun+	SecureNAT.c \
1801*4882a593Smuzhiyun+	SeLowUser.c \
1802*4882a593Smuzhiyun+	Server.c \
1803*4882a593Smuzhiyun+	Session.c \
1804*4882a593Smuzhiyun+	SM.c \
1805*4882a593Smuzhiyun+	SW.c \
1806*4882a593Smuzhiyun+	UdpAccel.c \
1807*4882a593Smuzhiyun+	UT.c \
1808*4882a593Smuzhiyun+	VG.c \
1809*4882a593Smuzhiyun+	Virtual.c \
1810*4882a593Smuzhiyun+	VLan.c \
1811*4882a593Smuzhiyun+	VLanUnix.c \
1812*4882a593Smuzhiyun+	VLanWin32.c \
1813*4882a593Smuzhiyun+	WaterMark.c \
1814*4882a593Smuzhiyun+	WebUI.c \
1815*4882a593Smuzhiyun+	WinUi.c \
1816*4882a593Smuzhiyun+	Wpc.c
1817*4882a593Smuzhiyundiff --git a/src/Makefile.am b/src/Makefile.am
1818*4882a593Smuzhiyunnew file mode 100644
1819*4882a593Smuzhiyunindex 00000000..dc745426
1820*4882a593Smuzhiyun--- /dev/null
1821*4882a593Smuzhiyun+++ b/src/Makefile.am
1822*4882a593Smuzhiyun@@ -0,0 +1,26 @@
1823*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1824*4882a593Smuzhiyun+#
1825*4882a593Smuzhiyun+#  This file is part of SoftEther.
1826*4882a593Smuzhiyun+#
1827*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1828*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1829*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1830*4882a593Smuzhiyun+#  any later version.
1831*4882a593Smuzhiyun+#
1832*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1833*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1834*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1835*4882a593Smuzhiyun+#  details.
1836*4882a593Smuzhiyun+#
1837*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1838*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1839*4882a593Smuzhiyun+
1840*4882a593Smuzhiyun+
1841*4882a593Smuzhiyun+# These components are built as libtool convenience libraries.
1842*4882a593Smuzhiyun+SUBDIRS = Mayaqua Cedar
1843*4882a593Smuzhiyun+
1844*4882a593Smuzhiyun+# This is a nodist helper.
1845*4882a593Smuzhiyun+SUBDIRS += hamcorebuilder
1846*4882a593Smuzhiyun+
1847*4882a593Smuzhiyun+# These are final build products.
1848*4882a593Smuzhiyun+SUBDIRS += bin/hamcore vpnserver vpnclient vpnbridge vpncmd
1849*4882a593Smuzhiyundiff --git a/src/Mayaqua/Makefile.am b/src/Mayaqua/Makefile.am
1850*4882a593Smuzhiyunnew file mode 100644
1851*4882a593Smuzhiyunindex 00000000..6b8dc1a6
1852*4882a593Smuzhiyun--- /dev/null
1853*4882a593Smuzhiyun+++ b/src/Mayaqua/Makefile.am
1854*4882a593Smuzhiyun@@ -0,0 +1,43 @@
1855*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1856*4882a593Smuzhiyun+#
1857*4882a593Smuzhiyun+#  This file is part of SoftEther.
1858*4882a593Smuzhiyun+#
1859*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1860*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1861*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1862*4882a593Smuzhiyun+#  any later version.
1863*4882a593Smuzhiyun+#
1864*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1865*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1866*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1867*4882a593Smuzhiyun+#  details.
1868*4882a593Smuzhiyun+#
1869*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1870*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1871*4882a593Smuzhiyun+
1872*4882a593Smuzhiyun+
1873*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
1874*4882a593Smuzhiyun+
1875*4882a593Smuzhiyun+noinst_LTLIBRARIES = libmayaqua.la
1876*4882a593Smuzhiyun+
1877*4882a593Smuzhiyun+libmayaqua_la_SOURCES = \
1878*4882a593Smuzhiyun+	Cfg.c \
1879*4882a593Smuzhiyun+	Encrypt.c \
1880*4882a593Smuzhiyun+	FileIO.c \
1881*4882a593Smuzhiyun+	Internat.c \
1882*4882a593Smuzhiyun+	Kernel.c \
1883*4882a593Smuzhiyun+	Mayaqua.c \
1884*4882a593Smuzhiyun+	Memory.c \
1885*4882a593Smuzhiyun+	Microsoft.c \
1886*4882a593Smuzhiyun+	Network.c \
1887*4882a593Smuzhiyun+	Object.c \
1888*4882a593Smuzhiyun+	OS.c \
1889*4882a593Smuzhiyun+	Pack.c \
1890*4882a593Smuzhiyun+	Secure.c \
1891*4882a593Smuzhiyun+	Str.c \
1892*4882a593Smuzhiyun+	Table.c \
1893*4882a593Smuzhiyun+	TcpIp.c \
1894*4882a593Smuzhiyun+	Tick64.c \
1895*4882a593Smuzhiyun+	Tracking.c \
1896*4882a593Smuzhiyun+	Unix.c \
1897*4882a593Smuzhiyun+	Win32.c
1898*4882a593Smuzhiyundiff --git a/src/bin/hamcore/Makefile.am b/src/bin/hamcore/Makefile.am
1899*4882a593Smuzhiyunnew file mode 100644
1900*4882a593Smuzhiyunindex 00000000..37b0291e
1901*4882a593Smuzhiyun--- /dev/null
1902*4882a593Smuzhiyun+++ b/src/bin/hamcore/Makefile.am
1903*4882a593Smuzhiyun@@ -0,0 +1,29 @@
1904*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1905*4882a593Smuzhiyun+#
1906*4882a593Smuzhiyun+#  This file is part of SoftEther.
1907*4882a593Smuzhiyun+#
1908*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1909*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1910*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1911*4882a593Smuzhiyun+#  any later version.
1912*4882a593Smuzhiyun+#
1913*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1914*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1915*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1916*4882a593Smuzhiyun+#  details.
1917*4882a593Smuzhiyun+#
1918*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1919*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1920*4882a593Smuzhiyun+
1921*4882a593Smuzhiyun+
1922*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
1923*4882a593Smuzhiyun+
1924*4882a593Smuzhiyun+# This is required to use a custom build rule with -Wall and -Werror enabled.
1925*4882a593Smuzhiyun+AUTOMAKE_OPTIONS = -Wno-override
1926*4882a593Smuzhiyun+EXEEXT =
1927*4882a593Smuzhiyun+HAMCOREBUILDER = $(top_builddir)/src/hamcorebuilder/hamcorebuilder
1928*4882a593Smuzhiyun+
1929*4882a593Smuzhiyun+sbin_PROGRAMS = hamcore.se2
1930*4882a593Smuzhiyun+
1931*4882a593Smuzhiyun+hamcore.se2$(EXEEXT): $(HAMCOREBUILDER)
1932*4882a593Smuzhiyun+	$(HAMCOREBUILDER) $(top_srcdir)/src/bin/hamcore $@
1933*4882a593Smuzhiyundiff --git a/src/hamcorebuilder/Makefile.am b/src/hamcorebuilder/Makefile.am
1934*4882a593Smuzhiyunnew file mode 100644
1935*4882a593Smuzhiyunindex 00000000..a22429f0
1936*4882a593Smuzhiyun--- /dev/null
1937*4882a593Smuzhiyun+++ b/src/hamcorebuilder/Makefile.am
1938*4882a593Smuzhiyun@@ -0,0 +1,29 @@
1939*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1940*4882a593Smuzhiyun+#
1941*4882a593Smuzhiyun+#  This file is part of SoftEther.
1942*4882a593Smuzhiyun+#
1943*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1944*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1945*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1946*4882a593Smuzhiyun+#  any later version.
1947*4882a593Smuzhiyun+#
1948*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1949*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1950*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1951*4882a593Smuzhiyun+#  details.
1952*4882a593Smuzhiyun+#
1953*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1954*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1955*4882a593Smuzhiyun+
1956*4882a593Smuzhiyun+
1957*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
1958*4882a593Smuzhiyun+
1959*4882a593Smuzhiyun+noinst_PROGRAMS = \
1960*4882a593Smuzhiyun+	hamcorebuilder
1961*4882a593Smuzhiyun+
1962*4882a593Smuzhiyun+hamcorebuilder_SOURCES = \
1963*4882a593Smuzhiyun+	hamcorebuilder.c
1964*4882a593Smuzhiyun+
1965*4882a593Smuzhiyun+hamcorebuilder_LDADD = \
1966*4882a593Smuzhiyun+	$(top_builddir)/src/Mayaqua/libmayaqua.la \
1967*4882a593Smuzhiyun+	$(top_builddir)/src/Cedar/libcedar.la
1968*4882a593Smuzhiyundiff --git a/src/vpnbridge/Makefile.am b/src/vpnbridge/Makefile.am
1969*4882a593Smuzhiyunnew file mode 100644
1970*4882a593Smuzhiyunindex 00000000..35fe043d
1971*4882a593Smuzhiyun--- /dev/null
1972*4882a593Smuzhiyun+++ b/src/vpnbridge/Makefile.am
1973*4882a593Smuzhiyun@@ -0,0 +1,29 @@
1974*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
1975*4882a593Smuzhiyun+#
1976*4882a593Smuzhiyun+#  This file is part of SoftEther.
1977*4882a593Smuzhiyun+#
1978*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
1979*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
1980*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
1981*4882a593Smuzhiyun+#  any later version.
1982*4882a593Smuzhiyun+#
1983*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
1984*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1985*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
1986*4882a593Smuzhiyun+#  details.
1987*4882a593Smuzhiyun+#
1988*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
1989*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
1990*4882a593Smuzhiyun+
1991*4882a593Smuzhiyun+
1992*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
1993*4882a593Smuzhiyun+
1994*4882a593Smuzhiyun+sbin_PROGRAMS = \
1995*4882a593Smuzhiyun+	vpnbridge
1996*4882a593Smuzhiyun+
1997*4882a593Smuzhiyun+vpnbridge_SOURCES = \
1998*4882a593Smuzhiyun+	vpnbridge.c
1999*4882a593Smuzhiyun+
2000*4882a593Smuzhiyun+vpnbridge_LDADD = \
2001*4882a593Smuzhiyun+	$(top_builddir)/src/Mayaqua/libmayaqua.la \
2002*4882a593Smuzhiyun+	$(top_builddir)/src/Cedar/libcedar.la
2003*4882a593Smuzhiyundiff --git a/src/vpnclient/Makefile.am b/src/vpnclient/Makefile.am
2004*4882a593Smuzhiyunnew file mode 100644
2005*4882a593Smuzhiyunindex 00000000..1aa55330
2006*4882a593Smuzhiyun--- /dev/null
2007*4882a593Smuzhiyun+++ b/src/vpnclient/Makefile.am
2008*4882a593Smuzhiyun@@ -0,0 +1,29 @@
2009*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
2010*4882a593Smuzhiyun+#
2011*4882a593Smuzhiyun+#  This file is part of SoftEther.
2012*4882a593Smuzhiyun+#
2013*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
2014*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
2015*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
2016*4882a593Smuzhiyun+#  any later version.
2017*4882a593Smuzhiyun+#
2018*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
2019*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2020*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
2021*4882a593Smuzhiyun+#  details.
2022*4882a593Smuzhiyun+#
2023*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
2024*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
2025*4882a593Smuzhiyun+
2026*4882a593Smuzhiyun+
2027*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
2028*4882a593Smuzhiyun+
2029*4882a593Smuzhiyun+sbin_PROGRAMS = \
2030*4882a593Smuzhiyun+	vpnclient
2031*4882a593Smuzhiyun+
2032*4882a593Smuzhiyun+vpnclient_SOURCES = \
2033*4882a593Smuzhiyun+	vpncsvc.c
2034*4882a593Smuzhiyun+
2035*4882a593Smuzhiyun+vpnclient_LDADD = \
2036*4882a593Smuzhiyun+	$(top_builddir)/src/Mayaqua/libmayaqua.la \
2037*4882a593Smuzhiyun+	$(top_builddir)/src/Cedar/libcedar.la
2038*4882a593Smuzhiyundiff --git a/src/vpncmd/Makefile.am b/src/vpncmd/Makefile.am
2039*4882a593Smuzhiyunnew file mode 100644
2040*4882a593Smuzhiyunindex 00000000..d8042aa2
2041*4882a593Smuzhiyun--- /dev/null
2042*4882a593Smuzhiyun+++ b/src/vpncmd/Makefile.am
2043*4882a593Smuzhiyun@@ -0,0 +1,29 @@
2044*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
2045*4882a593Smuzhiyun+#
2046*4882a593Smuzhiyun+#  This file is part of SoftEther.
2047*4882a593Smuzhiyun+#
2048*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
2049*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
2050*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
2051*4882a593Smuzhiyun+#  any later version.
2052*4882a593Smuzhiyun+#
2053*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
2054*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2055*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
2056*4882a593Smuzhiyun+#  details.
2057*4882a593Smuzhiyun+#
2058*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
2059*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
2060*4882a593Smuzhiyun+
2061*4882a593Smuzhiyun+
2062*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
2063*4882a593Smuzhiyun+
2064*4882a593Smuzhiyun+sbin_PROGRAMS = \
2065*4882a593Smuzhiyun+	vpncmd
2066*4882a593Smuzhiyun+
2067*4882a593Smuzhiyun+vpncmd_SOURCES = \
2068*4882a593Smuzhiyun+	vpncmd.c
2069*4882a593Smuzhiyun+
2070*4882a593Smuzhiyun+vpncmd_LDADD = \
2071*4882a593Smuzhiyun+	$(top_builddir)/src/Mayaqua/libmayaqua.la \
2072*4882a593Smuzhiyun+	$(top_builddir)/src/Cedar/libcedar.la
2073*4882a593Smuzhiyundiff --git a/src/vpnserver/Makefile.am b/src/vpnserver/Makefile.am
2074*4882a593Smuzhiyunnew file mode 100644
2075*4882a593Smuzhiyunindex 00000000..c1c33570
2076*4882a593Smuzhiyun--- /dev/null
2077*4882a593Smuzhiyun+++ b/src/vpnserver/Makefile.am
2078*4882a593Smuzhiyun@@ -0,0 +1,29 @@
2079*4882a593Smuzhiyun+#  Copyright 2014 Darik Horn <dajhorn@vanadac.com>
2080*4882a593Smuzhiyun+#
2081*4882a593Smuzhiyun+#  This file is part of SoftEther.
2082*4882a593Smuzhiyun+#
2083*4882a593Smuzhiyun+#  SoftEther is free software: you can redistribute it and/or modify it under
2084*4882a593Smuzhiyun+#  the terms of the GNU General Public License as published by the Free
2085*4882a593Smuzhiyun+#  Software Foundation, either version 2 of the License, or (at your option)
2086*4882a593Smuzhiyun+#  any later version.
2087*4882a593Smuzhiyun+#
2088*4882a593Smuzhiyun+#  SoftEther is distributed in the hope that it will be useful, but WITHOUT ANY
2089*4882a593Smuzhiyun+#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
2090*4882a593Smuzhiyun+#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
2091*4882a593Smuzhiyun+#  details.
2092*4882a593Smuzhiyun+#
2093*4882a593Smuzhiyun+#  You should have received a copy of the GNU General Public License along with
2094*4882a593Smuzhiyun+#  SoftEther.  If not, see <http://www.gnu.org/licenses/>.
2095*4882a593Smuzhiyun+
2096*4882a593Smuzhiyun+
2097*4882a593Smuzhiyun+include $(top_srcdir)/autotools/softether.am
2098*4882a593Smuzhiyun+
2099*4882a593Smuzhiyun+sbin_PROGRAMS = \
2100*4882a593Smuzhiyun+	vpnserver
2101*4882a593Smuzhiyun+
2102*4882a593Smuzhiyun+vpnserver_SOURCES = \
2103*4882a593Smuzhiyun+	vpnserver.c
2104*4882a593Smuzhiyun+
2105*4882a593Smuzhiyun+vpnserver_LDADD = \
2106*4882a593Smuzhiyun+	$(top_builddir)/src/Mayaqua/libmayaqua.la \
2107*4882a593Smuzhiyun+	$(top_builddir)/src/Cedar/libcedar.la
2108