0001-Create-autotools-plumbing-for-SoftEther.patch 76 KB

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