diff --git a/package/lean/libcryptopp/Makefile b/package/lean/libcryptopp/Makefile
index a05830064..02d06a4bf 100644
--- a/package/lean/libcryptopp/Makefile
+++ b/package/lean/libcryptopp/Makefile
@@ -1,58 +1,46 @@
 #
-# Copyright (C) 2009-2012 OpenWrt.org
+# Copyright (C) 2021 ImmortalWrt
+# <https://immortalwrt.org>
 #
-# This is free software, licensed under the GNU General Public License v2.
+# This is free software, licensed under the GNU General Public License v3.
 # See /LICENSE for more information.
 #
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libcryptopp
-PKG_VERSION:=5.6.4
-PKG_RELEASE:=2
+PKG_VERSION:=8.5.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=cryptopp$(subst .,,$(PKG_VERSION)).zip
-PKG_SOURCE_URL:=http://www.cryptopp.com/
-PKG_MD5SUM:=4ee7e5cdd4a45a14756c169eaf2a77fc
+PKG_SOURCE_URL:=https://www.cryptopp.com/
+PKG_HASH:=95fc50d59488ebf61a735cce2b2ec2c2561fc682077c7b496273d65a1ed93d9e
 
-PKG_USE_NINJA:=0
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
-
-CMAKE_INSTALL:=1
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/package.mk
-include $(INCLUDE_DIR)/cmake.mk
+
+UNZIP_CMD:=unzip -q -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
 
 define Package/libcryptopp
   SECTION:=libs
   CATEGORY:=Libraries
-  DEPENDS:=+libpthread +libstdcpp
   TITLE:=Free C++ class library of cryptographic schemes
-  URL:=http://packages.debian.org/sid/libcrypto++-dev
+  URL:=https://packages.debian.org/sid/libcrypto++-dev
+  DEPENDS:=+libpthread +libstdcpp
 endef
 
 define Package/libcryptopp/description
-  Crypto++ is library for creating C++ programs which use cryptographic algorithms.
-  The library uses a Pipes & Filters architecture with heavy use of templates and
-  abstract base classes.
+  Crypto++ is library for creating C++ programs which use cryptographic
+  algorithms. The library uses a Pipes & Filters architecture with heavy
+  use of templates and abstract base classes.
 endef
 
-#CONFIGURE_ARGS += \
-#	--enable-static \
-#	--enable-shared
-
-#TARGET_LDFLAGS += \
-#	-lpthread
-
-CMAKE_OPTIONS += -DCMAKE_CXX_FLAGS="$(FPIC)"
-CMAKE_OPTIONS += -DBUILD_STATIC=ON
-CMAKE_OPTIONS += -DBUILD_SHARED=ON
-
-UNPACK_CMD=cd $(PKG_BUILD_DIR) && unzip "$(DL_DIR)/$(PKG_SOURCE)"
-
 define Build/Prepare
 	$(Build/Prepare/Default)
-	cd $(PKG_BUILD_DIR) && rm -f GNUmakefile GNUmakefile-cross
+	cd $(PKG_BUILD_DIR); rm -f GNUmakefile GNUmakefile-cross
 endef
 
 define Build/InstallDev
diff --git a/package/lean/libcryptopp/src/Makefile.am b/package/lean/libcryptopp/src/Makefile.am
new file mode 100644
index 000000000..b830b75be
--- /dev/null
+++ b/package/lean/libcryptopp/src/Makefile.am
@@ -0,0 +1,592 @@
+## Makefile.am - Autotools configuration file for Crypto++.
+##               written and placed in public domain by Jeffrey Walton.
+##               based on Debian Makefile.am by László Böszörményi.
+##
+##    The GNUmakefile can generate the list of lib headers, lib sources,
+##    test headers and test sources. Generate the list of files with
+##    'make sources'. Remove the SIMD files for libothers_la_SOURCES.
+##    Thanks to steeldriver on U&L.SE for help with the sed.
+##
+##       make sources | sed 's|cryptlib.cpp cpu.cpp integer.cpp ||g' | \
+##           sed -e 's|[[:alnum:]]*_simd.cpp ||g' | \
+##           sed -e 's|[[:alnum:]]*_sse.cpp ||g' | \
+##           sed -e 's|[[:alnum:]]*_avx.cpp ||g' | \
+##           sed -e 's|[[:alnum:]]*_armv4.cpp ||g' | \
+##           sed -e 's|ppc_power[[:alnum:]]*.cpp ||g' | \
+##           fold -s -w 72
+##
+##    The command `make sources | sed ... | fold` will create the source file
+##    list that can be used with `libothers_la_SOURCES` below.
+##
+##    The list of header files can be built with 'make sources', too.
+##
+##       make sources | sed -e 's|[[:alnum:]]*_armv4.h ||g' \
+##           fold -s -w 72
+##
+##    Note: configure.ac deletes GNUmakefile. You can get it back with:
+##
+##       git checkout GNUmakefile
+##
+
+##    Automake does not support "specific flags for certain source files"
+##    natively, so we hack it. The hack include building 20 or so
+##    libraries and then combining them into an archive or shared object.
+##    Also see https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html
+##    https://www.gnu.org/software/automake/manual/html_node/Per_002dObject-Flags.html.
+##
+##    Visit the link below for the original Debian Autotools files
+##    https://sources.debian.net/src/libcrypto++/5.6.4-8/debian/autotools/
+##
+
+## TODO:
+##
+##  - Figure out how to include TestPrograms/ in the dist tarball
+##    TestPrograms/ is unique because it is included in dist tarball but not installed
+##
+##  - Figure out what's going on with DragonFly and dependencies
+##
+
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+AM_DEFAULT_SOURCE_EXT = .cpp
+
+## libcryptopp.la is created from disjoint libraries due to object file
+## ordering and per-object file flags requirements. libcryptopp.la is
+## named as the primary library, and the object files with special needs
+## are listed as EXTRA_LTLIBRARIES. Also see
+## https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html.
+
+lib_LTLIBRARIES = \
+   libcryptopp.la
+
+EXTRA_LTLIBRARIES = \
+   libcryptlib.la \
+   libcpu.la \
+   libinteger.la \
+   libaria_simd.la \
+   libblake2s_simd.la \
+   libblake2b_simd.la \
+   libchacha_simd.la \
+   libchacha_avx.la \
+   libcham_simd.la \
+   libcrc_simd.la \
+   libdonna_sse.la \
+   libgcm_simd.la \
+   libgf2n_simd.la \
+   libkeccak_simd.la \
+   liblea_simd.la \
+   libneon_simd.la \
+   libppc_simd.la \
+   libppc_power7.la \
+   libppc_power8.la \
+   libppc_power9.la \
+   librijndael_simd.la \
+   libsha_simd.la \
+   libshacal2_simd.la \
+   libsimon128_simd.la \
+   libspeck128_simd.la \
+   libsm4_simd.la \
+   libsse_simd.la
+
+## ARMv7-a AES and SHA by Andy Polyakov
+if CRYPTOGAMS_ARM_SOURCES
+   EXTRA_LTLIBRARIES += libaes_armv4.la
+   EXTRA_LTLIBRARIES += libsha1_armv4.la
+   EXTRA_LTLIBRARIES += libsha256_armv4.la
+   EXTRA_LTLIBRARIES += libsha512_armv4.la
+endif
+
+## The remainder of the source files
+EXTRA_LTLIBRARIES += libothers.la
+
+## libcryptopp_la_SOURCES is empty because we need to create the library
+## artifact from disjoint libraries due to object file ordering and
+## per-object file flags requriements. Actually, the adhoc.cpp file is
+## due to an automake issue of assuming C sources when the list is empty.
+## https://lists.gnu.org/archive/html/automake/2017-11/msg00000.html.
+
+libcryptopp_la_SOURCES = \
+   adhoc.cpp
+
+## Don't use EXTRA_ prefix for libcryptopp_la_LIBADD. It breaks Solaris.
+
+libcryptopp_la_LIBADD = \
+   $(libcryptlib_la_OBJECTS) \
+   $(libcpu_la_OBJECTS) \
+   $(libinteger_la_OBJECTS) \
+   $(libaria_simd_la_OBJECTS) \
+   $(libblake2s_simd_la_OBJECTS) \
+   $(libblake2b_simd_la_OBJECTS) \
+   $(libchacha_simd_la_OBJECTS) \
+   $(libchacha_avx_la_OBJECTS) \
+   $(libcham_simd_la_OBJECTS) \
+   $(libcrc_simd_la_OBJECTS) \
+   $(libdonna_sse_la_OBJECTS) \
+   $(libgcm_simd_la_OBJECTS) \
+   $(libgf2n_simd_la_OBJECTS) \
+   $(libkeccak_simd_la_OBJECTS) \
+   $(liblea_simd_la_OBJECTS) \
+   $(libneon_simd_la_OBJECTS) \
+   $(libppc_simd_la_OBJECTS) \
+   $(libppc_power7_la_OBJECTS) \
+   $(libppc_power8_la_OBJECTS) \
+   $(libppc_power9_la_OBJECTS) \
+   $(librijndael_simd_la_OBJECTS) \
+   $(libsha_simd_la_OBJECTS) \
+   $(libshacal2_simd_la_OBJECTS) \
+   $(libsimon128_simd_la_OBJECTS) \
+   $(libspeck128_simd_la_OBJECTS) \
+   $(libsm4_simd_la_OBJECTS) \
+   $(libsse_simd_la_OBJECTS)
+
+## ARMv7-a AES and SHA by Andy Polyakov
+if CRYPTOGAMS_ARM_SOURCES
+   libcryptopp_la_LIBADD += $(libaes_armv4_la_OBJECTS)
+   libcryptopp_la_LIBADD += $(libsha1_armv4_la_OBJECTS)
+   libcryptopp_la_LIBADD += $(libsha256_armv4_la_OBJECTS)
+   libcryptopp_la_LIBADD += $(libsha512_armv4_la_OBJECTS)
+endif
+
+## cpufeatures library on Android
+if ANDROID_CPU_FEATURES
+   libcryptopp_la_LIBADD += $(libcpu_features_la_OBJECTS)
+endif
+
+## The remainder of the object files
+libcryptopp_la_LIBADD += $(libothers_la_OBJECTS)
+
+## Don't use EXTRA_ prefix for libcryptopp_la_DEPENDENCIES. It breaks Solaris.
+
+libcryptopp_la_DEPENDENCIES = \
+   $(libcryptlib_la_OBJECTS) \
+   $(libcpu_la_OBJECTS) \
+   $(libinteger_la_OBJECTS) \
+   $(libaria_simd_la_OBJECTS) \
+   $(libblake2s_simd_la_OBJECTS) \
+   $(libblake2b_simd_la_OBJECTS) \
+   $(libchacha_simd_la_OBJECTS) \
+   $(libchacha_avx_la_OBJECTS) \
+   $(libcham_simd_la_OBJECTS) \
+   $(libcrc_simd_la_OBJECTS) \
+   $(libdonna_sse_la_OBJECTS) \
+   $(libkeccak_simd_la_OBJECTS) \
+   $(liblea_simd_la_OBJECTS) \
+   $(libgcm_simd_la_OBJECTS) \
+   $(libgf2n_simd_la_OBJECTS) \
+   $(libneon_simd_la_OBJECTS) \
+   $(libppc_simd_la_OBJECTS) \
+   $(libppc_power7_la_OBJECTS) \
+   $(libppc_power8_la_OBJECTS) \
+   $(libppc_power9_la_OBJECTS) \
+   $(librijndael_simd_la_OBJECTS) \
+   $(libsha_simd_la_OBJECTS) \
+   $(libshacal2_simd_la_OBJECTS) \
+   $(libsimon128_simd_la_OBJECTS) \
+   $(libspeck128_simd_la_OBJECTS) \
+   $(libsm4_simd_la_OBJECTS) \
+   $(libsse_simd_la_OBJECTS)
+
+## ARMv7-a AES and SHA by Andy Polyakov
+if CRYPTOGAMS_ARM_SOURCES
+   libcryptopp_la_DEPENDENCIES += $(libaes_armv4_la_OBJECTS)
+   libcryptopp_la_DEPENDENCIES += $(libsha1_armv4_la_OBJECTS)
+   libcryptopp_la_DEPENDENCIES += $(libsha256_armv4_la_OBJECTS)
+   libcryptopp_la_DEPENDENCIES += $(libsha512_armv4_la_OBJECTS)
+endif
+
+## cpufeatures library on Android
+if ANDROID_CPU_FEATURES
+   libcryptopp_la_DEPENDENCIES += $(libcpu_features_la_OBJECTS)
+endif
+
+## The remainder of the object files
+libcryptopp_la_DEPENDENCIES += $(libothers_la_OBJECTS)
+
+## Man, did Autotools fuck this up royally...
+## https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+libcryptopp_la_LDFLAGS = $(AM_LDFLAGS) -release 8.5.0 -version-info 8:5
+
+## Source files with special needs
+libcryptlib_la_SOURCES = cryptlib.cpp
+libcryptlib_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+libcpu_la_SOURCES = cpu.cpp
+libcpu_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+libinteger_la_SOURCES = integer.cpp
+libinteger_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+libaria_simd_la_SOURCES = aria_simd.cpp
+libaria_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_ARIA_FLAG)
+
+libblake2s_simd_la_SOURCES = blake2s_simd.cpp
+libblake2s_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_BLAKE2S_FLAG)
+
+libblake2b_simd_la_SOURCES = blake2b_simd.cpp
+libblake2b_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_BLAKE2B_FLAG)
+
+libchacha_simd_la_SOURCES = chacha_simd.cpp
+libchacha_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHACHA_FLAG)
+
+libchacha_avx_la_SOURCES = chacha_avx.cpp
+libchacha_avx_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHACHA_AVX2_FLAG)
+
+libcham_simd_la_SOURCES = cham_simd.cpp
+libcham_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CHAM_FLAG)
+
+libcrc_simd_la_SOURCES = crc_simd.cpp
+libcrc_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_CRC_FLAG)
+
+libdonna_sse_la_SOURCES = donna_sse.cpp
+libdonna_sse_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_DONNA_FLAG)
+
+libgcm_simd_la_SOURCES = gcm_simd.cpp
+libgcm_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_GCM_FLAG)
+
+libgf2n_simd_la_SOURCES = gf2n_simd.cpp
+libgf2n_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_GF2N_FLAG)
+
+libkeccak_simd_la_SOURCES = keccak_simd.cpp
+libkeccak_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_KECCAK_FLAG)
+
+liblea_simd_la_SOURCES = lea_simd.cpp
+liblea_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_LEA_FLAG)
+
+libneon_simd_la_SOURCES = neon_simd.cpp
+libneon_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_NEON_FLAG)
+
+libppc_simd_la_SOURCES = ppc_simd.cpp
+libppc_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_ALTIVEC_FLAG)
+
+libppc_power7_la_SOURCES = ppc_power7.cpp
+libppc_power7_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER7_FLAG)
+
+libppc_power8_la_SOURCES = ppc_power8.cpp
+libppc_power8_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER8_FLAG)
+
+# Do not use CRYPTOPP_POWER9_FLAG. See https://github.com/weidai11/cryptopp/issues/986
+libppc_power9_la_SOURCES = ppc_power9.cpp
+# libppc_power9_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_POWER9_FLAG)
+libppc_power9_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+librijndael_simd_la_SOURCES = rijndael_simd.cpp
+librijndael_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_AES_FLAG)
+
+libsha_simd_la_SOURCES = sha_simd.cpp
+libsha_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SHA_FLAG)
+
+libshacal2_simd_la_SOURCES = shacal2_simd.cpp
+libshacal2_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SHA_FLAG)
+
+libsimon128_simd_la_SOURCES = simon128_simd.cpp
+libsimon128_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SIMON128_FLAG)
+
+libspeck128_simd_la_SOURCES = speck128_simd.cpp
+libspeck128_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SPECK128_FLAG)
+
+libsm4_simd_la_SOURCES = sm4_simd.cpp
+libsm4_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SM4_FLAG)
+
+libsse_simd_la_SOURCES = sse_simd.cpp
+libsse_simd_la_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTOPP_SSE2_FLAG)
+
+## ARMv7-a AES and SHA by Andy Polyakov
+## Also see https://stackoverflow.com/q/51575580/608639
+if CRYPTOGAMS_ARM_SOURCES
+   libaes_armv4_la_SOURCES = aes_armv4.S
+   libsha1_armv4_la_SOURCES = sha1_armv4.S
+   libsha256_armv4_la_SOURCES = sha256_armv4.S
+   libsha512_armv4_la_SOURCES = sha512_armv4.S
+   libaes_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_THUMB_FLAG)
+   libsha1_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
+   libsha256_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
+   libsha512_armv4_la_CCASFLAGS = $(AM_CXXFLAGS) $(CRYPTOPGAMS_ARMV4_FLAG)
+endif
+
+## cpufeatures library on Android
+if ANDROID_CPU_FEATURES
+   libcpu_features_la_SOURCES = cpu-features.c
+endif
+
+# This is the list of remaining sources files that don't need special order
+# and don't need special flags. It is formed by removing cryptlib.cpp,
+# cpu.cpp, integer.cpp, *_avx.cpp and *_simd.cpp files. It is sorted in
+# alphabetical order for deterministic builds.
+
+# To build this list, see the head notes.
+libothers_la_SOURCES = \
+	3way.cpp adler32.cpp algebra.cpp algparam.cpp allocate.cpp arc4.cpp \
+	aria.cpp ariatab.cpp asn.cpp authenc.cpp base32.cpp base64.cpp \
+	basecode.cpp bfinit.cpp blake2.cpp blowfish.cpp blumshub.cpp \
+	camellia.cpp cast.cpp casts.cpp cbcmac.cpp ccm.cpp chacha.cpp \
+	chachapoly.cpp cham.cpp channels.cpp cmac.cpp crc.cpp darn.cpp \
+	default.cpp des.cpp dessp.cpp dh.cpp dh2.cpp dll.cpp donna_32.cpp \
+	donna_64.cpp dsa.cpp eax.cpp ec2n.cpp eccrypto.cpp ecp.cpp elgamal.cpp \
+	emsa2.cpp eprecomp.cpp esign.cpp files.cpp filters.cpp fips140.cpp \
+	fipstest.cpp gcm.cpp gf256.cpp gf2_32.cpp gf2n.cpp gfpcrypt.cpp \
+	gost.cpp gzip.cpp hc128.cpp hc256.cpp hex.cpp hight.cpp hmac.cpp \
+	hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp \
+	keccak.cpp keccak_core.cpp lea.cpp luc.cpp mars.cpp marss.cpp md2.cpp \
+	md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp nbtheory.cpp \
+	oaep.cpp osrng.cpp padlkrng.cpp panama.cpp pkcspad.cpp poly1305.cpp \
+	polynomi.cpp pssr.cpp pubkey.cpp queue.cpp rabbit.cpp rabin.cpp \
+	randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp \
+	rijndael.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp safer.cpp salsa.cpp \
+	scrypt.cpp seal.cpp seed.cpp serpent.cpp sha.cpp sha3.cpp shacal2.cpp \
+	shake.cpp shark.cpp sharkbox.cpp simeck.cpp simon.cpp skipjack.cpp \
+	sm3.cpp sm4.cpp sosemanuk.cpp speck.cpp square.cpp squaretb.cpp \
+	strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp \
+	ttmac.cpp tweetnacl.cpp twofish.cpp vmac.cpp wake.cpp whrlpool.cpp \
+	xed25519.cpp xtr.cpp xtrcrypt.cpp xts.cpp zdeflate.cpp zinflate.cpp \
+	zlib.cpp
+
+# To build this list, see the head notes.
+pkginclude_HEADERS = \
+	3way.h adler32.h adv_simd.h aes.h algebra.h algparam.h allocate.h \
+	arc4.h argnames.h aria.h arm_simd.h asn.h authenc.h base32.h base64.h \
+	basecode.h blake2.h blowfish.h blumshub.h camellia.h cast.h cbcmac.h \
+	ccm.h chacha.h chachapoly.h cham.h channels.h cmac.h config.h \
+	config_align.h config_asm.h config_cpu.h config_cxx.h config_dll.h \
+	config_int.h config_misc.h config_ns.h config_os.h config_ver.h cpu.h \
+	crc.h cryptlib.h darn.h default.h des.h dh.h dh2.h dll.h dmac.h donna.h \
+	donna_32.h donna_64.h donna_sse.h drbg.h dsa.h eax.h ec2n.h eccrypto.h \
+	ecp.h ecpoint.h elgamal.h emsa2.h eprecomp.h esign.h fhmqv.h files.h \
+	filters.h fips140.h fltrimpl.h gcm.h gf256.h gf2_32.h gf2n.h gfpcrypt.h \
+	gost.h gzip.h hashfwd.h hc128.h hc256.h hex.h hight.h hkdf.h hmac.h \
+	hmqv.h hrtimer.h ida.h idea.h integer.h iterhash.h kalyna.h keccak.h \
+	lea.h local.h lubyrack.h luc.h mars.h md2.h md4.h md5.h mdc.h \
+	mersenne.h misc.h modarith.h modes.h modexppc.h mqueue.h mqv.h \
+	naclite.h nbtheory.h nr.h oaep.h oids.h osrng.h ossig.h padlkrng.h \
+	panama.h pch.h pkcspad.h poly1305.h polynomi.h ppc_simd.h pssr.h \
+	pubkey.h pwdbased.h queue.h rabbit.h rabin.h randpool.h rc2.h rc5.h \
+	rc6.h rdrand.h rijndael.h ripemd.h rng.h rsa.h rw.h safer.h salsa.h \
+	scrypt.h seal.h secblock.h secblockfwd.h seckey.h seed.h serpent.h \
+	serpentp.h sha.h sha3.h shacal2.h shake.h shark.h simeck.h simon.h \
+	simple.h siphash.h skipjack.h sm3.h sm4.h smartptr.h sosemanuk.h \
+	speck.h square.h stdcpp.h strciphr.h tea.h threefish.h tiger.h trap.h \
+	trunhash.h ttmac.h tweetnacl.h twofish.h vmac.h wake.h whrlpool.h \
+	words.h xed25519.h xtr.h xtrcrypt.h xts.h zdeflate.h zinflate.h zlib.h
+
+noinst_HEADERS = \
+    local.h \
+    bench.h \
+    factory.h \
+    resource.h \
+    validate.h \
+    aes_armv4.h \
+    sha1_armv4.h \
+    sha256_armv4.h \
+    sha512_armv4.h
+
+bin_PROGRAMS = cryptest$(EXEEXT)
+
+cryptest_CXXFLAGS = $(AM_CXXFLAGS) $(CRYPTEST_CXXFLAGS) -DCRYPTOPP_DATA_DIR='"${pkgdatadir}/"'
+cryptest_SOURCES = \
+    test.cpp bench1.cpp bench2.cpp bench3.cpp datatest.cpp \
+    dlltest.cpp fipsalgt.cpp validat0.cpp validat1.cpp validat2.cpp \
+    validat3.cpp validat4.cpp validat5.cpp validat6.cpp validat7.cpp \
+    validat8.cpp validat9.cpp validat10.cpp regtest1.cpp regtest2.cpp \
+    regtest3.cpp regtest4.cpp
+
+nodist_cryptest_SOURCES = adhoc.cpp
+cryptest_LDADD = $(lib_LTLIBRARIES)
+
+CLEANFILES = adhoc.cpp
+
+## Copy the TestVectors/ and TestData/ to ${pkgdatadir}.
+## TestPrograms/ is included in the tarball but not installed.
+## https://www.gnu.org/software/automake/manual/html_node/Data.html
+
+# Create with 'ls TestData/*.dat'. These files get installed.
+testdata_FILES = \
+    TestData/3desval.dat     TestData/fhmqv160.dat  TestData/rc2val.dat \
+    TestData/3wayval.dat     TestData/fhmqv256.dat  TestData/rc5val.dat \
+    TestData/aria.dat        TestData/fhmqv384.dat  TestData/rc6val.dat \
+    TestData/camellia.dat    TestData/fhmqv512.dat  TestData/rijndael.dat \
+    TestData/cast128v.dat    TestData/gostval.dat   TestData/rsa1024.dat \
+    TestData/cast256v.dat    TestData/hmqv160.dat   TestData/rsa2048a.dat \
+    TestData/defdmac1.bin    TestData/hmqv256.dat   TestData/rsa2048.dat \
+    TestData/defdmac2.bin    TestData/hmqv384.dat   TestData/rsa400pb.dat \
+    TestData/descert.dat     TestData/hmqv512.dat   TestData/rsa400pv.dat \
+    TestData/dh1024.dat      TestData/ideaval.dat   TestData/rsa512a.dat \
+    TestData/dh2048.dat      TestData/luc1024.dat   TestData/rw1024.dat \
+    TestData/dlie1024.dat    TestData/luc2048.dat   TestData/rw2048.dat \
+    TestData/dlie2048.dat    TestData/lucc1024.dat  TestData/saferval.dat \
+    TestData/dsa1024b.dat    TestData/lucc512.dat   TestData/serpentv.dat \
+    TestData/dsa1024.dat     TestData/lucd1024.dat  TestData/shacal2v.dat \
+    TestData/dsa512.dat      TestData/lucd512.dat   TestData/sharkval.dat \
+    TestData/ecies_p160.dat  TestData/lucs1024.dat  TestData/skipjack.dat \
+    TestData/ecies_t163.dat  TestData/lucs512.dat   TestData/squareva.dat \
+    TestData/ed25519.dat     TestData/marsval.dat   TestData/twofishv.dat \
+    TestData/ed25519v0.dat   TestData/mqv1024.dat   TestData/usage.dat \
+    TestData/ed25519v1.dat   TestData/mqv2048.dat   TestData/x25519.dat \
+    TestData/elgc1024.dat    TestData/nr1024.dat    TestData/x25519v0.dat \
+    TestData/esig1023.dat    TestData/nr2048.dat    TestData/x25519v1.dat \
+    TestData/esig1536.dat    TestData/rabi1024.dat  TestData/xtrdh171.dat \
+    TestData/esig2046.dat    TestData/rabi2048.dat  TestData/xtrdh342.dat
+
+# Create with 'ls TestVectors/*.txt'. These files get installed.
+testvector_FILES = \
+    TestVectors/aead.txt              TestVectors/rsa_pss.txt \
+    TestVectors/aes.txt               TestVectors/rw.txt \
+    TestVectors/all.txt               TestVectors/salsa.txt \
+    TestVectors/aria.txt              TestVectors/seal.txt \
+    TestVectors/blake2b.txt           TestVectors/seed.txt \
+    TestVectors/blake2s.txt           TestVectors/sha1_160_fips_180.txt \
+    TestVectors/blake2.txt            TestVectors/sha1_fips_180.txt \
+    TestVectors/camellia.txt          TestVectors/sha2_224_fips_180.txt \
+    TestVectors/ccm.txt               TestVectors/sha2_256_fips_180.txt \
+    TestVectors/chacha20poly1305.txt  TestVectors/sha2_384_fips_180.txt \
+    TestVectors/chacha_tls.txt        TestVectors/sha2_512_fips_180.txt \
+    TestVectors/chacha.txt            TestVectors/sha2_fips_180.txt \
+    TestVectors/cham.txt              TestVectors/sha2.txt \
+    TestVectors/cmac.txt              TestVectors/sha3_224_fips_202.txt \
+    TestVectors/dlies.txt             TestVectors/sha3_256_fips_202.txt \
+    TestVectors/dsa_1363.txt          TestVectors/sha3_384_fips_202.txt \
+    TestVectors/dsa_rfc6979.txt       TestVectors/sha3_512_fips_202.txt \
+    TestVectors/dsa.txt               TestVectors/sha3_fips_202.txt \
+    TestVectors/eax.txt               TestVectors/sha3.txt \
+    TestVectors/esign.txt             TestVectors/shacal2.txt \
+    TestVectors/gcm.txt               TestVectors/shake.txt \
+    TestVectors/hc128.txt             TestVectors/sha.txt \
+    TestVectors/hc256.txt             TestVectors/simeck.txt \
+    TestVectors/hight.txt             TestVectors/simon.txt \
+    TestVectors/hkdf.txt              TestVectors/siphash.txt \
+    TestVectors/hmac.txt              TestVectors/skipjack.txt \
+    TestVectors/kalyna.txt            TestVectors/sm3.txt \
+    TestVectors/keccak.txt            TestVectors/sm4.txt \
+    TestVectors/lea.txt               TestVectors/sosemanuk.txt \
+    TestVectors/mars.txt              TestVectors/speck.txt \
+    TestVectors/nr.txt                TestVectors/tea.txt \
+    TestVectors/panama.txt            TestVectors/threefish.txt \
+    TestVectors/poly1305aes.txt       TestVectors/ttmac.txt \
+    TestVectors/poly1305_tls.txt      TestVectors/vmac.txt \
+    TestVectors/rabbit.txt            TestVectors/wake.txt \
+    TestVectors/Readme.txt            TestVectors/whrlpool.txt \
+    TestVectors/rsa_oaep.txt          TestVectors/xchacha.txt \
+    TestVectors/rsa_pkcs1_1_5.txt     TestVectors/xts.txt
+
+# Create with 'ls TestPrograms/test_*.cxx'. These files do not get installed.
+# They exist so the feature tests can be run from the configure directory.
+testprogs_FILES= \
+	TestPrograms/test_32bit.cxx
+	TestPrograms/test_64bit.cxx
+	TestPrograms/test_arm_acle_header.cxx
+	TestPrograms/test_arm_aes.cxx
+	TestPrograms/test_arm_asimd.cxx
+	TestPrograms/test_arm_crc.cxx
+	TestPrograms/test_arm_neon.cxx
+	TestPrograms/test_arm_neon_header.cxx
+	TestPrograms/test_arm_pmull.cxx
+	TestPrograms/test_arm_sha1.cxx
+	TestPrograms/test_arm_sha256.cxx
+	TestPrograms/test_arm_sha3.cxx
+	TestPrograms/test_arm_sha512.cxx
+	TestPrograms/test_arm_sm3.cxx
+	TestPrograms/test_arm_sm4.cxx
+	TestPrograms/test_asm_mixed.cxx
+	TestPrograms/test_cxx11_alignas.cxx
+	TestPrograms/test_cxx11_alignof.cxx
+	TestPrograms/test_cxx11_assert.cxx
+	TestPrograms/test_cxx11_atomic.cxx
+	TestPrograms/test_cxx11_auto.cxx
+	TestPrograms/test_cxx11_constexpr.cxx
+	TestPrograms/test_cxx11.cxx
+	TestPrograms/test_cxx11_deletefn.cxx
+	TestPrograms/test_cxx11_enumtype.cxx
+	TestPrograms/test_cxx11_initializer.cxx
+	TestPrograms/test_cxx11_lambda.cxx
+	TestPrograms/test_cxx11_noexcept.cxx
+	TestPrograms/test_cxx11_nullptr.cxx
+	TestPrograms/test_cxx11_staticinit.cxx
+	TestPrograms/test_cxx11_sync.cxx
+	TestPrograms/test_cxx11_vartemplates.cxx
+	TestPrograms/test_cxx14.cxx
+	TestPrograms/test_cxx17_assert.cxx
+	TestPrograms/test_cxx17.cxx
+	TestPrograms/test_cxx17_exceptions.cxx
+	TestPrograms/test_cxx98_exception.cxx
+	TestPrograms/test_cxx.cxx
+	TestPrograms/test_glibc.cxx
+	TestPrograms/test_newlib.cxx
+	TestPrograms/test_ppc_aes.cxx
+	TestPrograms/test_ppc_altivec.cxx
+	TestPrograms/test_ppc_power7.cxx
+	TestPrograms/test_ppc_power8.cxx
+	TestPrograms/test_ppc_power9.cxx
+	TestPrograms/test_ppc_sha.cxx
+	TestPrograms/test_ppc_vmull.cxx
+	TestPrograms/test_pthreads.cxx
+	TestPrograms/test_x86_aes.cxx
+	TestPrograms/test_x86_avx2.cxx
+	TestPrograms/test_x86_avx512.cxx
+	TestPrograms/test_x86_avx.cxx
+	TestPrograms/test_x86_clmul.cxx
+	TestPrograms/test_x86_cpuid.cxx
+	TestPrograms/test_x86_rdrand.cxx
+	TestPrograms/test_x86_rdseed.cxx
+	TestPrograms/test_x86_sha.cxx
+	TestPrograms/test_x86_sse2.cxx
+	TestPrograms/test_x86_sse3.cxx
+	TestPrograms/test_x86_sse41.cxx
+	TestPrograms/test_x86_sse42.cxx
+	TestPrograms/test_x86_ssse3.cxx
+	TestPrograms/test_x86_via_aes.cxx
+	TestPrograms/test_x86_via_rng.cxx
+	TestPrograms/test_x86_via_sha.cxx
+
+nobase_dist_pkgdata_DATA = \
+    $(testdata_FILES) \
+    $(testvector_FILES)
+
+# Can't seem to get this to work, despite the fiddling attempts.
+# https://www.gnu.org/software/automake/manual/html_node/Uniform.html and
+# https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
+#nobase_noinst_data_DATA = \
+#    $(testprogs_FILES)
+
+# Workaround Automake bug. We can't seem to include the TestProgram/ data
+# in the tarball without installation using their Uniform Naming Scheme
+# https://www.gnu.org/software/automake/manual/html_node/Uniform.html and
+# https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
+dist-hook:
+	chmod -R u+w $(distdir)
+	cp -r TestPrograms/ $(distdir)
+	rm -f $(distdir)/TestPrograms/dump2def.cxx
+
+## Automake bug workaround. If libcryptopp_la_SOURCES is an empty list, Automake assumes
+## C source files and drives link through the C compiler. We provide the empty adhoc.cpp
+## to get things back on course, so adhoc.cpp must always be copied.
+
+adhoc.cpp:
+	cp adhoc.cpp.proto adhoc.cpp
+	touch adhoc.cpp
+
+## Remove doc directory if present
+distclean-local:
+	-rm -rf html-docs doxyfile.stamp
+
+## Automake does not properly uninstall the library test data and vectors
+uninstall-hook:
+	-rm -rf ${pkgdatadir}
+	-rm -rf ${pkghtmldir}
+
+## Doxygen is available but not built by default
+## TODO: copy docs to ${pkghtmldir} if built
+if CRYPTOPP_DOXYGEN_AVAILABLE
+
+## PHONY targets. Automake can only handle one of them...
+.PHONY: doc docs html htmldoc checkout reset
+
+doc docs html htmldoc:
+	$(DOXYGEN) Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING
+
+endif
+
+# Restore GNUmakefile
+checkout:
+	git checkout master -f
+
+# Restore GNUmakefile
+reset:
+	git reset --hard HEAD
diff --git a/package/lean/libcryptopp/src/configure.ac b/package/lean/libcryptopp/src/configure.ac
new file mode 100644
index 000000000..9296bf207
--- /dev/null
+++ b/package/lean/libcryptopp/src/configure.ac
@@ -0,0 +1,2746 @@
+## configure.ac - Autotools configuration file for Crypto++.
+##                written and placed in public domain by Jeffrey Walton.
+##                based on Debian configure.ac by László Böszörményi.
+
+
+## Visit the link below for the original Debian Autotools files
+##   http://sources.debian.net/src/libcrypto++/5.6.4-8/debian/autotools/
+##
+## To generate the configure file perform the following. The extra steps are
+## needed because the Autotools on some machines, like a PowerMac or Solaris,
+## are not modern enough for macros like AC_PROG_LIBTOOL and AC_ENABLE_SHARED.
+##
+##   autoupdate && libtoolize && autoreconf
+##
+## Our Autoconf tests are strict. We use custom AC_COMPILE_IFELSE and
+## AC_LINK_IFELSE that rejects a feature test if there are any warnings or
+## errors. We needed this because Autotools was mis-detecting features on AIX
+## and Solarix using XLC and SunCC. We also needed the custom tests because
+## Autoconf does not have a "warnings as errors" option that just works on all
+## the compilers we support.
+
+
+## TODO
+##
+## - Figure out how to make Autoconf stop using the fucking C compiler for tasks.
+##   The damn tool does not honor AC_PROG_CXX or observe the absence of
+##   AC_PROG_CC. It also fails to provide a AC_PROG_NO_CC macro. The damn tool
+##   is no better than Cmake.
+##
+## - Fix Autotools not treating warnings as errors. Our test programs are clean,
+##   so they should compile cleanly or the feature is not available. However,
+##   Autotools lacks a AC_TREAT_WARNINGS_AS_ERRORS-like macro or define.
+##
+## - Fix Autoconf using the wrong AR and ARFLAGS on platforms like OS X. Also
+##   see http://lists.gnu.org/archive/html/bug-autoconf/2017-11/msg00002.html.
+##
+## - Fix Autoconf not honoring LT_INIT. We are trying to enable PIC, static and
+##   shared by default but Autotools is ignoring [pic-only]. Also see
+##   https://stackoverflow.com/q/56215237/608639.
+##
+## - Fix Autoconf not using PIC/PIE for cryptest. The problem is bigger than the
+##   LT_INIT bug. There is no Uniform Name like bin_LTPROGRAMS to signal PIC/PIE
+##   should be used. Autoconf is guessing wrong and not using PIC/PIE.
+##
+## - Fix Autotools 'make dist' failures. If you run 'make dist' on x86_64, then
+##   the release tarball only works on x86_64. It is like it is pre-configured
+##   for only the x86_64 platform, and other platform code paths have been
+##   thrown away. WTF???
+##
+## - Fix Autoconf ignoring our config.h.in. This one looks like it is a problem
+##   without a solution. Also see https://stackoverflow.com/q/48436715/608639.
+##   (Gave up after https://github.com/weidai11/cryptopp/commit/c51f0ecbfd21.
+##   Now we can write new config_asm.h, config_cxx.h, and config_misc.h.)
+##
+## - Figure out how to write new configuration information to config_asm.h,
+##   config_cxx.h, and config_misc.h. According to the Autoconf manual we
+##   can use multiple headers. However, it does not seem to work in
+##   practice. Also see https://stackoverflow.com/q/56193203/608639.
+##
+## - Stop using local.h, and write the config data into a Crypto++ compatible
+##   config.h. There's not much to "Crypto++ compatible config.h". We need test
+##   and write preprocessor macros like CRYPTOPP_BIG_ENDIAN,
+##   CRYPTOPP_LITTLE_ENDIAN, CRYPTOPP_CXX11, etc. There's just a lot of them.
+##   This problem now appears to be closely related to the config.h.in problem.
+##   We can't supply a template and expect Autotools to honor it. Also see
+##   https://lists.gnu.org/archive/html/autoconf/2018-07/msg00014.html.
+##
+## - Fix incorrect use of --with-sysroot. Autotools does not seem to honor it
+##   when it is set. Also see http://stackoverflow.com/q/47226389/608639.
+##
+## - Fix MSYS2 compile error due to `lt-cryptest.c` and `lt-cryptestcwd.c`.
+##   They are C files and don't use necessary C++ flags. They also use Posix
+##   functions but fail to define _XOPEN_SOURCE. I'm guessing this has something
+##   to do with libtool, but I have no idea how to fix it at the moment. Also
+##   see http://lists.gnu.org/archive/html/bug-libtool/2017-11/msg00002.html.
+##
+## - Fix the ARM 32-builds. Running 'cryptest v' results in
+##   "unexpected reloc type 0x03". GNUmakefile and CMake are OK. I've been
+##   working on it (on and off) for three days and no closer to finding a
+##   solution. Autotools is such a broken heaping pile of shit... Also see
+##   https://sourceware.org/ml/binutils/2019-05/msg00287.html
+##
+## - Fix static initialization order fiasco tests. We don't know how to craft
+##   the tests because we don't know how to compile two files at once using
+##   Autotools. Also see https://stackoverflow.com/q/51662985/608639.
+##
+## - Fix -xarch for SHA when using SunCC. We don't know the arch value at the
+##   moment. If things work as expected we will fail the feature test and the
+##   code paths will be disabled. But we want them enabled once Sun supports
+##   the SHA extensions. See https://stackoverflow.com/q/45872180/608639.
+##
+## - Fix LDFLAGS on AIX. Autotools is adding unwanted flags to LDFLAGS and it
+##   is causing a runtime crash in startup code. See
+##   https://stackoverflow.com/q/51680113/608639.
+##
+## - Add ubsan and asan targets for testing.
+##
+## - Setup test environment with Dash, which appears to be the lamest shell.
+##
+## - Package Autotools propery, for a regular user's definition of "proper".
+##   I don't know what the final deliverables or artifacts are supposed to
+##   look like. We also get warnings and errors due to a missing m4/ directory
+##   even though we don't use it. Maybe we need to distribute an empty m4/
+##   directory to keep the tools quiet.
+
+#############################################################################
+
+## This configure.ac proceeds in five parts:
+##
+##   1. configure.ac preamble
+##
+##   2. compiler and host detection
+##
+##   3. configure options, like --disable-asm
+##
+##   4. CPU feature tests, like SSE, NEON, ARMv8, PowerPC
+##
+##   5. C++ feature tests, like C++11, alignof and alignas
+##
+##   6. Misc feature and options
+##
+
+#############################################################################
+##   PART 1   PART 1   PART 1   PART 1   PART 1   PART 1   PART 1   PART 1
+## ==========================================================================
+## configure.ac preamble
+#############################################################################
+
+AC_INIT([Crypto++], [8.3], [http://www.cryptopp.com/wiki/Bug_Report], [cryptopp], [http://www.cryptopp.com])
+AC_CONFIG_SRCDIR([configure.ac])
+AC_CONFIG_HEADERS([local.h])
+AC_CONFIG_FILES([Makefile] [libcryptopp.pc])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE
+
+AM_PROG_AS
+AC_PROG_LIBTOOL
+
+AC_PROG_CXX
+AC_LANG([C++])
+LT_LANG([C++])
+
+# Programs we use
+AC_PROG_SED
+AC_PROG_AWK
+AC_PROG_GREP
+AC_PROG_EGREP
+
+# Detect build and host platforms
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
+
+## Assert this once to avoid surprises
+AC_LANG_ASSERT([C++])
+
+#############################################################################
+
+## Our Autoconf tests are strict. We use custom AC_COMPILE_IFELSE and
+## AC_LINK_IFELSE that rejects a feature test if there are any warnings or
+## errors. We needed this because Autotools was mis-detecting features on
+## AIX and Solarix using XLC and SunCC. We also needed the custom tests
+## because Autoconf does not have a "warnings as errors" option that just
+## works on all the compilers we support.
+
+AC_DEFUN([XXX_COMPILE_IFELSE],
+   [AC_COMPILE_IFELSE(
+      [$1],
+      [retval=0
+         touch conftest.err
+         if test `cat conftest.err | wc -w` != "0"; then retval=1; fi
+      ],[retval=1]
+   )
+   AS_IF([test $retval = 0],[$2],[$3])]
+)
+
+AC_DEFUN([XXX_LINK_IFELSE],
+   [AC_LINK_IFELSE(
+      [$1],
+      [retval=0
+         touch conftest.err
+         if test `cat conftest.err | wc -w` != "0"; then retval=1; fi
+      ],[retval=1]
+   )
+   AS_IF([test $retval = 0],[$2],[$3])]
+)
+
+#############################################################################
+##   PART 2   PART 2   PART 2   PART 2   PART 2   PART 2   PART 2   PART 2
+## ==========================================================================
+## compiler and host detection
+#############################################################################
+
+## These are some variables that help us track platform and compiler.
+## It speeds up configuration by adding some intelligence to the
+## test selection process. It also avoids failed configurations by
+## avoiding some tests that fail but Autotools reports as success.
+
+IS_AIX_OS=`echo $build | $GREP -i -c 'aix'`
+IS_SUN_OS=`uname -s | $GREP -i -c 'SunOS'`
+IS_LINUX_OS=`echo "$build" | $GREP -i -c 'linux'`
+IS_APPLE_OS=`echo "$build" | $EGREP -i -c 'apple|darwin'`
+IS_ANDROID_OS=`echo $build | $GREP -i -c 'android'`
+IS_CYGWIN_OS=`echo $build | $GREP -i -c 'cygwin'`
+IS_MINGW_OS=`echo $build | $GREP -i -c 'mingw'`
+
+IS_IA32=`echo $build | $EGREP -i -c 'i.86|x86_64|amd64'`
+IS_ARM32=`echo $build | $EGREP -i -c 'arm|armhf|arm7l|eabihf'`
+IS_ARMV8=`echo $build | $EGREP -i -c 'aarch32|aarch64'`
+IS_PPC=`echo $build | $EGREP -i -c 'ppc|powerpc|powermac'`
+IS_SPARC=`echo $build | $EGREP -i -c 'sparc|sparcv8|sparcv9|sparc64'`
+
+## Debug builds add more goodies to help break things. I like breaking things.
+IS_DEBUG=`echo $CPPFLAGS $CXXFLAGS | $GREP -i -c '\-DDEBUG'`
+
+#############################################################################
+
+## Determine the compiler's target. GCC '-dumpmachine' is the target,
+## so it represents what the compiler is building for (and not what its
+## running on). We add '2>/dev/null' because IBM's xlC dumps the man page
+## when presented with '-dumpmachine' since it is not a valid option.
+
+## See if CXX is valid. Autotools just trucks on with an invalid one.
+
+if test x"$CXX" != "x"; then
+   COMPILER_VALID=`command -v "$CXX"`
+   if test x"$COMPILER_VALID" = "x"; then
+      AC_MSG_FAILURE(["$CXX" is not a valid compiler or is not on-path])
+   fi
+fi
+
+## Compiler is valid. Try to detect the target and vendor.
+## SunCC is empty, so we just use $build
+
+COMPILER_TARGET=`"$CXX" "$CXXFLAGS" -dumpmachine 2>/dev/null`
+if test x"$COMPILER_TARGET" = "x"; then
+   COMPILER_TARGET="$build"
+fi
+
+## Determine the compiler's vendor. We need to work around some Autoconf bugs.
+
+COMPILER_VERSION=`"$CXX" --version 2>/dev/null | head -n 1`
+
+## IBM xlC test if COMPILER_VERSION is empty
+if test x"$COMPILER_VERSION" = "x"; then
+   COMPILER_VERSION=`"$CXX" -qversion 2>/dev/null | head -n 1`
+fi
+
+## SunCC test if COMPILER_VERSION is empty
+if test x"$COMPILER_VERSION" = "x"; then
+   COMPILER_VERSION=`"$CXX" -V 2>&1 | head -n 1`
+fi
+
+## Microsoft test if COMPILER_VERSION is empty
+if test `basename "$CXX"` = "cl.exe"; then
+   COMPILER_VERSION=`"$CXX" /? 2>&1 | head -n 1`
+fi
+
+IS_GCC_COMPILER=`echo $COMPILER_VERSION | $GREP -i -v 'Clang' | $EGREP -i -c 'GCC|G\+\+'`
+IS_MSC_COMPILER=`echo $COMPILER_VERSION | $GREP -i -c 'Microsoft'`
+IS_LLVM_COMPILER=`echo $COMPILER_VERSION | $EGREP -i -c 'LLVM|Clang'`
+IS_SUN_COMPILER=`echo $COMPILER_VERSION | $EGREP -i -c 'Sun C'`
+IS_ICC_COMPILER=`echo $COMPILER_VERSION | $GREP -i -c 'ICC'`
+IS_XLC_COMPILER=`echo $COMPILER_VERSION | $GREP -i -c 'IBM XL'`
+IS_PORTS_COMPILER=`echo $COMPILER_VERSION | $EGREP -i -c 'MacPorts|Homebrew'`
+
+## A catch-all for compilers that claim to be GCC compatible. Each should be
+## able to handle GCC syntax. It excludes XLC, SunCC and MSVC
+if test "$IS_GCC_COMPILER" != "0" || test "$IS_LLVM_COMPILER" != "0" || \
+   test "$IS_ICC_COMPILER" != "0"; then
+   IS_GNUC_COMPILER=1
+else
+   IS_GNUC_COMPILER=0
+fi
+
+## Friendly names for reporting
+CXXNAME=`basename "$CXX"`
+LDNAME=`basename "$LD"`
+
+## Small fixup
+case "$LDNAME" in
+    "ld "*) LDNAME=ld
+    ;;
+esac
+
+#############################################################################
+##   PART 3   PART 3   PART 3   PART 3   PART 3   PART 3   PART 3   PART 3
+## ==========================================================================
+## configure options, like --disable-asm
+#############################################################################
+
+AC_ARG_ENABLE([pthreads],
+   AS_HELP_STRING([--disable-pthreads], [disable pthreads]))
+AS_IF([test "x$enable_pthreads" = "xno"], [
+   : # AC_DEFINE([CRYPTOPP_DISABLE_PTHREADS], [1], [disable pthreads])
+])
+
+# Applies to all platforms
+AC_ARG_ENABLE([asm],
+   AS_HELP_STRING([--disable-asm], [disable all ASM and intrinsics]))
+AS_IF([test "x$enable_asm" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_ASM], [1], [disable all ASM and intrinsics])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ASM"
+])
+
+# X86 defines
+AC_ARG_ENABLE([sse2],
+   AS_HELP_STRING([--disable-sse2], [disable x86 SSE2 instructions]))
+AS_IF([test "x$enable_sse2" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SSE2], [1], [disable x86 SSE2 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE2"
+])
+
+AC_ARG_ENABLE([sse3],
+   AS_HELP_STRING([--disable-sse3], [disable x86 SSE3 instructions]))
+AS_IF([test "x$enable_sse3" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SSE3], [1], [disable x86 SSE3 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE3"
+])
+
+AC_ARG_ENABLE([ssse3],
+   AS_HELP_STRING([--disable-ssse3], [disable x86 SSSE3 instructions]))
+AS_IF([test "x$enable_ssse3" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SSSE3], [1], [disable x86 SSSE3 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSSE3"
+])
+
+AC_ARG_ENABLE([sse4],
+   AS_HELP_STRING([--disable-sse4], [disable x86 SSE4.1 and SSE4.2 instructions]))
+AS_IF([test "x$enable_sse4" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SSE4], [1], [disable x86 SSE4.1 and SSE4.2 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE4"
+])
+
+AC_ARG_ENABLE([clmul],
+   AS_HELP_STRING([--disable-clmul], [disable x86 CLMUL instructions]))
+AS_IF([test "x$enable_clmul" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_CLMUL], [1], [disable x86 CLMUL instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_CLMUL"
+])
+
+AC_ARG_ENABLE([aes],
+   AS_HELP_STRING([--disable-aes], [disable x86 AES instructions]))
+AS_IF([test "x$enable_aes" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_AES], [1], [disable x86 AES instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AES"
+])
+
+AC_ARG_ENABLE([sha],
+   AS_HELP_STRING([--disable-sha], [disable x86 SHA instructions]))
+AS_IF([test "x$enable_sha" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SHA], [1], [disable x86 SHA instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHA"
+])
+
+AC_ARG_ENABLE([avx],
+   AS_HELP_STRING([--disable-avx], [disable x86 AVX instructions]))
+AS_IF([test "x$enable_avx" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_AVX], [1], [disable x86 AVX instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AVX"
+])
+
+AC_ARG_ENABLE([avx2],
+   AS_HELP_STRING([--disable-avx2], [disable x86 AVX2 instructions]))
+AS_IF([test "x$enable_avx2" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_AVX2], [1], [disable x86 AVX2 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AVX2"
+])
+
+# ARM-32 defines
+AC_ARG_ENABLE([armv7],
+   AS_HELP_STRING([--disable-armv7], [disable ARM ARMv7 instructions]))
+AS_IF([test "x$enable_armv7" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_ARMV7], [1], [disable ARM ARMv7 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARMV7"
+])
+
+AC_ARG_ENABLE([neon],
+   AS_HELP_STRING([--disable-neon], [disable ARM NEON instructions]))
+AS_IF([test "x$enable_neon" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_NEON], [1], [disable ARM NEON instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_NEON"
+])
+
+# ARMv8 defines
+AC_ARG_ENABLE([asimd],
+   AS_HELP_STRING([--disable-asimd], [disable ARMv8 ASIMD instructions]))
+AS_IF([test "x$enable_asimd" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_ASIMD], [1], [disable ARMv8 ASIMD instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ASIMD"
+])
+
+AC_ARG_ENABLE([crc32],
+   AS_HELP_STRING([--disable-crc32], [disable ARMv8 CRC32 instructions]))
+AS_IF([test "x$enable_crc32" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_CRC32], [1], [disable ARMv8 CRC32 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_CRC32"
+])
+
+AC_ARG_ENABLE([pmull],
+   AS_HELP_STRING([--disable-pmull], [disable ARMv8 PMULL instructions]))
+AS_IF([test "x$enable_pmull" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_PMULL], [1], [disable ARMv8 PMULL instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_PMULL"
+])
+
+AC_ARG_ENABLE([aes],
+   AS_HELP_STRING([--disable-aes], [disable ARMv8 AES instructions]))
+AS_IF([test "x$enable_aes" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_AES], [1], [disable ARMv8 AES instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AES"
+])
+
+AC_ARG_ENABLE([sha1],
+   AS_HELP_STRING([--disable-sha1], [disable ARMv8 SHA1 instructions]))
+AS_IF([test "x$enable_sha1" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SHA1], [1], [disable ARMv8 SHA1 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHA1"
+])
+
+AC_ARG_ENABLE([sha256],
+   AS_HELP_STRING([--disable-sha256], [disable ARMv8 SHA256 instructions]))
+AS_IF([test "x$enable_sha256" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SHA256], [1], [disable ARMv8 SHA256 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHA256"
+])
+
+AC_ARG_ENABLE([sha512],
+   AS_HELP_STRING([--disable-sha512], [disable ARMv8 SHA512 instructions]))
+AS_IF([test "x$enable_sha512" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SHA512], [1], [disable ARMv8 SHA512 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHA512"
+])
+
+AC_ARG_ENABLE([sha3],
+   AS_HELP_STRING([--disable-sha3], [disable ARMv8 SHA3 instructions]))
+AS_IF([test "x$enable_sha3" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SHA3], [1], [disable ARMv8 SHA3 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHA3"
+])
+
+AC_ARG_ENABLE([sm3],
+   AS_HELP_STRING([--disable-sm3], [disable ARMv8 SM3 instructions]))
+AS_IF([test "x$enable_sm3" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SM3], [1], [disable ARMv8 SM3 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SM3"
+])
+
+AC_ARG_ENABLE([sm4],
+   AS_HELP_STRING([--disable-sm4], [disable ARMv8 SM4 instructions]))
+AS_IF([test "x$enable_sm4" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SM4], [1], [disable ARMv8 SM4 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SM4"
+])
+
+# PPC defines
+AC_ARG_ENABLE([altivec],
+   AS_HELP_STRING([--disable-altivec], [disable PPC Altivec instructions]))
+AS_IF([test "x$enable_altivec" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_ALTIVEC], [1], [disable PPC Altivec instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ALTIVEC"
+])
+
+AC_ARG_ENABLE([aes],
+   AS_HELP_STRING([--disable-aes], [disable PPC AES instructions]))
+AS_IF([test "x$enable_aes" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_AES], [1], [disable PPC AES instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AES"
+])
+
+AC_ARG_ENABLE([vmull],
+   AS_HELP_STRING([--disable-vmull], [disable PPC VMULL instructions]))
+AS_IF([test "x$enable_vmull" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_VMULL], [1], [disable PPC VMULL instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_VMULL"
+])
+
+AC_ARG_ENABLE([sha256],
+   AS_HELP_STRING([--disable-sha256], [disable PPC SHA256 instructions]))
+AS_IF([test "x$enable_sha256" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SHA256], [1], [disable PPC SHA256 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHA256"
+])
+
+AC_ARG_ENABLE([sha512],
+   AS_HELP_STRING([--disable-sha512], [disable PPC SHA512 instructions]))
+AS_IF([test "x$enable_sha512" = "xno"], [
+   AC_DEFINE([CRYPTOPP_DISABLE_SHA512], [1], [disable PPC SHA512 instructions])
+   AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHA512"
+])
+
+#############################################################################
+##   PART 4   PART 4   PART 4   PART 4   PART 4   PART 4   PART 4   PART 4
+## ==========================================================================
+## CPU feature tests, like SSE, NEON, ARMv8, PowerPC
+#############################################################################
+
+#############################################################################
+## Die early on Android
+
+if test "$IS_ANDROID_OS" != "0"; then
+
+   AC_MSG_CHECKING([if ANDROID_NDK_ROOT is set])
+   if test x"$ANDROID_NDK_ROOT" != "x"; then
+      AC_MSG_RESULT([yes])
+   else
+      AC_MSG_RESULT([no])
+      AC_MSG_ERROR([ANDROID_NDK_ROOT is not set. Please set ANDROID_NDK_ROOT])
+   fi
+fi
+
+#############################################################################
+## Doxygen documentation
+## This only provides a 'make html-doc' recipe in the Makefile.
+## If Doxygen is available the user still must issue the command.
+
+AC_CHECK_PROGS([DOXYGEN], [doxygen])
+if test x"$DOXYGEN" = "x"; then
+   AM_CONDITIONAL([CRYPTOPP_DOXYGEN_AVAILABLE], [false])
+else
+   AM_CONDITIONAL([CRYPTOPP_DOXYGEN_AVAILABLE], [true])
+fi
+
+#############################################################################
+## Shared and static libraries
+
+if true; then
+
+   ## Cant use AC_ENABLE_STATIC and AC_ENABLE_SHARED. AIX Autotools is too old.
+   AC_MSG_RESULT([checking if static libraries should be enabled... yes])
+
+   ## http://stackoverflow.com/a/21455267/608639
+   case $host_os in
+      msys* | mingw* | cygwin* )
+         AC_MSG_RESULT([checking if shared libraries should be enabled... no])
+         enable_shared=no; enable_static=yes;
+         ;;
+      *)
+         AC_MSG_RESULT([checking if shared libraries should be enabled... yes])
+         enable_shared=yes; enable_static=yes;
+         ;;
+   esac
+fi
+
+#############################################################################
+## Pthread library
+
+if true; then
+
+   ## Add to both CXXFLAGS and LDFLAGS if supported.
+   ## https://stackoverflow.com/q/2127797/608639.
+
+   SAVED_CXXFLAGS="$CXXFLAGS"
+   SAVED_LDFLAGS="$LDFLAGS"
+
+   CXXFLAGS="-pthread"
+   LDFLAGS="-pthread"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   LDFLAGS="$SAVED_LDFLAGS"
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Init priorities
+
+## The tests below should be in two separate source file violating
+## init order. One object file should perform the Foo or Bar static
+## init, and the second source would have a static object using
+## Foo::s_x or Bar::s_x. The problem is, we don't know how to do it.
+## Also see https://stackoverflow.com/q/51662985/608639.
+
+## We can only run one Init Priority test. Otherwise, running both tests
+## cause 'CRYPTOPP_INIT_PRIORITY 250' and 'CRYPTOPP_INIT_PRIORITY 0' to be
+## written, which results in "warning: CRYPTOPP_INIT_PRIORITY redefined".
+## And of course, Autools does not allow us to undefine a macro.
+
+## GCC-style
+if true; then
+
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   ## -Wall -Werror are GCC and friends specific. The problem is,
+   ## Autotools lacks a cross-platform AC_TREAT_WARNINGS_AS_ERRORS.
+   if test "$IS_MSC_COMPILER" = "0"; then
+      THIS_CXXFLAGS="-Wall -Werror"
+   fi
+
+   CXXFLAGS="$THIS_CXXFLAGS"
+   XXX_PROGRAM="#include <string>
+      struct Foo {
+         Foo(int x) : m_x(x) {}
+         Foo(const Foo& o) : m_x(o.m_x) {}
+         Foo& operator=(const Foo& o) {m_x=o.m_x; return *this;}
+         static int s_x;
+         int m_x;
+      };
+      int Foo::s_x = -1;
+      static Foo unused __attribute__ ((init_priority (250))) = Foo::s_x;
+      // This should be in a separate source file violating init order.
+      // The separate file should have a main() and be linked first.
+      // static Foo f = Foo::s_x;
+      // bool success = f.m_x == -1;"
+
+   AC_MSG_CHECKING([if $CXXNAME supports init_priority])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([$XXX_PROGRAM])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([HAVE_GCC_INIT_PRIORITY], [1])
+      AC_DEFINE([CRYPTOPP_INIT_PRIORITY], [250], [Enable init_priority])
+   else
+      AC_DEFINE([CRYPTOPP_INIT_PRIORITY], [0], [Disable init_priority])
+   fi
+
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+## MSC-style
+if false; then
+
+   ## The problem is, Autotools lacks a cross-platform
+   ## AC_TREAT_WARNINGS_AS_ERRORS. Clang, GCC, and friends will see
+   ## "pragma init_seg" and issue an an unknown pragma warning.
+   ## Adding -Wall or -Werror will cause MSC and friends to fail on
+   ## the illegal flag.
+   if test "$IS_MSC_COMPILER" = "1"; then
+      THIS_CXXFLAGS="/WX"
+   else
+      THIS_CXXFLAGS="-Wall -Werror"
+   fi
+
+   CXXFLAGS="$THIS_CXXFLAGS"
+   XXX_PROGRAM="#include <string>
+      struct Bar {
+         Bar(int x) : m_x(x) {}
+         Bar(const Bar& o) : m_x(o.m_x) {}
+         Bar& operator=(const Bar& o) {m_x=o.m_x; return *this;}
+         static int s_x;
+         int m_x;
+      };
+      #pragma init_seg(".CRT$XCU")
+      int Bar::s_x = -1;
+      static Bar unused __attribute__ ((init_priority (250))) = Bar::s_x;
+      // This should be in a separate source file violating init order.
+      // The separate file should have a main() and be linked first.
+      // static Bar b = Bar::s_x;
+      // bool success = b.m_x == -1;"
+
+   AC_MSG_CHECKING([if $CXXNAME supports init_seg])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([$XXX_PROGRAM])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([HAVE_MSC_INIT_PRIORITY], [1])
+      AC_DEFINE([CRYPTOPP_INIT_PRIORITY], [250], [Enable init_seg])
+   else
+      AC_DEFINE([CRYPTOPP_INIT_PRIORITY], [0], [Disable init_seg])
+   fi
+
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Solaris, SunCC and missing optimizations
+
+OPT_ANY=`echo $CXXFLAGS | $EGREP -c '\-O0|\-O1|\-O2|\-O3|\-O4|\-O5|\-xO0|\-xO1|\-xO2|\-xO3|\-xO4|\-xO5|\-Os|\-Og|\-Ofast'`
+
+if test "$OPT_ANY" = "0"; then
+
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-O2"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   else
+
+      # SunCC
+      CXXFLAGS="-xO2"
+      AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+      fi
+   fi
+
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Fix AR on iOS and OS X
+
+## AR and ARFLAGS usage is currently broke under Autotools. Also see
+## http://lists.gnu.org/archive/html/bug-autoconf/2017-11/msg00002.html
+
+#if test "$IS_APPLE_OS" != "0"; then
+#   AC_SUBST([AR], ["/usr/bin/libtool"])
+#   AC_SUBST([ARFLAGS], ["-static -o"])
+#   AC_SUBST([ac_ct_AR], ["/usr/bin/libtool"])
+#fi
+
+#############################################################################
+## Dead code stripping for compilers. Linkers are towards the end of script.
+## We have to use XXX_LINK_IFELSE because some compilers don't reject
+## -fdata-sections or -ffunction-sections like they should.
+
+if true; then
+
+   ## Save FLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-fdata-sections"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   CXXFLAGS="-ffunction-sections"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   ## Restore FLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Solaris, GCC and -Wa,--divide
+
+if test "$IS_SUN_OS" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-Wa,--divide"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Solaris, SunCC compiler options
+
+if test "$IS_SUN_OS" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-template=no%extdef"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   # https://docs.oracle.com/cd/E18659_01/html/821-1383/bkamt.html
+   CXXFLAGS="-xregs=no%appl"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## AIX and -qpic=large or -bbigtoc
+
+if test "$IS_AIX" != "0"; then
+
+   ## Save LDFLAGS
+   SAVED_LDFLAGS="$LDFLAGS"
+
+   # https://www.ibm.com/developerworks/rational/library/overview-toc-aix/index.html
+   LDFLAGS="-bbigtoc"
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   ## Restore LDFLAGS
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## MacPorts GCC using Clang integrated assembler
+
+## Modern GCC must use Clang as the assembler. The old Apple
+## assembler cannot handle much more than SSE4 or so. We need
+## to use -Wa,-q in subsequent tests, if available.
+
+if test "$IS_APPLE_OS" != "0"; then
+if test "$IS_GCC_COMPILER" != "0" && test "$IS_PORTS_COMPILER" != "0"; then
+
+   HAVE_OPT=`echo $CXXFLAGS | $EGREP -i -c '\-Wa,-q'`
+   if test "$HAVE_OPT" = "0"; then
+
+      ## Save CXXFLAGS
+      SAVED_CXXFLAGS="$CXXFLAGS"
+
+      CXXFLAGS="-Wa,-q"
+      AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      # We can add -Wa,-q to all files, if needed
+      if test "$retval" = "0"; then
+         # AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+         WAQ_FLAG="-Wa,-q"
+      fi
+
+      ## Restore CXXFLAGS
+      CXXFLAGS="$SAVED_CXXFLAGS"
+   fi
+fi
+fi
+
+#############################################################################
+## Clang integrated assembler and SunCC.
+
+## Also see https://bugs.llvm.org/show_bug.cgi?id=39895.
+if test "$IS_IA32" = "1" && test "x$enable_asm" != "xno"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-msse2 $WAQ_FLAG"
+   AC_MSG_CHECKING([if $CXXNAME supports mixed ASM])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_asm_mixed.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" != "0"; then
+      AC_DEFINE([CRYPTOPP_DISABLE_MIXED_ASM], [1], [Disable mixed asm])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_MIXED_ASM"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## IA-32, i386, i586, i686, x86_64, etc.
+
+## This block handles GCC and friends, including -Wa,-q if needed.
+## i86pc and SunCC is handled after this block.
+if test "$IS_IA32" = "1" && test "$IS_GNUC_COMPILER" = "1"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   ##### SSE2 #####
+
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-msse2 $WAQ_FLAG"
+   else
+      CXXFLAGS="-msse2"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse2.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SSE2_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHACHA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_DONNA_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_SSE2_AVAILABLE], [1], [Enable SSE2])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ASM], [1], [Disable SSE2])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ASM"
+   fi
+
+   ##### SSE3 #####
+
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-msse3 $WAQ_FLAG"
+   else
+      CXXFLAGS="-msse3"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse3.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_DEFINE([CRYPTOPP_SSE3_AVAILABLE], [1], [Enable SSE3])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSE3], [1], [Disable SSE3])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE3"
+   fi
+
+   ##### SSSE3 #####
+
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-mssse3 $WAQ_FLAG"
+   else
+      CXXFLAGS="-mssse3"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_ssse3.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SSSE3_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_ARIA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHAM_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_KECCAK_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_LEA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SIMON128_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SPECK128_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_SSSE3_AVAILABLE], [1], [Enable SSSE3])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSSE3], [1], [Disable SSSE3])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSSE3"
+   fi
+
+   ##### SSE4.1 #####
+
+   ## Old BSD linkers don't support SSE4 or above.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-msse4.1 $WAQ_FLAG"
+   else
+      CXXFLAGS="-msse4.1"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse41.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SSE41_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2S_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2B_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_SSE41_AVAILABLE], [1], [Enable SSE4.1])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSE4], [1], [Disable SSE4.1])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE4"
+   fi
+
+   ##### SSE4.2 #####
+
+   ## Old BSD linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-msse4.2 $WAQ_FLAG"
+   else
+      CXXFLAGS="-msse4.2"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse42.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SSE42_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CRC_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_SSE42_AVAILABLE], [1], [Enable SSE4.2])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSE4], [1], [Disable SSE4.2])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE4"
+   fi
+
+   ##### PCLMUL #####
+
+   ## Some old compilers, assemblers and linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-mpclmul $WAQ_FLAG"
+   else
+      CXXFLAGS="-mpclmul"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_clmul.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   # if -mpclmul fails then it is disabled in the next test
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_GF2N_FLAG], [$CXXFLAGS])
+   fi
+
+   ## Some old compilers, assemblers and linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-mssse3 -mpclmul $WAQ_FLAG"
+   else
+      CXXFLAGS="-mssse3 -mpclmul"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_clmul.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_GCM_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_CLMUL_AVAILABLE], [1], [Enable CLMUL])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_CLMUL], [1], [Disable CLMUL])
+   fi
+
+   ##### SSSE3+AES #####
+
+   ## Some old compilers, assemblers and linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-mssse3 -maes $WAQ_FLAG"
+   else
+      CXXFLAGS="-mssse3 -maes"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_aes.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   # if -maes fails then it is disabled in the next test
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SM4_FLAG], [$CXXFLAGS])
+   fi
+
+   ##### SSE4.1+AES #####
+
+   ## Some old compilers, assemblers and linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-msse4.1 -maes $WAQ_FLAG"
+   else
+      CXXFLAGS="-msse4.1 -maes"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_aes.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_AES_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_AESNI_AVAILABLE], [1], [Enable AESNI])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_AESNI], [1], [Disable AESNI])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AESNI"
+   fi
+
+   ##### AVX #####
+
+   ## Some old compilers, assemblers and linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-mavx $WAQ_FLAG"
+   else
+      CXXFLAGS="-mavx"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_avx.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_CHACHA_AVX_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_AVX_AVAILABLE], [1], [Enable AVX])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_AVX], [1], [Disable AVX])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AVX"
+   fi
+
+   ##### AVX2 #####
+
+   ## Some old compilers, assemblers and linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-mavx2 $WAQ_FLAG"
+   else
+      CXXFLAGS="-mavx2"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_avx2.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_CHACHA_AVX2_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_AVX2_AVAILABLE], [1], [Enable AVX2])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_AVX2], [1], [Disable AVX2])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AVX2"
+   fi
+
+   ##### SHA #####
+
+   ## Some old compilers, assemblers and linkers don't support it.
+   if test x"$WAQ_FLAG" != "x"; then
+      CXXFLAGS="-msse4.2 -msha $WAQ_FLAG"
+   else
+      CXXFLAGS="-msse4.2 -msha"
+   fi
+
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sha.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_SHANI_AVAILABLE], [1], [Enable SHANI])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SHANI], [1], [Disable SHANI])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHANI"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+## This block handles i86pc and SunCC. GCC and friends were handled before this block
+if test "$IS_IA32" != "0" && test "$IS_SUN_COMPILER" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   ##### SSE2 #####
+
+   CXXFLAGS="-xarch=sse2"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse2.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   ## GCM AES and SHA should be overwritten with CLMUL, AES and SHA if available.
+   ## If not available then need -xarch=sse2 due to SSE2, GCM_Xor16_SSE2, etc.
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__SSE2__=1"
+      AC_SUBST([CRYPTOPP_SSE2_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_CHACHA_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_GCM_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_AES_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_SSE2_AVAILABLE], [1], [Enable SSE2])
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ASM], [1], [Disable SSE2])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ASM"
+   fi
+
+   ##### SSE3 #####
+
+   ## Nothing pivots around SSE3 specifically, but we do use
+   ## insns from the ISA. Sun requires it as a linker flag.
+   CXXFLAGS="-xarch=sse3"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse3.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__SSE3__=1"
+      AC_DEFINE([CRYPTOPP_SSE3_AVAILABLE], [1], [Enable SSE3])
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSE3], [1], [Disable SSE3])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE3"
+   fi
+
+   ##### SSSE3 #####
+
+   CXXFLAGS="-xarch=ssse3"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_ssse3.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__SSSE3__=1"
+      AC_SUBST([CRYPTOPP_SSSE3_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_ARIA_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_CHACHA_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_CHAM_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_KECCAK_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_LEA_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_SIMON128_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_SPECK128_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_SSSE3_AVAILABLE], [1], [Enable SSSE3])
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSSE3], [1], [Disable SSSE3])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSSE3"
+   fi
+
+   ##### SSE4.1 #####
+
+   CXXFLAGS="-xarch=sse4_1"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse41.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__SSE4_1__=1"
+      AC_SUBST([CRYPTOPP_SSE41_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_SSE41_AVAILABLE], [1], [Enable SSE4.1])
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSE4], [1], [Disable SSE4.1])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE4"
+   fi
+
+   ##### SSE4.2 #####
+
+   CXXFLAGS="-xarch=sse4_2"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sse42.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__SSE4_2__=1"
+      AC_SUBST([CRYPTOPP_SSE42_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_CRC_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_BLAKE2S_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_BLAKE2B_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_SSE42_AVAILABLE], [1], [Enable SSE4.2])
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SSE4], [1], [Disable SSE4.2])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SSE4"
+   fi
+
+   ##### CLMUL #####
+
+   CXXFLAGS="-xarch=aes"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_clmul.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__CLMUL__=1"
+      AC_SUBST([CRYPTOPP_GCM_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_GF2N_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_CLMUL_AVAILABLE], [1], "Enable CLMUL")
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_CLMUL], [1], "Disable CLMUL")
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_CLMUL"
+   fi
+
+   ##### AES #####
+
+   CXXFLAGS="-xarch=aes"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_aes.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__AES__=1"
+      AC_SUBST([CRYPTOPP_AES_FLAG], [$CXXFLAGSX])
+      AC_SUBST([CRYPTOPP_SM4_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_AESNI_AVAILABLE], [1], "Enable AESNI")
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_AESNI], [1], "Disable AESNI")
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AESNI"
+   fi
+
+   ##### AVX #####
+
+   CXXFLAGS="-xarch=avx"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_avx.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__AVX__=1"
+      AC_DEFINE([CRYPTOPP_AVX_AVAILABLE], [1], [Enable AVX])
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_AVX], [1], [Disable AVX])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AVX"
+   fi
+
+   ##### AVX2 #####
+
+   CXXFLAGS="-xarch=avx2"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_avx2.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__AVX2__=1"
+      AC_SUBST([CRYPTOPP_CHACHA_AVX2_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_AVX2_AVAILABLE], [1], [Enable AVX2])
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_AVX2], [1], [Disable AVX2])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_AVX2"
+   fi
+
+   ##### RDRAND #####
+
+   ## https://docs.oracle.com/cd/E77782_01/html/E77792/gqexw.html
+   CXXFLAGS="-xarch=avx_i"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_rdrand.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   ## It is not clear if we can avoid the linker option for Solaris
+   ## Also see https://stackoverflow.com/q/51678753/608639
+   #if test "$retval" = "0"; then
+   #   CXXFLAGSX="$CXXFLAGS -D__RDRND__=1"
+   #   AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   #fi
+
+   ##### RDSEED #####
+
+   ## https://docs.oracle.com/cd/E60778_01/html/E60745/bjapr.html
+   CXXFLAGS="-xarch=avx2_i"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_rdseed.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   ## It is not clear if we can avoid the linker option for Solaris
+   ## Also see https://stackoverflow.com/q/51678753/608639
+   #if test "$retval" = "0"; then
+   #   CXXFLAGSX="$CXXFLAGS -D__RDSEED__=1"
+   #   AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   #fi
+
+   ##### SHA #####
+
+   ##CXXFLAGS="-xarch=avx2_i"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_x86_sha.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      CXXFLAGSX="$CXXFLAGS -D__SHA__=1"
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$CXXFLAGSX])
+      AC_DEFINE([CRYPTOPP_SHA_AVAILABLE], [1], "Enable SHANI")
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_SHANI], [1], "Disable SHANI")
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_SHANI"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## ARM A-32, including NEON, soft floats and hard floats
+
+if test "$IS_ARM32" != "0" || test "$IS_ARMV8" != "0"; then
+
+   # https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
+
+   AC_CHECK_HEADERS(arm_neon.h,
+      [AC_DEFINE([CRYPTOPP_ARM_NEON_HEADER], [1], [arm_neon.h is available])],
+      [AC_DEFINE([CRYPTOPP_ARM_NEON_HEADER], [0], [arm_neon.h is not available])]
+   )
+fi
+
+if test "$IS_ARM32" != "0" && test "$IS_ANDROID_OS" = "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-march=armv7-a"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_cxx.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   CXXFLAGS="-march=armv7-a -mfpu=neon"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_neon.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_AES_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_ARIA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2S_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2B_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHACHA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHAM_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CRC_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_GCM_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_LEA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_NEON_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SM4_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SIMON128_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SPECK64_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SPECK128_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_NEON_AVAILABLE], [1], [Enable NEON])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ASM], [1], [Disbale NEON])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ASM"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Android and -mfloat-abi=softfp
+
+if test "$IS_ARM32" != "0" && test "$IS_ANDROID_OS" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_neon.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_AES_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_ARIA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2S_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2B_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHACHA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHAM_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CRC_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_GCM_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_LEA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_NEON_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SM4_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SIMON128_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SPECK128_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_NEON_AVAILABLE], [1], [Enable NEON])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ASM], [1], [Disbale NEON])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ASM"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+
+fi
+
+#############################################################################
+## ARM A-32 and aes_armv4.S
+
+# Used by Makefile.am to compile aes_armv4.S and sha1_armv4.S.
+# Only valid on Linux because ASM is written for GNU AS (GAS).
+if test "$IS_ARM32" != "0" && test "$IS_LINUX_OS" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-march=armv7-a -Wa,--noexecstack"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_cxx.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CONDITIONAL([CRYPTOGAMS_ARM_SOURCES], [true])
+      AC_SUBST([CRYPTOPGAMS_ARMV4_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPGAMS_ARMV4_THUMB_FLAG], [$CXXFLAGS])
+   fi
+
+   # For Clang, aes_armv4.S needs -mthumb
+   if test "$IS_LLVM_COMPILER" != "0"; then
+
+      CXXFLAGS="-march=armv7-a -mthumb -Wa,--noexecstack"
+      AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([`cat TestPrograms/test_cxx.cxx`])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AC_SUBST([CRYPTOPGAMS_ARMV4_THUMB_FLAG], [$CXXFLAGS])
+      fi
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+else
+   # Required for other platforms
+   AM_CONDITIONAL([CRYPTOGAMS_ARM_SOURCES], [false])
+fi
+
+#############################################################################
+## ARM Aarch32 and Aarch64
+
+if test "$IS_ARMV8" != "0"; then
+
+   # https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
+
+   AC_CHECK_HEADERS(arm_acle.h,
+      [AC_DEFINE([CRYPTOPP_ARM_ACLE_HEADER], [1], [arm_acle.h is available])],
+      [AC_DEFINE([CRYPTOPP_ARM_ACLE_HEADER], [0], [arm_acle.h is not available])]
+   )
+
+fi
+
+if test "$IS_ARMV8" != "0"; then
+
+   # https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-march=armv8-a"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_asimd.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_ARIA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHACHA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_CHAM_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2S_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_BLAKE2B_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_LEA_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_NEON_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SIMON128_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_SPECK128_FLAG], [$CXXFLAGS])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ASM], [1], [Enable NEON])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ASM"
+   fi
+
+   CXXFLAGS="-mfix-cortex-a53-835769"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_cxx.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   CXXFLAGS="-mfix-cortex-a53-843419"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_cxx.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $CXXFLAGS"
+   fi
+
+   CXXFLAGS="-march=armv8-a+crc"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_crc.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_CRC_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_CRC32_AVAILABLE], [1], [Enable ARMv8 CRC32])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_CRC32], [1], [Disable ARMv8 CRC32])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_CRC32"
+   fi
+
+   CXXFLAGS="-march=armv8-a+crypto"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (AES)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_aes.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_AES_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_AES_AVAILABLE], [1], [Enable ARMv8 AES])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ARM_AES], [1], [Disable ARMv8 AES])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_AES"
+   fi
+
+   CXXFLAGS="-march=armv8-a+crypto"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (PMULL)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_pmull.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_GCM_FLAG], [$CXXFLAGS])
+      AC_SUBST([CRYPTOPP_GF2N_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_PMULL_AVAILABLE], [1], [Enable ARMv8 PMULL])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ARM_PMULL], [1], [Disable ARMv8 PMULL])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_PMULL"
+   fi
+
+   CXXFLAGS="-march=armv8-a+crypto"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (SHA1)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_sha1.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_SHA1_AVAILABLE], [1], [Enable ARMv8 SHA1])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ARM_SHA], [1], [Disable ARMv8 SHA1])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_SHA"
+   fi
+
+   CXXFLAGS="-march=armv8-a+crypto"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (SHA256)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_sha256.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_SHA256_AVAILABLE], [256], [Enable ARMv8 SHA256])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ARM_SHA], [256], [Disable ARMv8 SHA256])
+      AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_SHA"
+   fi
+
+   CXXFLAGS="-march=armv8.3-a+sha3"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (SHA512)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_sha3.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SHA512_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_SHA512_AVAILABLE], [1], [Enable ARMv8 SHA512])
+   #else
+      #AC_DEFINE([CRYPTOPP_DISABLE_ARM_SHA512], [1], [Disable ARMv8 SHA512])
+      #AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_SHA512"
+   fi
+
+   CXXFLAGS="-march=armv8.3-a+sha3"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (SHA3)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_sha3.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SHA3_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_SHA3_AVAILABLE], [1], [Enable ARMv8 SHA3])
+   #else
+      #AC_DEFINE([CRYPTOPP_DISABLE_ARM_SHA3], [1], [Disable ARMv8 SHA3])
+      #AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_SHA3"
+   fi
+
+   CXXFLAGS="-march=armv8.3-a+sm4"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (SM3)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_sm3.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SM3_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_SM3_AVAILABLE], [1], [Enable ARMv8 SM3])
+   #else
+      #AC_DEFINE([CRYPTOPP_DISABLE_ARM_SM3], [1], [Disable ARMv8 SM3])
+      #AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_SM3"
+   fi
+
+   CXXFLAGS="-march=armv8.3-a+sm4"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS (SM4)])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_arm_sm4.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_SM4_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_SM4_AVAILABLE], [1], [Enable ARMv8 SM4])
+   #else
+      #AC_DEFINE([CRYPTOPP_DISABLE_ARM_SM4], [1], [Disable ARMv8 SM4])
+      #AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_SM4"
+   fi
+
+   CXXFLAGS="-march=armv8.3-a+rng"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_SUBST([CRYPTOPP_ARM_RNG_FLAG], [$CXXFLAGS])
+      AC_DEFINE([CRYPTOPP_ARM_RNG_AVAILABLE], [1], [Enable ARMv8 RNG])
+   #else
+      #AC_DEFINE([CRYPTOPP_DISABLE_ARM_RNG], [1], [Disable ARMv8 RNG])
+      #AM_CXXFLAGS="$AM_CXXFLAGS -DCRYPTOPP_DISABLE_ARM_RNG"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## IBC XL C/C++ compiler, applies to IA-32 and PPC
+
+if test "$IS_XLC_COMPILER" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   ## -qrtti must be present for some xlC compilers
+   HAS_RTTI=`echo $CPPFLAGS $CXXFLAGS | $EGREP -i -c '\-qrtti'`
+   if test "$HAS_RTTI" = "0"; then
+
+      CXXFLAGS="-qrtti"
+      AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+      fi
+   fi
+
+   ## -qpic must be present for some xlC compilers
+   HAS_PIC=`echo $CPPFLAGS $CXXFLAGS | $GREP -i -c '\-qpic'`
+   if test "$HAS_PIC" = "0"; then
+
+      CXXFLAGS="-qpic"
+      AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+      fi
+   fi
+
+   # Promotes optimizations
+   CXXFLAGS="-qmaxmem=-1"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   # Promotes optimizations
+   CXXFLAGS="-qthreaded"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   if test "$IS_DEBUG" != "0"; then
+
+      # Finds alias violations
+      CXXFLAGS="-qalias=noansi"
+      AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+      fi
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+# More stupid LLVM games. Clang pretending to be three different compilers.
+# https://lists.tetaneutral.net/pipermail/cfarm-users/2018-July/000331.html
+
+if test "$IS_XLC_COMPILER" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-qxlcompatmacros"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+
+fi
+
+#############################################################################
+## PowerPC and PowerPC-64
+
+if test "$IS_PPC" != "0"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   # XLC requires -qaltivec in addition to Arch or CPU option
+   if test "$IS_XLC_COMPILER" = "1"; then
+      ALTIVEC_FLAG="-qarch=auto -qaltivec"
+      POWER7_VSX_FLAG="-qarch=pwr7 -qvsx -qaltivec"
+      POWER7_PWR_FLAG="-qarch=pwr7 -qaltivec"
+      POWER8_FLAG="-qarch=pwr8 -qaltivec"
+      POWER9_FLAG="-qarch=pwr9 -qaltivec"
+   else
+      ALTIVEC_FLAG="-maltivec"
+      POWER7_VSX_FLAG="-mcpu=power7 -mvsx"
+      POWER7_PWR_FLAG="-mcpu=power7"
+      POWER8_FLAG="-mcpu=power8"
+      POWER9_FLAG="-mcpu=power9"
+   fi
+
+   ##### Altivec #####
+
+   CXXFLAGS="$ALTIVEC_FLAG"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_ppc_altivec.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   # Assume success, unset on failure
+   if test "$retval" != "0"; then
+       AC_SUBST([ALTIVEC_FLAG],[""])
+   fi
+
+   ##### POWER7 #####
+
+   CXXFLAGS="$POWER7_VSX_FLAG"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_ppc_power7.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   # Figure out what is needed for POWER7
+   if test "$retval" = "0"; then
+     AC_SUBST([POWER7_FLAG],[$POWER7_VSX_FLAG])
+   else
+     CXXFLAGS="$POWER7_PWR_FLAG"
+     AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+     XXX_LINK_IFELSE(
+        [AC_LANG_SOURCE([`cat TestPrograms/test_ppc_power7.cxx`])],
+        [AC_MSG_RESULT([yes])],
+        [AC_MSG_RESULT([no])]
+     )
+
+     if test "$retval" = "0"; then
+       AC_SUBST([POWER7_FLAG],[$POWER7_PWR_FLAG])
+     else
+       AC_SUBST([POWER7_FLAG],[""])
+     fi  # POWER7_PWR_FLAG
+   fi  # POWER7_VSX_FLAG
+
+   ##### POWER8 #####
+
+   CXXFLAGS="$POWER8_FLAG"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_ppc_power8.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" != "0"; then
+       AC_SUBST([POWER8_FLAG],[""])
+   fi
+
+   ##### POWER9 #####
+
+   CXXFLAGS="$POWER9_FLAG"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_ppc_power9.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" != "0"; then
+       AC_SUBST([POWER9_FLAG],[""])
+   fi
+
+   # POWER9 and DARN random number generator. Disabled due to
+   # https://github.com/weidai11/cryptopp/issues/986
+   #if test x"$POWER9_FLAG" != "x"; then
+   #   AC_SUBST([CRYPTOPP_POWER9_FLAG], [$POWER9_FLAG])
+   #   AC_SUBST([CRYPTOPP_DARN_FLAG], [$POWER9_FLAG])
+   #else
+   #   AC_DEFINE([CRYPTOPP_DISABLE_POWER9], [1], [Disable POWER9])
+   #fi
+
+   ##### Fixups #####
+
+   ## POWER8 and in-core crypto.
+   if test x"$POWER8_FLAG" != "x"; then
+      AC_SUBST([CRYPTOPP_POWER8_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_BLAKE2B_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_CRC_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_AES_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_GCM_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_GF2N_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_SHA_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_SIMON128_FLAG], [$POWER8_FLAG])
+      AC_SUBST([CRYPTOPP_SPECK128_FLAG], [$POWER8_FLAG])
+      AC_DEFINE([CRYPTOPP_POWER8_CRC_AVAILABLE], [1], [Enable POWER8 CRC])
+      AC_DEFINE([CRYPTOPP_POWER8_AES_AVAILABLE], [1], [Enable POWER8 AES])
+      AC_DEFINE([CRYPTOPP_POWER8_PMULL_AVAILABLE], [1], [Enable POWER8 PMULL])
+      AC_DEFINE([CRYPTOPP_POWER8_SHA_AVAILABLE], [1], [Enable POWER8 SHA])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_POWER8], [1], [Disable POWER8])
+   fi
+
+   # POWER7 and VSX
+   if test x"$POWER7_FLAG" != "x"; then
+      AC_SUBST([CRYPTOPP_POWER7_FLAG], [$POWER7_FLAG])
+      AC_DEFINE([CRYPTOPP_POWER7_AVAILABLE], [1], [Enable POWER7])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_POWER7], [1], [Disable POWER7])
+   fi
+
+   # Plain old Altivec
+   if test x"$ALTIVEC_FLAG" != "x"; then
+      AC_SUBST([CRYPTOPP_ALTIVEC_FLAG], [$ALTIVEC_FLAG])
+      AC_SUBST([CRYPTOPP_BLAKE2S_FLAG], [$ALTIVEC_FLAG])
+      AC_SUBST([CRYPTOPP_CHACHA_FLAG], [$ALTIVEC_FLAG])
+      AC_DEFINE([CRYPTOPP_ALTIVEC_AVAILABLE], [1], [Enable Altivec])
+   else
+      AC_DEFINE([CRYPTOPP_DISABLE_ALTIVEC], [1], [Disable Altivec])
+   fi
+
+   # Drop to Altivec if higher Power is not available
+   if test x"$ALTIVEC_FLAG" != "x"; then
+      if test x"$CRYPTOPP_GCM_FLAG" = "x"; then
+         AC_SUBST([CRYPTOPP_GCM_FLAG], [$ALTIVEC_FLAG])
+      fi
+   fi
+
+   # Now set a disable flag
+   if test x"$ALTIVEC_FLAG" = "x"; then
+      AM_CXXFLAGS="-DCRYPTOPP_DISABLE_ALTIVEC $AM_CXXFLAGS"
+   elif test x"$POWER7_FLAG" = "x"; then
+      AM_CXXFLAGS="-DCRYPTOPP_DISABLE_POWER7 $AM_CXXFLAGS"
+   elif test x"$POWER8_FLAG" = "x"; then
+      AM_CXXFLAGS="-DCRYPTOPP_DISABLE_POWER8 $AM_CXXFLAGS"
+   elif test x"$POWER9_FLAG" = "x"; then
+      AM_CXXFLAGS="-DCRYPTOPP_DISABLE_POWER9 $AM_CXXFLAGS"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+##   PART 5   PART 5   PART 5   PART 5   PART 5   PART 5   PART 5   PART 5
+## ==========================================================================
+## C++ feature tests, like C++11, alignof and alignas
+#############################################################################
+
+#############################################################################
+## Newlib and _XOPEN_SOURCE
+
+if true; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   ## This test may need to be changed if the Newlib folks provide directions.
+   ## Also see http://www.sourceware.org/ml/newlib/2017/msg01095.html.
+
+   AC_MSG_CHECKING([whether runtime library is Newlib])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_newlib.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+
+      CXXFLAGS="-D_XOPEN_SOURCE=600"
+      AC_MSG_CHECKING([if runtime library supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AC_DEFINE([_XOPEN_SOURCE], [600], [Enable _XOPEN_SOURCE])
+         AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+      fi
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## libstdc++ and _GLIBCXX_DEBUG
+if test "$IS_DEBUG" = "1"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   AC_MSG_CHECKING([whether runtime library is libstdc++])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_glibc.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+
+      CXXFLAGS="-D_GLIBCXX_DEBUG"
+      AC_MSG_CHECKING([if runtime library supports $CXXFLAGS])
+      XXX_COMPILE_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+      fi
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Now test C++ features
+
+#AH_HEADER=
+#AC_CONFIG_COMMANDS_PRE(
+#   [m4_ifndef([AH_HEADER], [AC_CONFIG_HEADERS([config_cxx.h])])
+#])
+
+#############################################################################
+
+if true; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   AC_MSG_CHECKING([whether runtime library is C++11])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_cxx11.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_DEFINE([CRYPTOPP_CXX11], [1], [C++11 is available])
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+if true; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   AC_MSG_CHECKING([whether runtime library is C++17])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([`cat TestPrograms/test_cxx17.cxx`])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AC_DEFINE([CRYPTOPP_CXX17], [1], [C++17 is available])
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+##   PART 6   PART 6   PART 6   PART 6   PART 6   PART 6   PART 6   PART 6
+## ==========================================================================
+## Misc feature and options
+#############################################################################
+
+#############################################################################
+## Add -pipe for non-IoT gadgets to speedup compiles. We use 2GB RAM as
+## threshold. Anything with less than 2GB will not use -pipe.
+
+# Unix, Linux and family
+MEM_SIZE=`$GREP "MemTotal" /proc/meminfo 2>/dev/null | $AWK '{print int($2/1024/1024); exit;}'`
+
+# Darwin
+if test "$IS_APPLE_OS" != "0"; then
+   MEM_SIZE=`sysctl -a 2>&1 | $GREP "hw.memsize" 2>/dev/null | $AWK '{print int($3/1024/1024); exit;}'`
+fi
+
+# Solaris
+if test "$IS_SUN_OS" != "0"; then
+   MEM_SIZE=`prtconf 2>/dev/null | $GREP "Memory" | $AWK '{print int($3/1024); exit;}'`
+fi
+
+# AIX
+if test "$IS_AIX_OS" != "0"; then
+   MEM_SIZE=`prtconf -m 2>/dev/null | $GREP "MB" | $AWK '{print int($3/1024); exit;}'`
+fi
+
+if test "$MEM_SIZE" -ge "2"; then
+
+   ## Save CXXFLAGS
+   SAVED_CXXFLAGS="$CXXFLAGS"
+
+   CXXFLAGS="-pipe"
+   AC_MSG_CHECKING([if $CXXNAME supports $CXXFLAGS])
+   XXX_COMPILE_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
+   fi
+
+   ## Restore CXXFLAGS
+   CXXFLAGS="$SAVED_CXXFLAGS"
+fi
+
+#############################################################################
+## Dead code stripping for linkers. Compilers are towards the head of script.
+
+if true; then
+
+   ## Save FLAGS
+   SAVED_LDFLAGS="$LDFLAGS"
+
+   # OS X uses -Wl,-dead_strip
+   LDFLAGS="-Wl,-dead_strip"
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   # Linux uses --gc-sections
+   LDFLAGS="-Wl,--gc-sections"
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   # Solaris uses -z discard-unused
+   # https://docs.oracle.com/cd/E26502_01/html/E26507/glmth.html
+   LDFLAGS="-Wl,-z,discard-unused=sections"
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   # Solaris uses -z discard-unused
+   # https://docs.oracle.com/cd/E26502_01/html/E26507/glmth.html
+   LDFLAGS="-Wl,-z,discard-unused=dependencies"
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   ## Restore FLAGS
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## Solaris, map file and libraries
+
+if test "$IS_SUN_OS" != "0"; then
+
+   ## Save LDFLAGS
+   SAVED_LDFLAGS="$LDFLAGS"
+
+   ## IA-32 gets a Mapfile for capabilities. Due to libtool stripping
+   ## -M arguments, we need to escape it with -XCClinker in AM_LDFLAGS.
+   if test "$IS_IA32" != "0"; then
+      LDFLAGS="-Mcryptopp.mapfile"
+      AC_MSG_CHECKING([if $LDNAME supports -Mcryptopp.mapfile])
+      XXX_LINK_IFELSE(
+        [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AM_LDFLAGS="$AM_LDFLAGS -XCClinker -Mcryptopp.mapfile"
+      fi
+   fi
+
+   ## Restore LDFLAGS
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## Add --build-id to linker for debug symbols.
+## https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
+
+if true; then
+
+   SAVED_LDFLAGS="$LDFLAGS"
+   LDFLAGS="-Wl,--build-id"
+
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## Demangle output names if possible for friendlier err messages
+
+if true; then
+
+   SAVED_LDFLAGS="$LDFLAGS"
+   LDFLAGS="-Wl,--demangle"
+
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## MinGW libraries
+## Automake does not follow Make conventions and use AM_LDLIBS. Instead
+## it stuffs libraries in the flags which messes up pkg-config *.pc files.
+
+if test "$IS_MINGW_OS" = "1"; then
+
+   SAVED_LDFLAGS="$LDFLAGS"
+
+   LDFLAGS="-lws2_32"
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   ## Restore LDFLAGS
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## OpenMP libraries
+## Automake does not follow Make conventions and use AM_LDLIBS. Instead
+## it stuffs libraries in the flags which messes up pkg-config *.pc files.
+
+if true; then
+
+   COUNT1=`echo $CXXFLAGS | $EGREP -c '\-fopenmp'`
+   COUNT2=`echo $LDFLAGS | $EGREP -c '\-lgomp'`
+   if test "$COUNT1" != "0" && test "$COUNT2" = "0"; then
+
+      SAVED_LDFLAGS="$LDFLAGS"
+
+      LDFLAGS="-lgomp"
+      AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+      XXX_LINK_IFELSE(
+         [AC_LANG_SOURCE([[int main() { return 0; }]])],
+         [AC_MSG_RESULT([yes])],
+         [AC_MSG_RESULT([no])]
+      )
+
+      if test "$retval" = "0"; then
+         AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+      fi
+
+      LDFLAGS="$SAVED_LDFLAGS"
+   fi
+fi
+
+#############################################################################
+## Add -Wl,--exclude-libs,ALL for GNU linker to stop us from re-exporting
+## symbols in other libraries. This keeps our ELF section header smaller.
+
+if test "$enable_shared" = "yes"; then
+
+   SAVED_LDFLAGS="$LDFLAGS"
+   LDFLAGS="-Wl,--exclude-libs,ALL"
+
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## Add -Wl,--as-needed for linker to avoid linking unneeded libraries.
+
+if true; then
+
+   SAVED_LDFLAGS="$LDFLAGS"
+   LDFLAGS="-Wl,--as-needed"
+
+   AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
+   XXX_LINK_IFELSE(
+      [AC_LANG_SOURCE([[int main() { return 0; }]])],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])]
+   )
+
+   if test "$retval" = "0"; then
+      AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
+   fi
+
+   LDFLAGS="$SAVED_LDFLAGS"
+fi
+
+#############################################################################
+## Android cpu-features library
+
+if test "$IS_ANDROID_OS" != "0"; then
+
+   # ac_srcdir does not work. Autotools blows...
+
+   THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h"
+   AC_CHECK_FILE([$THIS_FILE],
+      [cp "$THIS_FILE" "./"]
+   )
+
+   THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c"
+   AC_CHECK_FILE([$THIS_FILE],
+      [cp "$THIS_FILE" "./"]
+   )
+
+   # And set the flag so Makefile adds the recipes
+   THIS_FILE="./cpu-features.c"
+   AC_CHECK_FILE([$THIS_FILE],
+      [AM_CONDITIONAL([ANDROID_CPU_FEATURES], [true])],
+      [AM_CONDITIONAL([ANDROID_CPU_FEATURES], [false])]
+   )
+else
+   AM_CONDITIONAL([ANDROID_CPU_FEATURES], [false])
+fi
+
+#############################################################################
+## Miscellaneous items
+
+## Fix CCAS and CCASFLAGS
+## Also see https://stackoverflow.com/q/51575580/608639
+AC_SUBST([CCAS], [$CXX])
+AC_SUBST([CCASFLAGS], ["$AM_CXXFLAGS $CXXFLAGS"])
+
+## Without this 'make' uses our GNUmakefile, and not Makefile
+AC_CONFIG_COMMANDS_PRE([rm -f GNUmakefile 2>/dev/null])
+AC_CONFIG_COMMANDS_PRE([rm -f GNUmakefile-cross 2>/dev/null])
+
+## Write the Automake flags we set
+AC_SUBST([AM_CXXFLAGS])
+AC_SUBST([AM_LDFLAGS])
+
+## Write the output artifacts
+AC_OUTPUT
+
+## Automake bug workaround. If libcryptopp_la_SOURCES is an empty list, Automake assumes
+## C source files and drive link through the C compiler. We provide the empty adhoc.cpp
+## to get things back on course, so adhoc.cpp must always be copied.
+
+AC_CONFIG_COMMANDS_POST([cp adhoc.cpp.proto adhoc.cpp])
+
+#############################################################################
+## Print a summary of information
+
+echo ""
+echo "***********************************************************************"
+
+echo "Auto-configuration complete. A summary of options are below. If"
+echo "something looks wrong then please modify config.h and please report"
+echo "it at http://github.com/noloader/cryptopp-autotools."
+echo ""
+
+echo "   Build triplet: $build"
+echo " Compiler target: $COMPILER_TARGET"
+echo "Compiler version: $COMPILER_VERSION"
+echo ""
+
+echo "Static library: $enable_static"
+echo "Shared library: $enable_shared"
+echo ""
+
+if test "$IS_ARM32" != "0" || test "$IS_ARMV8" != "0"; then
+  if test x"$CRYPTOPP_ARM_NEON_HEADER" != "x"; then
+    echo "CRYPTOPP_ARM_NEON_HEADER: $CRYPTOPP_ARM_NEON_HEADER"
+  fi
+  if test x"$CRYPTOPP_ARM_ACLE_HEADER" != "x"; then
+    echo "CRYPTOPP_ARM_ACLE_HEADER: $CRYPTOPP_ARM_ACLE_HEADER"
+  fi
+  echo ""
+fi
+
+if test x"$CRYPTOPP_SSE2_FLAG" != "x"; then
+   echo "CRYPTOPP_SSE2_FLAG: $CRYPTOPP_SSE2_FLAG"
+fi
+if test x"$CRYPTOPP_NEON_FLAG" != "x"; then
+   echo "CRYPTOPP_NEON_FLAG: $CRYPTOPP_NEON_FLAG"
+fi
+if test x"$CRYPTOPP_ALTIVEC_FLAG" != "x"; then
+   echo "CRYPTOPP_ALTIVEC_FLAG: $CRYPTOPP_ALTIVEC_FLAG"
+fi
+if test x"$CRYPTOPP_POWER7_FLAG" != "x"; then
+   echo "CRYPTOPP_POWER7_FLAG: $CRYPTOPP_POWER7_FLAG"
+fi
+if test x"$CRYPTOPP_POWER8_FLAG" != "x"; then
+   echo "CRYPTOPP_POWER8_FLAG: $CRYPTOPP_POWER8_FLAG"
+fi
+#if test x"$CRYPTOPP_POWER9_FLAG" != "x"; then
+#   echo "CRYPTOPP_POWER9_FLAG: $CRYPTOPP_POWER9_FLAG"
+#fi
+if test x"$CRYPTOPP_ARIA_FLAG" != "x"; then
+   echo "CRYPTOPP_ARIA_FLAG: $CRYPTOPP_ARIA_FLAG"
+fi
+if test x"$CRYPTOPP_BLAKE2S_FLAG" != "x"; then
+   echo "CRYPTOPP_BLAKE2S_FLAG: $CRYPTOPP_BLAKE2S_FLAG"
+fi
+if test x"$CRYPTOPP_BLAKE2B_FLAG" != "x"; then
+   echo "CRYPTOPP_BLAKE2B_FLAG: $CRYPTOPP_BLAKE2B_FLAG"
+fi
+if test x"$CRYPTOPP_CHACHA_FLAG" != "x"; then
+   echo "CRYPTOPP_CHACHA_FLAG: $CRYPTOPP_CHACHA_FLAG"
+fi
+if test x"$CRYPTOPP_CHACHA_AVX2_FLAG" != "x"; then
+   echo "CRYPTOPP_CHACHA_AVX2_FLAG: $CRYPTOPP_CHACHA_AVX2_FLAG"
+fi
+if test x"$CRYPTOPP_CHAM_FLAG" != "x"; then
+   echo "CRYPTOPP_CHAM_FLAG: $CRYPTOPP_CHAM_FLAG"
+fi
+if test x"$CRYPTOPP_CRC_FLAG" != "x"; then
+   echo "CRYPTOPP_CRC_FLAG: $CRYPTOPP_CRC_FLAG"
+fi
+if test x"$CRYPTOPP_DONNA_FLAG" != "x"; then
+   echo "CRYPTOPP_DONNA_FLAG: $CRYPTOPP_DONNA_FLAG"
+fi
+if test x"$CRYPTOPP_LEA_FLAG" != "x"; then
+   echo "CRYPTOPP_LEA_FLAG: $CRYPTOPP_LEA_FLAG"
+fi
+if test x"$CRYPTOPP_KECCAK_FLAG" != "x"; then
+   echo "CRYPTOPP_KECCAK_FLAG: $CRYPTOPP_KECCAK_FLAG"
+fi
+if test x"$CRYPTOPP_GCM_FLAG" != "x"; then
+   echo "CRYPTOPP_GCM_FLAG: $CRYPTOPP_GCM_FLAG"
+fi
+if test x"$CRYPTOPP_GF2N_FLAG" != "x"; then
+   echo "CRYPTOPP_GF2N_FLAG: $CRYPTOPP_GF2N_FLAG"
+fi
+if test x"$CRYPTOPP_AES_FLAG" != "x"; then
+   echo "CRYPTOPP_AES_FLAG: $CRYPTOPP_AES_FLAG"
+fi
+if test x"$CRYPTOPP_SHA_FLAG" != "x"; then
+   echo "CRYPTOPP_SHA_FLAG: $CRYPTOPP_SHA_FLAG"
+fi
+if test x"$CRYPTOPP_SIMON128_FLAG" != "x"; then
+   echo "CRYPTOPP_SIMON128_FLAG: $CRYPTOPP_SIMON128_FLAG"
+fi
+if test x"$CRYPTOPP_SPECK128_FLAG" != "x"; then
+   echo "CRYPTOPP_SPECK128_FLAG: $CRYPTOPP_SPECK128_FLAG"
+fi
+if test x"$CRYPTOPP_SM4_FLAG" != "x"; then
+   echo "CRYPTOPP_SM4_FLAG: $CRYPTOPP_SM4_FLAG"
+fi
+if test x"$CRYPTOPGAMS_ARMV4_FLAG" != "x"; then
+   echo "CRYPTOPGAMS_ARMV4_FLAG: $CRYPTOPGAMS_ARMV4_FLAG"
+fi
+
+echo ""
+echo "Automake flags (can be overridden by user flags):"
+echo "AM_CXXFLAGS: $AM_CXXFLAGS"
+echo "AM_LDFLAGS: $AM_LDFLAGS"
+
+echo ""
+echo "User flags (overrides Automake flags on conflict):"
+echo "CXXFLAGS: $CXXFLAGS"
+echo "LDFLAGS: $LDFLAGS"
+
+OPT_NDEBUG=`echo $CPPFLAGS $CXXFLAGS | $EGREP -c '\-DNDEBUG'`
+if test "$OPT_NDEBUG" = "0"; then
+   echo ""
+   echo "CPPFLAGS does not include -DNDEBUG. You should consider building"
+   echo "with NDEBUG defined so an assert does not inadvertently crash your"
+   echo "program and egress sensitive data to the filesystem or an error"
+   echo "reporting service like AppPort, Windows Error Reporting, Crash"
+   echo "Reporter, Test Flight, etc."
+fi
+
+OPT_SYM=`echo $CPPFLAGS $CXXFLAGS | $EGREP -c '\-g'`
+if test "$OPT_SYM" = "0"; then
+   echo ""
+   echo "CPPFLAGS does not include -g. You should consider building with -g"
+   echo "to add debug symbols in case you have to analyze a crash."
+fi
+
+OPT_O3=`echo $CXXFLAGS | $EGREP -c '\-O3|\-O4|\-O5|\-xO3|\-xO4|\-xO5|\-Os|\-Ofast'`
+if test "$OPT_O3" = "0"; then
+   echo ""
+   echo "CXXFLAGS does not include -O3. You should consider building at -O3"
+   echo "to engage compiler vectorizations and enhance performance."
+fi
+
+echo "***********************************************************************"
+echo ""
diff --git a/package/lean/libcryptopp/src/libcryptopp.pc.in b/package/lean/libcryptopp/src/libcryptopp.pc.in
new file mode 100644
index 000000000..a6c502ee5
--- /dev/null
+++ b/package/lean/libcryptopp/src/libcryptopp.pc.in
@@ -0,0 +1,31 @@
+## libcryptopp.pc.in - Autotools package configuration file for Crypto++.
+##                     written and placed in public domain by Jeffrey Walton.
+##                     based on Debian package configuration by László Böszörményi.
+##
+
+## libdir=@libdir@ is not working as expected for Fedora, Solaris,
+## and other 64-bit OSes that use library directories like /lib64,
+## /usr/lib64, /lib/amd64 and friends. Also see:
+## * https://stackoverflow.com/q/47124066/608639
+## * https://stackoverflow.com/q/46847939/608639 and
+## * https://bugzilla.redhat.com/show_bug.cgi?id=1510073.
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Description: free C++ class library of cryptographic schemes
+Authors: originally written by Wei Dai
+Maintainers: the Crypto++ community
+URL: @PACKAGE_URL@
+Version: @PACKAGE_VERSION@
+Bug-Report: @PACKAGE_BUGREPORT@
+Requires:
+
+## These flags are mostly broken. We cannot record user choices,
+## and then have user programs use the same flags later.
+## https://lists.freedesktop.org/archives/pkg-config/2017-November/001087.html
+Cflags: -I${includedir}
+Libs: -L${libdir} -lcryptopp