From d7e8fd045e18e1e04d6ffbde641a117d8bcb3a3e Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 15 Sep 2026 15:41:54 +0700 Subject: [PATCH 1/2] build: drop the Autotools build The library is built with CMake only; Dash Core compiles the sources with its own build system and does not use this Autotools setup. Remove the configure script, the Makefile fragments, autogen.sh, the m4 macros and the Autotools half of the CI matrix. --- .github/workflows/build-test.yaml | 13 +- MANIFEST.in | 5 - Makefile.am | 39 - Makefile.bench.include | 22 - Makefile.bls.include | 66 -- Makefile.mimalloc.include | 46 -- Makefile.relic.include | 470 ------------ Makefile.test.include | 27 - README.md | 2 +- autogen.sh | 13 - build-aux/m4/ax_check_compile_flag.m4 | 53 -- build-aux/m4/ax_check_link_flag.m4 | 53 -- build-aux/m4/ax_cxx_compile_stdcxx.m4 | 1005 ------------------------- build-aux/m4/ax_pthread.m4 | 522 ------------- configure.ac | 913 ---------------------- 15 files changed, 3 insertions(+), 3246 deletions(-) delete mode 100644 Makefile.am delete mode 100644 Makefile.bench.include delete mode 100644 Makefile.bls.include delete mode 100644 Makefile.mimalloc.include delete mode 100644 Makefile.relic.include delete mode 100644 Makefile.test.include delete mode 100755 autogen.sh delete mode 100644 build-aux/m4/ax_check_compile_flag.m4 delete mode 100644 build-aux/m4/ax_check_link_flag.m4 delete mode 100644 build-aux/m4/ax_cxx_compile_stdcxx.m4 delete mode 100644 build-aux/m4/ax_pthread.m4 delete mode 100644 configure.ac diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 90a550a5e..8b97fad98 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -17,13 +17,12 @@ concurrency: jobs: build: - name: ${{ matrix.os }}, ${{ matrix.builder }}, ${{ matrix.compiler.cc }}, ${{ matrix.backend }} backend + name: ${{ matrix.os }}, ${{ matrix.compiler.cc }}, ${{ matrix.backend }} backend runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ macos-latest, ubuntu-latest ] - builder: [ cmake, autotools ] compiler: - cc: gcc cxx: g++ @@ -47,23 +46,15 @@ jobs: run: | ls -l export MACOSX_DEPLOYMENT_TARGET=10.14 - brew install autoconf automake gmp libtool pkg-config + brew install gmp pkg-config - name: Build library using CMake - if: startsWith(matrix.builder, 'cmake') run: | mkdir -p build && cd build CC=${{ matrix.compiler.cc }} CXX=${{ matrix.compiler.cxx }} cmake .. -DARITH=${{ matrix.backend }} -DBUILD_BLS_PYTHON_BINDINGS=0 -DCMAKE_BUILD_TYPE=Debug cmake --build . -- -j 6 mv src/runtest .. - - name: Build library using GNU Autotools - if: startsWith(matrix.builder, 'autotools') - run: | - ./autogen.sh - CC=${{ matrix.compiler.cc }} CXX=${{ matrix.compiler.cxx }} ./configure --with-backend=${{ matrix.backend }} - make -j8 - - name: Run tests run: ./runtest diff --git a/MANIFEST.in b/MANIFEST.in index 62cc22eae..5ae9e0282 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -25,11 +25,6 @@ prune depends/relic/preset prune depends/relic/test prune depends/relic/tools -# Autotools build -prune build-aux -prune autom4te.cache -exclude Makefile.am Makefile.*.include Makefile.in Makefile configure.ac aclocal.m4 autogen.sh - # dot{dir,file}s prune .github prune .vscode diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 1c1e5d19d..000000000 --- a/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2013-2016 The Bitcoin Core developers -# Copyright (c) 2022 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php. - -print-%: FORCE - @echo '$*'='$($*)' - -ACLOCAL_AMFLAGS = -I build-aux/m4 -.PHONY: deploy FORCE - -AM_LDFLAGS = $(HARDENED_LDFLAGS) $(CORE_LDFLAGS) $(GMP_LDFLAGS) -AM_CFLAGS = $(DEBUG_FLAGS) $(HARDENED_FLAGS) $(CORE_FLAGS) $(WARN_FLAGS) $(NOWARN_FLAGS) -AM_CPPFLAGS = $(CORE_CPPFLAGS) $(GMP_CPPFLAGS) -AM_CXXFLAGS = $(DEBUG_FLAGS) $(HARDENED_FLAGS) $(CORE_FLAGS) $(WARN_FLAGS) $(NOWARN_FLAGS) -PTHREAD_FLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) - -EXTRA_LIBRARIES = - -lib_LTLIBRARIES = -noinst_LTLIBRARIES = - -bin_PROGRAMS = -noinst_PROGRAMS = -EXTRA_DIST = - -CLEANFILES = - -include Makefile.bls.include - -CLEANFILES += $(LIBRELIC) $(LIBDASHBLS) $(LIBMIMALLOC) - -if USE_TESTS -CLEANFILES += $(DASHBLS_RUNTEST) -endif - -if USE_BENCH -CLEANFILES += $(DASHBLS_RUNBENCH) -endif diff --git a/Makefile.bench.include b/Makefile.bench.include deleted file mode 100644 index f584102a3..000000000 --- a/Makefile.bench.include +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) 2021 The PIVX developers -# Copyright (c) 2022 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php. - -DASHBLS_RUNBENCH = runbench - -runbench_SOURCES = \ - src/test-bench.cpp \ - src/test-utils.hpp - -runbench_SOURCES += \ - $(RELIC_H) \ - $(DASHBLS_H) - -runbench_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_INCLUDES) $(RELIC_INCLUDES) -runbench_CXXFLAGS = $(AM_CXXFLAGS) -runbench_LDFLAGS = -static $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) - -runbench_LDADD = $(LIBDASHBLS) - -noinst_PROGRAMS += $(DASHBLS_RUNBENCH) diff --git a/Makefile.bls.include b/Makefile.bls.include deleted file mode 100644 index 7c35b3ced..000000000 --- a/Makefile.bls.include +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) 2021 The PIVX developers -# Copyright (c) 2022 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php. - -LIBDASHBLS = libdashbls.la - -DASHBLS_CPPFLAGS = -DBLSALLOC_MIMALLOC=1 - -DASHBLS_INCLUDES = \ - -I$(builddir) \ - -I$(builddir)/obj \ - -I$(top_srcdir)/include/dashbls - -DASHBLS_H = \ - src/bls.hpp \ - src/chaincode.hpp \ - src/elements.hpp \ - src/extendedprivatekey.hpp \ - src/extendedpublickey.hpp \ - src/hdkeys.hpp \ - src/hkdf.hpp \ - src/legacy.hpp \ - src/privatekey.hpp \ - src/schemes.hpp \ - src/test-utils.hpp \ - src/threshold.hpp \ - src/util.hpp - -libdashbls_la_SOURCES = \ - src/bls.cpp \ - src/chaincode.cpp \ - src/elements.cpp \ - src/extendedprivatekey.cpp \ - src/extendedpublickey.cpp \ - src/legacy.cpp \ - src/privatekey.cpp \ - src/schemes.cpp \ - src/threshold.cpp - -libdashbls_la_SOURCES += \ - $(DASHBLS_H) \ - $(MIMALLOC_H) \ - $(RELIC_H) - -libdashbls_la_LIBADD = \ - $(LIBMIMALLOC) \ - $(LIBRELIC) \ - $(GMP_LIBS) - -libdashbls_la_CPPFLAGS = $(AM_CPPFLAGS) $(RELIC_INCLUDES) $(MIMALLOC_INCLUDES) $(DASHBLS_INCLUDES) $(DASHBLS_CPPFLAGS) -libdashbls_la_CXXFLAGS = $(AM_CXXFLAGS) -libdashbls_la_LDFLAGS = $(AM_LDFLAGS) - -include Makefile.mimalloc.include -include Makefile.relic.include - -if USE_TESTS -include Makefile.test.include -endif - -if USE_BENCH -include Makefile.bench.include -endif - -lib_LTLIBRARIES += $(LIBDASHBLS) diff --git a/Makefile.mimalloc.include b/Makefile.mimalloc.include deleted file mode 100644 index fada5fe32..000000000 --- a/Makefile.mimalloc.include +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2022-2025 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php. - -LIBMIMALLOC = libmimalloc-secure.la - -MIMALLOC_CPPFLAGS = \ - -DMI_SECURE=4 \ - -DNDEBUG - -MIMALLOC_INCLUDES = \ - -I$(top_srcdir)/depends/mimalloc/include \ - -I$(top_srcdir)/depends/mimalloc/src - -MIMALLOC_H = \ - depends/mimalloc/include/mimalloc-new-delete.h \ - depends/mimalloc/include/mimalloc-override.h \ - depends/mimalloc/include/mimalloc-stats.h \ - depends/mimalloc/include/mimalloc.h \ - depends/mimalloc/src/bitmap.h - -libmimalloc_secure_la_SOURCES = \ - $(MIMALLOC_H) \ - depends/mimalloc/src/alloc-aligned.c \ - depends/mimalloc/src/alloc-posix.c \ - depends/mimalloc/src/alloc.c \ - depends/mimalloc/src/arena-meta.c \ - depends/mimalloc/src/arena.c \ - depends/mimalloc/src/bitmap.c \ - depends/mimalloc/src/heap.c \ - depends/mimalloc/src/init.c \ - depends/mimalloc/src/libc.c \ - depends/mimalloc/src/options.c \ - depends/mimalloc/src/os.c \ - depends/mimalloc/src/page-map.c \ - depends/mimalloc/src/page.c \ - depends/mimalloc/src/random.c \ - depends/mimalloc/src/stats.c \ - depends/mimalloc/src/prim/prim.c - -libmimalloc_secure_la_CPPFLAGS = $(AM_CPPFLAGS) $(MIMALLOC_CPPFLAGS) $(MIMALLOC_INCLUDES) -libmimalloc_secure_la_CXXFLAGS = $(AM_CXXFLAGS) -libmimalloc_secure_la_CFLAGS = $(AM_CFLAGS) -libmimalloc_secure_la_LDFLAGS = $(AM_LDFLAGS) - -noinst_LTLIBRARIES += $(LIBMIMALLOC) diff --git a/Makefile.relic.include b/Makefile.relic.include deleted file mode 100644 index 92bd7c7e8..000000000 --- a/Makefile.relic.include +++ /dev/null @@ -1,470 +0,0 @@ -# Copyright (c) 2021 The PIVX developers -# Copyright (c) 2022 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php. - -LIBRELIC = librelic.la - -RELIC_INCLUDES = \ - -I$(top_srcdir)/depends/relic/include \ - -I$(top_srcdir)/depends/relic/include/low \ - -I$(top_srcdir)/depends/relic/src/tmpl - -RELIC_H = \ - depends/relic/include/relic.h \ - depends/relic/include/relic_alloc.h \ - depends/relic/include/relic_arch.h \ - depends/relic/include/relic_bc.h \ - depends/relic/include/relic_bench.h \ - depends/relic/include/relic_bn.h \ - depends/relic/include/relic_conf.h \ - depends/relic/include/relic_core.h \ - depends/relic/include/relic_cp.h \ - depends/relic/include/relic_dv.h \ - depends/relic/include/relic_eb.h \ - depends/relic/include/relic_ec.h \ - depends/relic/include/relic_ed.h \ - depends/relic/include/relic_ep.h \ - depends/relic/include/relic_epx.h \ - depends/relic/include/relic_err.h \ - depends/relic/include/relic_fb.h \ - depends/relic/include/relic_fbx.h \ - depends/relic/include/relic_fp.h \ - depends/relic/include/relic_fpx.h \ - depends/relic/include/relic_label.h \ - depends/relic/include/relic_md.h \ - depends/relic/include/relic_mpc.h \ - depends/relic/include/relic_multi.h \ - depends/relic/include/relic_pc.h \ - depends/relic/include/relic_pp.h \ - depends/relic/include/relic_rand.h \ - depends/relic/include/relic_test.h \ - depends/relic/include/relic_types.h \ - depends/relic/include/relic_util.h \ - depends/relic/include/low/relic_bn_low.h \ - depends/relic/include/low/relic_dv_low.h \ - depends/relic/include/low/relic_fb_low.h \ - depends/relic/include/low/relic_fp_low.h \ - depends/relic/include/low/relic_fpx_low.h \ - depends/relic/src/arch/lzcnt.inc \ - depends/relic/src/tmpl/relic_tmpl_map.h - -RELIC_SOURCES = \ - depends/relic/src/relic_err.c \ - depends/relic/src/relic_core.c \ - depends/relic/src/relic_conf.c \ - depends/relic/src/relic_util.c - -BN_SOURCES = \ - depends/relic/src/bn/relic_bn_add.c \ - depends/relic/src/bn/relic_bn_cmp.c \ - depends/relic/src/bn/relic_bn_div.c \ - depends/relic/src/bn/relic_bn_factor.c \ - depends/relic/src/bn/relic_bn_gcd.c \ - depends/relic/src/bn/relic_bn_inv.c \ - depends/relic/src/bn/relic_bn_lcm.c \ - depends/relic/src/bn/relic_bn_mem.c \ - depends/relic/src/bn/relic_bn_mod.c \ - depends/relic/src/bn/relic_bn_mul.c \ - depends/relic/src/bn/relic_bn_mxp.c \ - depends/relic/src/bn/relic_bn_prime.c \ - depends/relic/src/bn/relic_bn_rec.c \ - depends/relic/src/bn/relic_bn_shift.c \ - depends/relic/src/bn/relic_bn_smb.c \ - depends/relic/src/bn/relic_bn_sqr.c \ - depends/relic/src/bn/relic_bn_srt.c \ - depends/relic/src/bn/relic_bn_util.c - -FP_SOURCES = \ - depends/relic/src/fp/relic_fp_add.c \ - depends/relic/src/fp/relic_fp_cmp.c \ - depends/relic/src/fp/relic_fp_exp.c \ - depends/relic/src/fp/relic_fp_inv.c \ - depends/relic/src/fp/relic_fp_mul.c \ - depends/relic/src/fp/relic_fp_param.c \ - depends/relic/src/fp/relic_fp_prime.c \ - depends/relic/src/fp/relic_fp_rdc.c \ - depends/relic/src/fp/relic_fp_shift.c \ - depends/relic/src/fp/relic_fp_sqr.c \ - depends/relic/src/fp/relic_fp_srt.c \ - depends/relic/src/fp/relic_fp_util.c - -FPX_SOURCES = \ - depends/relic/src/fpx/relic_fp2_mul.c \ - depends/relic/src/fpx/relic_fp2_sqr.c \ - depends/relic/src/fpx/relic_fp3_mul.c \ - depends/relic/src/fpx/relic_fp3_sqr.c \ - depends/relic/src/fpx/relic_fp4_mul.c \ - depends/relic/src/fpx/relic_fp4_sqr.c \ - depends/relic/src/fpx/relic_fp6_mul.c \ - depends/relic/src/fpx/relic_fp6_sqr.c \ - depends/relic/src/fpx/relic_fp8_mul.c \ - depends/relic/src/fpx/relic_fp8_sqr.c \ - depends/relic/src/fpx/relic_fp9_mul.c \ - depends/relic/src/fpx/relic_fp9_sqr.c \ - depends/relic/src/fpx/relic_fp12_mul.c \ - depends/relic/src/fpx/relic_fp12_sqr.c \ - depends/relic/src/fpx/relic_fp18_mul.c \ - depends/relic/src/fpx/relic_fp18_sqr.c \ - depends/relic/src/fpx/relic_fp24_mul.c \ - depends/relic/src/fpx/relic_fp24_sqr.c \ - depends/relic/src/fpx/relic_fp48_mul.c \ - depends/relic/src/fpx/relic_fp48_sqr.c \ - depends/relic/src/fpx/relic_fp54_mul.c \ - depends/relic/src/fpx/relic_fp54_sqr.c \ - depends/relic/src/fpx/relic_fpx_add.c \ - depends/relic/src/fpx/relic_fpx_cmp.c \ - depends/relic/src/fpx/relic_fpx_cyc.c \ - depends/relic/src/fpx/relic_fpx_exp.c \ - depends/relic/src/fpx/relic_fpx_field.c \ - depends/relic/src/fpx/relic_fpx_frb.c \ - depends/relic/src/fpx/relic_fpx_inv.c \ - depends/relic/src/fpx/relic_fpx_pck.c \ - depends/relic/src/fpx/relic_fpx_rdc.c \ - depends/relic/src/fpx/relic_fpx_srt.c \ - depends/relic/src/fpx/relic_fpx_util.c - -FB_SOURCES = \ - depends/relic/src/fb/relic_fb_add.c \ - depends/relic/src/fb/relic_fb_cmp.c \ - depends/relic/src/fb/relic_fb_exp.c \ - depends/relic/src/fb/relic_fb_inv.c \ - depends/relic/src/fb/relic_fb_itr.c \ - depends/relic/src/fb/relic_fb_mul.c \ - depends/relic/src/fb/relic_fb_param.c \ - depends/relic/src/fb/relic_fb_poly.c \ - depends/relic/src/fb/relic_fb_rdc.c \ - depends/relic/src/fb/relic_fb_shift.c \ - depends/relic/src/fb/relic_fb_slv.c \ - depends/relic/src/fb/relic_fb_sqr.c \ - depends/relic/src/fb/relic_fb_srt.c \ - depends/relic/src/fb/relic_fb_trc.c \ - depends/relic/src/fb/relic_fb_util.c - -EP_SOURCES = \ - depends/relic/src/ep/relic_ep_add.c \ - depends/relic/src/ep/relic_ep_cmp.c \ - depends/relic/src/ep/relic_ep_curve.c \ - depends/relic/src/ep/relic_ep_dbl.c \ - depends/relic/src/ep/relic_ep_map.c \ - depends/relic/src/ep/relic_ep_mul.c \ - depends/relic/src/ep/relic_ep_mul_fix.c \ - depends/relic/src/ep/relic_ep_mul_sim.c \ - depends/relic/src/ep/relic_ep_neg.c \ - depends/relic/src/ep/relic_ep_norm.c \ - depends/relic/src/ep/relic_ep_param.c \ - depends/relic/src/ep/relic_ep_pck.c \ - depends/relic/src/ep/relic_ep_psi.c \ - depends/relic/src/ep/relic_ep_util.c - -EPX_SOURCES = \ - depends/relic/src/epx/relic_ep2_add.c \ - depends/relic/src/epx/relic_ep2_cmp.c \ - depends/relic/src/epx/relic_ep2_curve.c \ - depends/relic/src/epx/relic_ep2_dbl.c \ - depends/relic/src/epx/relic_ep2_frb.c \ - depends/relic/src/epx/relic_ep2_map.c \ - depends/relic/src/epx/relic_ep2_mul.c \ - depends/relic/src/epx/relic_ep2_mul_cof.c \ - depends/relic/src/epx/relic_ep2_mul_fix.c \ - depends/relic/src/epx/relic_ep2_mul_sim.c \ - depends/relic/src/epx/relic_ep2_neg.c \ - depends/relic/src/epx/relic_ep2_norm.c \ - depends/relic/src/epx/relic_ep2_pck.c \ - depends/relic/src/epx/relic_ep2_util.c \ - depends/relic/src/epx/relic_ep4_add.c \ - depends/relic/src/epx/relic_ep4_cmp.c \ - depends/relic/src/epx/relic_ep4_curve.c \ - depends/relic/src/epx/relic_ep4_dbl.c \ - depends/relic/src/epx/relic_ep4_frb.c \ - depends/relic/src/epx/relic_ep4_map.c \ - depends/relic/src/epx/relic_ep4_mul.c \ - depends/relic/src/epx/relic_ep4_mul_cof.c \ - depends/relic/src/epx/relic_ep4_mul_fix.c \ - depends/relic/src/epx/relic_ep4_mul_sim.c \ - depends/relic/src/epx/relic_ep4_neg.c \ - depends/relic/src/epx/relic_ep4_norm.c \ - depends/relic/src/epx/relic_ep4_util.c - -EB_SOURCES = \ - depends/relic/src/eb/relic_eb_add.c \ - depends/relic/src/eb/relic_eb_cmp.c \ - depends/relic/src/eb/relic_eb_curve.c \ - depends/relic/src/eb/relic_eb_dbl.c \ - depends/relic/src/eb/relic_eb_frb.c \ - depends/relic/src/eb/relic_eb_hlv.c \ - depends/relic/src/eb/relic_eb_map.c \ - depends/relic/src/eb/relic_eb_mul.c \ - depends/relic/src/eb/relic_eb_mul_fix.c \ - depends/relic/src/eb/relic_eb_mul_sim.c \ - depends/relic/src/eb/relic_eb_neg.c \ - depends/relic/src/eb/relic_eb_norm.c \ - depends/relic/src/eb/relic_eb_param.c \ - depends/relic/src/eb/relic_eb_pck.c \ - depends/relic/src/eb/relic_eb_util.c - -ED_SOURCES = \ - depends/relic/src/ed/relic_ed_add.c \ - depends/relic/src/ed/relic_ed_cmp.c \ - depends/relic/src/ed/relic_ed_curve.c \ - depends/relic/src/ed/relic_ed_dbl.c \ - depends/relic/src/ed/relic_ed_map.c \ - depends/relic/src/ed/relic_ed_mul.c \ - depends/relic/src/ed/relic_ed_mul_fix.c \ - depends/relic/src/ed/relic_ed_mul_sim.c \ - depends/relic/src/ed/relic_ed_neg.c \ - depends/relic/src/ed/relic_ed_norm.c \ - depends/relic/src/ed/relic_ed_param.c \ - depends/relic/src/ed/relic_ed_pck.c \ - depends/relic/src/ed/relic_ed_util.c - -PP_SOURCES = \ - depends/relic/src/pp/relic_pp_add_k2.c \ - depends/relic/src/pp/relic_pp_add_k8.c \ - depends/relic/src/pp/relic_pp_add_k12.c \ - depends/relic/src/pp/relic_pp_add_k24.c \ - depends/relic/src/pp/relic_pp_add_k48.c \ - depends/relic/src/pp/relic_pp_add_k54.c \ - depends/relic/src/pp/relic_pp_dbl_k2.c \ - depends/relic/src/pp/relic_pp_dbl_k8.c \ - depends/relic/src/pp/relic_pp_dbl_k12.c \ - depends/relic/src/pp/relic_pp_dbl_k24.c \ - depends/relic/src/pp/relic_pp_dbl_k48.c \ - depends/relic/src/pp/relic_pp_dbl_k54.c \ - depends/relic/src/pp/relic_pp_exp_k2.c \ - depends/relic/src/pp/relic_pp_exp_k8.c \ - depends/relic/src/pp/relic_pp_exp_k12.c \ - depends/relic/src/pp/relic_pp_exp_k24.c \ - depends/relic/src/pp/relic_pp_exp_k48.c \ - depends/relic/src/pp/relic_pp_exp_k54.c \ - depends/relic/src/pp/relic_pp_map.c \ - depends/relic/src/pp/relic_pp_map_k2.c \ - depends/relic/src/pp/relic_pp_map_k8.c \ - depends/relic/src/pp/relic_pp_map_k12.c \ - depends/relic/src/pp/relic_pp_map_k24.c \ - depends/relic/src/pp/relic_pp_map_k48.c \ - depends/relic/src/pp/relic_pp_map_k54.c \ - depends/relic/src/pp/relic_pp_norm.c - -PC_SOURCES = \ - depends/relic/src/pc/relic_pc_core.c \ - depends/relic/src/pc/relic_pc_exp.c \ - depends/relic/src/pc/relic_pc_util.c - -MD_SOURCES = \ - depends/relic/src/md/blake2.h \ - depends/relic/src/md/blake2-impl.h \ - depends/relic/src/md/blake2s-ref.c \ - depends/relic/src/md/relic_md_blake2s.c \ - depends/relic/src/md/relic_md_hmac.c \ - depends/relic/src/md/relic_md_kdf.c \ - depends/relic/src/md/relic_md_mgf.c \ - depends/relic/src/md/relic_md_sha224.c \ - depends/relic/src/md/relic_md_sha256.c \ - depends/relic/src/md/relic_md_sha384.c \ - depends/relic/src/md/relic_md_sha512.c \ - depends/relic/src/md/relic_md_xmd.c \ - depends/relic/src/md/sha.h \ - depends/relic/src/md/sha224-256.c \ - depends/relic/src/md/sha384-512.c \ - depends/relic/src/md/sha_private.h - -EXTRA_DIST += \ - depends/relic/src/arch/relic_arch_arm.c \ - depends/relic/src/arch/relic_arch_none.c \ - depends/relic/src/arch/relic_arch_x64.c \ - depends/relic/src/arch/relic_arch_x86.c - -RELIC_SOURCES += \ - depends/relic/src/arch/relic_arch_@CPU_ARCH@.c \ - depends/relic/src/rand/relic_rand_call.c \ - depends/relic/src/rand/relic_rand_core.c \ - depends/relic/src/rand/relic_rand_hashd.c \ - depends/relic/src/rand/relic_rand_udev.c - -if WITH_DV -RELIC_SOURCES += \ - depends/relic/src/dv/relic_dv_mem.c \ - depends/relic/src/dv/relic_dv_util.c -endif - -if ARITH_EASY -if WITH_BN -RELIC_SOURCES += $(BN_SOURCES) \ - depends/relic/src/low/easy/relic_bn_add_low.c \ - depends/relic/src/low/easy/relic_bn_div_low.c \ - depends/relic/src/low/easy/relic_bn_mod_low.c \ - depends/relic/src/low/easy/relic_bn_mul_low.c \ - depends/relic/src/low/easy/relic_bn_shift_low.c \ - depends/relic/src/low/easy/relic_bn_sqr_low.c -endif - -if WITH_FP -RELIC_SOURCES += $(FP_SOURCES) \ - depends/relic/src/low/easy/relic_fp_add_low.c \ - depends/relic/src/low/easy/relic_fp_inv_low.c \ - depends/relic/src/low/easy/relic_fp_mul_low.c \ - depends/relic/src/low/easy/relic_fp_rdc_low.c \ - depends/relic/src/low/easy/relic_fp_shift_low.c \ - depends/relic/src/low/easy/relic_fp_sqr_low.c -endif - -if WITH_FPX -RELIC_SOURCES += $(FPX_SOURCES) \ - depends/relic/src/low/easy/relic_fpx_add_low.c \ - depends/relic/src/low/easy/relic_fpx_mul_low.c \ - depends/relic/src/low/easy/relic_fpx_rdc_low.c \ - depends/relic/src/low/easy/relic_fpx_sqr_low.c -endif - -if WITH_FB -RELIC_SOURCES += $(FB_SOURCES) \ - depends/relic/src/low/easy/relic_fb_add_low.c \ - depends/relic/src/low/easy/relic_fb_inv_low.c \ - depends/relic/src/low/easy/relic_fb_itr_low.c \ - depends/relic/src/low/easy/relic_fb_mul_low.c \ - depends/relic/src/low/easy/relic_fb_rdc_low.c \ - depends/relic/src/low/easy/relic_fb_shift_low.c \ - depends/relic/src/low/easy/relic_fb_slv_low.c \ - depends/relic/src/low/easy/relic_fb_sqr_low.c \ - depends/relic/src/low/easy/relic_fb_srt_low.c \ - depends/relic/src/low/easy/relic_fb_trc_low.c -endif -endif - -if ARITH_GMP -if WITH_BN -RELIC_SOURCES += $(BN_SOURCES) \ - depends/relic/src/low/gmp/relic_bn_add_low.c \ - depends/relic/src/low/gmp/relic_bn_div_low.c \ - depends/relic/src/low/gmp/relic_bn_mod_low.c \ - depends/relic/src/low/gmp/relic_bn_mul_low.c \ - depends/relic/src/low/gmp/relic_bn_shift_low.c \ - depends/relic/src/low/gmp/relic_bn_sqr_low.c -endif - -if WITH_FP -RELIC_SOURCES += $(FP_SOURCES) \ - depends/relic/src/low/gmp/relic_fp_add_low.c \ - depends/relic/src/low/gmp/relic_fp_inv_low.c \ - depends/relic/src/low/gmp/relic_fp_mul_low.c \ - depends/relic/src/low/gmp/relic_fp_rdc_low.c \ - depends/relic/src/low/gmp/relic_fp_shift_low.c \ - depends/relic/src/low/gmp/relic_fp_sqr_low.c -endif - -if WITH_FPX -RELIC_SOURCES += $(FPX_SOURCES) \ - depends/relic/src/low/easy/relic_fpx_add_low.c \ - depends/relic/src/low/easy/relic_fpx_mul_low.c \ - depends/relic/src/low/easy/relic_fpx_rdc_low.c \ - depends/relic/src/low/easy/relic_fpx_sqr_low.c -endif - -if WITH_FB -RELIC_SOURCES += $(FB_SOURCES) \ - depends/relic/src/low/gmp/relic_fb_add_low.c \ - depends/relic/src/low/easy/relic_fb_inv_low.c \ - depends/relic/src/low/easy/relic_fb_itr_low.c \ - depends/relic/src/low/easy/relic_fb_mul_low.c \ - depends/relic/src/low/easy/relic_fb_rdc_low.c \ - depends/relic/src/low/gmp/relic_fb_shift_low.c \ - depends/relic/src/low/easy/relic_fb_slv_low.c \ - depends/relic/src/low/easy/relic_fb_sqr_low.c \ - depends/relic/src/low/easy/relic_fb_srt_low.c \ - depends/relic/src/low/easy/relic_fb_trc_low.c -endif -endif - -if WITH_FBX -RELIC_SOURCES += \ - depends/relic/src/fbx/relic_fb2_inv.c \ - depends/relic/src/fbx/relic_fb2_mul.c \ - depends/relic/src/fbx/relic_fb2_slv.c \ - depends/relic/src/fbx/relic_fb2_sqr.c -endif - -if WITH_EP -RELIC_SOURCES += $(EP_SOURCES) -endif - -if WITH_EPX -RELIC_SOURCES += $(EPX_SOURCES) -endif - -if WITH_EB -RELIC_SOURCES += $(EB_SOURCES) -endif - -if WITH_ED -RELIC_SOURCES += $(ED_SOURCES) -endif - -if WITH_PP -RELIC_SOURCES += $(PP_SOURCES) -endif - -if WITH_PC -RELIC_SOURCES += $(PC_SOURCES) -endif - -if WITH_CP -RELIC_SOURCES += \ - depends/relic/src/cp/relic_cp_bbs.c \ - depends/relic/src/cp/relic_cp_bdpe.c \ - depends/relic/src/cp/relic_cp_bgn.c \ - depends/relic/src/cp/relic_cp_bls.c \ - depends/relic/src/cp/relic_cp_cls.c \ - depends/relic/src/cp/relic_cp_cmlhs.c \ - depends/relic/src/cp/relic_cp_ecdh.c \ - depends/relic/src/cp/relic_cp_ecdsa.c \ - depends/relic/src/cp/relic_cp_ecies.c \ - depends/relic/src/cp/relic_cp_ecmqv.c \ - depends/relic/src/cp/relic_cp_ecss.c \ - depends/relic/src/cp/relic_cp_ers.c \ - depends/relic/src/cp/relic_cp_etrs.c \ - depends/relic/src/cp/relic_cp_ghpe.c \ - depends/relic/src/cp/relic_cp_ibe.c \ - depends/relic/src/cp/relic_cp_mklhs.c \ - depends/relic/src/cp/relic_cp_mpss.c \ - depends/relic/src/cp/relic_cp_pcdel.c \ - depends/relic/src/cp/relic_cp_phpe.c \ - depends/relic/src/cp/relic_cp_pok.c \ - depends/relic/src/cp/relic_cp_pss.c \ - depends/relic/src/cp/relic_cp_rabin.c \ - depends/relic/src/cp/relic_cp_rsa.c \ - depends/relic/src/cp/relic_cp_sok.c \ - depends/relic/src/cp/relic_cp_sokaka.c \ - depends/relic/src/cp/relic_cp_vbnn.c \ - depends/relic/src/cp/relic_cp_zss.c -endif - -if WITH_BC -RELIC_SOURCES += \ - depends/relic/src/bc/relic_bc_aes.c \ - depends/relic/src/bc/rijndael-alg-fst.c \ - depends/relic/src/bc/rijndael-alg-fst.h \ - depends/relic/src/bc/rijndael-api-fst.c \ - depends/relic/src/bc/rijndael-api-fst.h -endif - -if WITH_MD -RELIC_SOURCES += $(MD_SOURCES) -endif - -if WITH_MPC -RELIC_SOURCES += \ - depends/relic/src/mpc/relic_mt_mpc.c \ - depends/relic/src/mpc/relic_pc_mpc.c -endif - -librelic_la_SOURCES = \ - $(RELIC_SOURCES) \ - $(RELIC_H) - -librelic_la_CPPFLAGS = $(AM_CPPFLAGS) $(RELIC_CPPFLAGS) $(RELIC_INCLUDES) -librelic_la_CXXFLAGS = $(AM_CXXFLAGS) -librelic_la_CFLAGS = $(AM_CFLAGS) -librelic_la_LDFLAGS = $(AM_LDFLAGS) - -noinst_LTLIBRARIES += $(LIBRELIC) diff --git a/Makefile.test.include b/Makefile.test.include deleted file mode 100644 index a8ec86cb5..000000000 --- a/Makefile.test.include +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2021 The PIVX developers -# Copyright (c) 2022 The Dash Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING.MIT or http://www.opensource.org/licenses/mit-license.php. - -DASHBLS_RUNTEST = runtest - -RUNTEST_INCLUDES = \ - -I$(top_srcdir)/depends/catch2/include - -RUNTEST_H = \ - depends/catch2/include/catch2/catch.hpp - -runtest_SOURCES = \ - $(DASHBLS_H) \ - $(RELIC_H) \ - $(RUNTEST_H) \ - src/test.cpp \ - src/test-utils.hpp - -runtest_CPPFLAGS = $(AM_CPPFLAGS) $(DASHBLS_INCLUDES) $(RELIC_INCLUDES) $(RUNTEST_INCLUDES) -runtest_CXXFLAGS = $(AM_CXXFLAGS) -runtest_LDFLAGS = -static $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) - -runtest_LDADD = $(LIBDASHBLS) - -noinst_PROGRAMS += $(DASHBLS_RUNTEST) diff --git a/README.md b/README.md index 1d22cdfd4..291b83499 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ the [`relic`](https://github.com/relic-toolkit/relic) toolkit with bindings avai ## Dependencies * A C++17 capable compiler (GCC 9, Clang 7 or higher) -* CMake 3.18 or higher (or Autoconf 2.71 or higher; with libtool and automake) +* CMake 3.18 or higher * [`libgmp`](https://gmplib.org/) (for fast arithmetic, **optional**) Additionally, the following dependencies are supplied by the codebase diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index f3e943e16..000000000 --- a/autogen.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -export LC_ALL=C -set -e -srcdir="$(dirname "$0")" -cd "$srcdir" -if [ -z "${LIBTOOLIZE}" ] && GLIBTOOLIZE="$(command -v glibtoolize)"; then - LIBTOOLIZE="${GLIBTOOLIZE}" - export LIBTOOLIZE -fi -command -v autoreconf >/dev/null || \ - (echo "configuration failed, please install autoconf first" && exit 1) -autoreconf --install --force --warnings=all -autoheader --force --replace-handwritten || autoheader --force diff --git a/build-aux/m4/ax_check_compile_flag.m4 b/build-aux/m4/ax_check_compile_flag.m4 deleted file mode 100644 index bd753b34d..000000000 --- a/build-aux/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/build-aux/m4/ax_check_link_flag.m4 b/build-aux/m4/ax_check_link_flag.m4 deleted file mode 100644 index 03a30ce4c..000000000 --- a/build-aux/m4/ax_check_link_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the linker or gives an error. -# (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the linker's default flags -# when the check is done. The check is thus made with the flags: "LDFLAGS -# EXTRA-FLAGS FLAG". This can for example be used to force the linker to -# issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_LINK_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_LINK_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl -AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ - ax_check_save_flags=$LDFLAGS - LDFLAGS="$LDFLAGS $4 $1" - AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - LDFLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_LINK_FLAGS diff --git a/build-aux/m4/ax_cxx_compile_stdcxx.m4 b/build-aux/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 51a35054d..000000000 --- a/build-aux/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,1005 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for -# the respective C++ standard version. -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for no added switch, and then for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik -# Copyright (c) 2012 Zack Weinberg -# Copyright (c) 2013 Roy Stogner -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov -# Copyright (c) 2015 Paul Norman -# Copyright (c) 2015 Moritz Klammler -# Copyright (c) 2016, 2018 Krzesimir Nowak -# Copyright (c) 2019 Enji Cooper -# Copyright (c) 2020 Jason Merrill -# Copyright (c) 2021 Jörn Heusipp -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 14 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], - [$1], [14], [ax_cxx_compile_alternatives="14 1y"], - [$1], [17], [ax_cxx_compile_alternatives="17 1z"], - [$1], [20], [ax_cxx_compile_alternatives="20"], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - - m4_if([$2], [], [dnl - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, - ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [ax_cv_cxx_compile_cxx$1=yes], - [ax_cv_cxx_compile_cxx$1=no])]) - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then - ac_success=yes - fi]) - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - switch="-std=gnu++${alternative}" - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - -dnl Test body for checking C++17 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 -) - -dnl Test body for checking C++20 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 -) - - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual ~Base() {} - virtual void f() {} - }; - - struct Derived : public Base - { - virtual ~Derived() override {} - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check single_type; - typedef check> double_type; - typedef check>> triple_type; - typedef check>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == true, ""); - static_assert(is_same::value == false, ""); - static_assert(is_same::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template - struct sum; - - template - struct sum - { - static constexpr auto value = N0 + sum::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template - using member = typename T::member_type; - - template - void func(...) {} - - template - void func(member*) {} - - void test(); - - void test() { func(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_separators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same::value, ""); - static_assert(is_same::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) - - -dnl Tests for new features in C++17 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ - -// If the compiler admits that it is not ready for C++17, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201703L - -#error "This is not a C++17 compiler" - -#else - -#include -#include -#include - -namespace cxx17 -{ - - namespace test_constexpr_lambdas - { - - constexpr int foo = [](){return 42;}(); - - } - - namespace test::nested_namespace::definitions - { - - } - - namespace test_fold_expression - { - - template - int multiply(Args... args) - { - return (args * ... * 1); - } - - template - bool all(Args... args) - { - return (args && ...); - } - - } - - namespace test_extended_static_assert - { - - static_assert (true); - - } - - namespace test_auto_brace_init_list - { - - auto foo = {5}; - auto bar {5}; - - static_assert(std::is_same, decltype(foo)>::value); - static_assert(std::is_same::value); - } - - namespace test_typename_in_template_template_parameter - { - - template typename X> struct D; - - } - - namespace test_fallthrough_nodiscard_maybe_unused_attributes - { - - int f1() - { - return 42; - } - - [[nodiscard]] int f2() - { - [[maybe_unused]] auto unused = f1(); - - switch (f1()) - { - case 17: - f1(); - [[fallthrough]]; - case 42: - f1(); - } - return f1(); - } - - } - - namespace test_extended_aggregate_initialization - { - - struct base1 - { - int b1, b2 = 42; - }; - - struct base2 - { - base2() { - b3 = 42; - } - int b3; - }; - - struct derived : base1, base2 - { - int d; - }; - - derived d1 {{1, 2}, {}, 4}; // full initialization - derived d2 {{}, {}, 4}; // value-initialized bases - - } - - namespace test_general_range_based_for_loop - { - - struct iter - { - int i; - - int& operator* () - { - return i; - } - - const int& operator* () const - { - return i; - } - - iter& operator++() - { - ++i; - return *this; - } - }; - - struct sentinel - { - int i; - }; - - bool operator== (const iter& i, const sentinel& s) - { - return i.i == s.i; - } - - bool operator!= (const iter& i, const sentinel& s) - { - return !(i == s); - } - - struct range - { - iter begin() const - { - return {0}; - } - - sentinel end() const - { - return {5}; - } - }; - - void f() - { - range r {}; - - for (auto i : r) - { - [[maybe_unused]] auto v = i; - } - } - - } - - namespace test_lambda_capture_asterisk_this_by_value - { - - struct t - { - int i; - int foo() - { - return [*this]() - { - return i; - }(); - } - }; - - } - - namespace test_enum_class_construction - { - - enum class byte : unsigned char - {}; - - byte foo {42}; - - } - - namespace test_constexpr_if - { - - template - int f () - { - if constexpr(cond) - { - return 13; - } - else - { - return 42; - } - } - - } - - namespace test_selection_statement_with_initializer - { - - int f() - { - return 13; - } - - int f2() - { - if (auto i = f(); i > 0) - { - return 3; - } - - switch (auto i = f(); i + 4) - { - case 17: - return 2; - - default: - return 1; - } - } - - } - - namespace test_template_argument_deduction_for_class_templates - { - - template - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - - } - - namespace test_non_type_auto_template_parameters - { - - template - struct B - {}; - - B<5> b1; - B<'a'> b2; - - } - - namespace test_structured_bindings - { - - int arr[2] = { 1, 2 }; - std::pair pr = { 1, 2 }; - - auto f1() -> int(&)[2] - { - return arr; - } - - auto f2() -> std::pair& - { - return pr; - } - - struct S - { - int x1 : 2; - volatile double y1; - }; - - S f3() - { - return {}; - } - - auto [ x1, y1 ] = f1(); - auto& [ xr1, yr1 ] = f1(); - auto [ x2, y2 ] = f2(); - auto& [ xr2, yr2 ] = f2(); - const auto [ x3, y3 ] = f3(); - - } - - namespace test_exception_spec_type_system - { - - struct Good {}; - struct Bad {}; - - void g1() noexcept; - void g2(); - - template - Bad - f(T*, T*); - - template - Good - f(T1*, T2*); - - static_assert (std::is_same_v); - - } - - namespace test_inline_variables - { - - template void f(T) - {} - - template inline T g(T) - { - return T{}; - } - - template<> inline void f<>(int) - {} - - template<> int g<>(int) - { - return 5; - } - - } - -} // namespace cxx17 - -#endif // __cplusplus < 201703L - -]]) - - -dnl Tests for new features in C++20 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 202002L - -#error "This is not a C++20 compiler" - -#else - -#include - -namespace cxx20 -{ - -// As C++20 supports feature test macros in the standard, there is no -// immediate need to actually test for feature availability on the -// Autoconf side. - -} // namespace cxx20 - -#endif // __cplusplus < 202002L - -]]) diff --git a/build-aux/m4/ax_pthread.m4 b/build-aux/m4/ax_pthread.m4 deleted file mode 100644 index 9f35d1391..000000000 --- a/build-aux/m4/ax_pthread.m4 +++ /dev/null @@ -1,522 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_pthread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. It -# sets the PTHREAD_LIBS output variable to the threads library and linker -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler -# flags that are needed. (The user can also force certain compiler -# flags/libs to be tested by setting these environment variables.) -# -# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is -# needed for multi-threaded programs (defaults to the value of CC -# respectively CXX otherwise). (This is necessary on e.g. AIX to use the -# special cc_r/CC_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also to link with them as well. For example, you might link with -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# -# If you are only building threaded programs, you may wish to use these -# variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# CXX="$PTHREAD_CXX" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to -# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with -# PTHREAD_CFLAGS. -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or if -# you have any other suggestions or comments. This macro was based on work -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by -# Alejandro Forero Cuervo to the autoconf macro repository. We are also -# grateful for the helpful feedback of numerous users. -# -# Updated for Autoconf 2.68 by Daniel Richard G. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2011 Daniel Richard G. -# Copyright (c) 2019 Marc Stevens -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 31 - -AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) -AC_DEFUN([AX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_SED]) -AC_LANG_PUSH([C]) -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on Tru64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then - ax_pthread_save_CC="$CC" - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) - AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"]) - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = "xno"; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - CC="$ax_pthread_save_CC" - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items with a "," contain both -# C compiler flags (before ",") and linker flags (after ","). Other items -# starting with a "-" are C compiler flags, and remaining items are -# library names, except for "none" which indicates that we try without -# any flags at all, and "pthread-config" which is a program returning -# the flags for the Pth emulation library. - -ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 -# (Note: HP C rejects this with "bad form for `-t' option") -# -pthreads: Solaris/gcc (Note: HP C also rejects) -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads and -# -D_REENTRANT too), HP C (must be checked before -lpthread, which -# is present but should not be used directly; and before -mthreads, -# because the compiler interprets this as "-mt" + "-hreads") -# -mthreads: Mingw32/gcc, Lynx/gcc -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case $host_os in - - freebsd*) - - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - - ax_pthread_flags="-kthread lthread $ax_pthread_flags" - ;; - - hpux*) - - # From the cc(1) man page: "[-mt] Sets various -D flags to enable - # multi-threading and also sets -lpthread." - - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" - ;; - - openedition*) - - # IBM z/OS requires a feature-test macro to be defined in order to - # enable POSIX threads at all, so give the user a hint if this is - # not set. (We don't define these ourselves, as they can affect - # other portions of the system API in unpredictable ways.) - - AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], - [ -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) - AX_PTHREAD_ZOS_MISSING -# endif - ], - [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) - ;; - - solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (N.B.: The stubs are missing - # pthread_cleanup_push, or rather a function called by this macro, - # so we could check for that, but who knows whether they'll stub - # that too in a future libc.) So we'll check first for the - # standard Solaris way of linking pthreads (-mt -lpthread). - - ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" - ;; -esac - -# Are we compiling with Clang? - -AC_CACHE_CHECK([whether $CC is Clang], - [ax_cv_PTHREAD_CLANG], - [ax_cv_PTHREAD_CLANG=no - # Note that Autoconf sets GCC=yes for Clang as well as GCC - if test "x$GCC" = "xyes"; then - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - ], - [ax_cv_PTHREAD_CLANG=yes]) - fi - ]) -ax_pthread_clang="$ax_cv_PTHREAD_CLANG" - - -# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) - -# Note that for GCC and Clang -pthread generally implies -lpthread, -# except when -nostdlib is passed. -# This is problematic using libtool to build C++ shared libraries with pthread: -# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 -# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 -# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 -# To solve this, first try -pthread together with -lpthread for GCC - -AS_IF([test "x$GCC" = "xyes"], - [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"]) - -# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first - -AS_IF([test "x$ax_pthread_clang" = "xyes"], - [ax_pthread_flags="-pthread,-lpthread -pthread"]) - - -# The presence of a feature test macro requesting re-entrant function -# definitions is, on some systems, a strong hint that pthreads support is -# correctly enabled - -case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) - ax_pthread_check_macro="_REENTRANT" - ;; - - aix*) - ax_pthread_check_macro="_THREAD_SAFE" - ;; - - *) - ax_pthread_check_macro="--" - ;; -esac -AS_IF([test "x$ax_pthread_check_macro" = "x--"], - [ax_pthread_check_cond=0], - [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) - - -if test "x$ax_pthread_ok" = "xno"; then -for ax_pthread_try_flag in $ax_pthread_flags; do - - case $ax_pthread_try_flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - *,*) - PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` - PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` - AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; - - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac - - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void *some_global = NULL; - static void routine(void *a) - { - /* To avoid any unused-parameter or - unused-but-set-parameter warning. */ - some_global = a; - } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - AC_MSG_RESULT([$ax_pthread_ok]) - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - - -# Clang needs special handling, because older versions handle the -pthread -# option in a rather... idiosyncratic way - -if test "x$ax_pthread_clang" = "xyes"; then - - # Clang takes -pthread; it has never supported any other flag - - # (Note 1: This will need to be revisited if a system that Clang - # supports has POSIX threads in a separate library. This tends not - # to be the way of modern systems, but it's conceivable.) - - # (Note 2: On some systems, notably Darwin, -pthread is not needed - # to get POSIX threads support; the API is always present and - # active. We could reasonably leave PTHREAD_CFLAGS empty. But - # -pthread does define _REENTRANT, and while the Darwin headers - # ignore this macro, third-party headers might not.) - - # However, older versions of Clang make a point of warning the user - # that, in an invocation where only linking and no compilation is - # taking place, the -pthread option has no effect ("argument unused - # during compilation"). They expect -pthread to be passed in only - # when source code is being compiled. - # - # Problem is, this is at odds with the way Automake and most other - # C build frameworks function, which is that the same flags used in - # compilation (CFLAGS) are also used in linking. Many systems - # supported by AX_PTHREAD require exactly this for POSIX threads - # support, and in fact it is often not straightforward to specify a - # flag that is used only in the compilation phase and not in - # linking. Such a scenario is extremely rare in practice. - # - # Even though use of the -pthread flag in linking would only print - # a warning, this can be a nuisance for well-run software projects - # that build with -Werror. So if the active version of Clang has - # this misfeature, we search for an option to squash it. - - AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown - # Create an alternate version of $ac_link that compiles and - # links in two steps (.c -> .o, .o -> exe) instead of one - # (.c -> exe), because the warning occurs only in the second - # step - ax_pthread_save_ac_link="$ac_link" - ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' - ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"` - ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [break]) - ]) - done - ac_link="$ax_pthread_save_ac_link" - CFLAGS="$ax_pthread_save_CFLAGS" - AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ]) - - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in - no | unknown) ;; - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; - esac - -fi # $ax_pthread_clang = yes - - - -# Various other checks: -if test "x$ax_pthread_ok" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_CACHE_CHECK([for joinable pthread attribute], - [ax_cv_PTHREAD_JOINABLE_ATTR], - [ax_cv_PTHREAD_JOINABLE_ATTR=unknown - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $ax_pthread_attr; return attr /* ; */])], - [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], - []) - done - ]) - AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ - test "x$ax_pthread_joinable_attr_defined" != "xyes"], - [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], - [$ax_cv_PTHREAD_JOINABLE_ATTR], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - ax_pthread_joinable_attr_defined=yes - ]) - - AC_CACHE_CHECK([whether more special flags are required for pthreads], - [ax_cv_PTHREAD_SPECIAL_FLAGS], - [ax_cv_PTHREAD_SPECIAL_FLAGS=no - case $host_os in - solaris*) - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - ]) - AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ - test "x$ax_pthread_special_flags_added" != "xyes"], - [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" - ax_pthread_special_flags_added=yes]) - - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT; - return i;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ - test "x$ax_pthread_prio_inherit_defined" != "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) - ax_pthread_prio_inherit_defined=yes - ]) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != "xyes"; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [ - AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"]) - AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])]) - ], - [ - AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC]) - AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])]) - ] - ) - ]) - ;; - esac - fi -fi - -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" -test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" - -AC_SUBST([PTHREAD_LIBS]) -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_CC]) -AC_SUBST([PTHREAD_CXX]) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test "x$ax_pthread_ok" = "xyes"; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : -else - ax_pthread_ok=no - $2 -fi -AC_LANG_POP -])dnl AX_PTHREAD diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 9878a39ec..000000000 --- a/configure.ac +++ /dev/null @@ -1,913 +0,0 @@ -AC_PREREQ([2.60]) -AC_INIT([libdashbls],[2.1]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([build-aux/m4]) - -dnl Unless the user specified ARFLAGS, force it to be cr -AC_ARG_VAR(ARFLAGS, [Flags for the archiver, defaults to if not set]) -if test "x${ARFLAGS+set}" != "xset"; then - ARFLAGS="qc" -fi - -AC_CANONICAL_HOST - -AH_TOP([#ifndef RLC_CONF_H]) -AH_TOP([#define RLC_CONF_H]) -AH_BOTTOM([#endif /*RLC_CONF_H*/]) -AM_INIT_AUTOMAKE([foreign no-define subdir-objects]) - -dnl faketime messes with timestamps and causes configure to be re-run. -dnl --disable-maintainer-mode can be used to bypass this. -AM_MAINTAINER_MODE([enable]) - -dnl make the compilation flags quiet unless V=1 is used -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -dnl Compiler checks (here before libtool). -if test "x${CFLAGS+set}" = "xset"; then - CFLAGS_overridden=yes -else - CFLAGS_overridden=no -fi -if test "x${CXXFLAGS+set}" = "xset"; then - CXXFLAGS_overridden=yes -else - CXXFLAGS_overridden=no -fi - -AC_PROG_CC - -AC_PROG_CXX - -dnl By default, libtool for mingw refuses to link static libs into a dll for -dnl fear of mixing pic/non-pic objects, and import/export complications. Since -dnl we have those under control, re-enable that functionality. -case $host in - *mingw*) - lt_cv_deplibs_check_method="pass_all" - ;; -esac -dnl Require C++14 compiler (no GNU extensions) -AX_CXX_COMPILE_STDCXX([14], [noext], [mandatory], [nodefault]) - -dnl Libtool init checks. -LT_INIT([pic-only]) - -AC_PATH_TOOL(AR, ar) -AC_PATH_TOOL(RANLIB, ranlib) -AC_PATH_TOOL(STRIP, strip) - -AM_PROG_AS - -AC_ARG_ENABLE([tests], - [AS_HELP_STRING([--enable-tests], - [Compile with tests [default=yes]])], - [use_tests=$enableval], - [use_tests=yes]) - -AC_ARG_ENABLE([bench], - [AS_HELP_STRING([--enable-bench], - [Compile with benchmarks [default=yes]])], - [use_bench=$enableval], - [use_bench=yes]) - -AC_ARG_ENABLE([hardening], - [AS_HELP_STRING([--enable-hardening], - [Enable hardening flags and arguments [default=auto]])], - [use_hardening=$enableval], - [use_hardening=auto]) - -AC_ARG_ENABLE([optimizations], - [AS_HELP_STRING([--enable-optimizations], - [Enable compiler and library optimizations [default=yes]])], - [use_optimizations=$enableval], - [use_optimizations=yes]) - -AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug], - [Build with debugging support [default=no]])], - [use_debug=$enableval], - [use_debug=no]) - -AC_LANG_PUSH([C]) - -dnl Check for a flag to turn compiler warnings into errors. This is helpful for checks which may -dnl appear to succeed because by default they merely emit warnings when they fail. -dnl -dnl Note that this is not necessarily a check to see if -Werror is supported, but rather to see if -dnl a compile with -Werror can succeed. This is important because the compiler may already be -dnl warning about something unrelated, for example about some path issue. If that is the case, -dnl -Werror cannot be used because all of those warnings would be turned into errors. -AX_CHECK_COMPILE_FLAG([-Werror], [FLAG_WERROR="-Werror"], [FLAG_WERROR=""]) - -if test x"$use_debug" = x"yes" -o x"$use_optimizations" = x"no"; then - dnl Clear default -g -O2 flags - if test x"$CFLAGS_overridden" = x"no"; then - CFLAGS="" - fi - if test x"$CXXFLAGS_overridden" = x"no"; then - CXXFLAGS="" - fi - - dnl Disable optimizations - AX_CHECK_COMPILE_FLAG([-O0], [[DEBUG_FLAGS="$DEBUG_FLAGS -O0"]], [], [[$FLAG_WERROR]]) - - if test x"$use_debug" = x"yes"; then - dnl Prefer -g3, fall back to -g if that is unavailable. - AX_CHECK_COMPILE_FLAG( - [-g3], - [[DEBUG_FLAGS="$DEBUG_FLAGS -g3"]], - [AX_CHECK_COMPILE_FLAG([-g],[[DEBUG_FLAGS="$DEBUG_FLAGS -g"]])], [[$FLAG_WERROR]]) - - AX_CHECK_COMPILE_FLAG([-ftrapv],[DEBUG_FLAGS="$DEBUG_FLAGS -ftrapv"], [], [[$FLAG_WERROR]]) - else - dnl Reintroduce -g flag deleted during C(XX)FLAGS reset - AX_CHECK_COMPILE_FLAG([-g],[[DEBUG_FLAGS="$DEBUG_FLAGS -g"]], [], [[$FLAG_WERROR]]) - - dnl -ftrapv and -fwrapv conflict, so we only set this if use_debug=no - AX_CHECK_COMPILE_FLAG([-fwrapv],[DEBUG_FLAGS="$DEBUG_FLAGS -fwrapv"], [], [[$FLAG_WERROR]]) - fi -fi - -dnl Define enum mappings for relic config -AC_DEFINE([RLC_VERSION], ["0.5.0"], [Relic Version]) - -dnl dashbls: Library processor architecture -AC_DEFINE([AVR], [1], [Atmel AVR ATMega128 8-bit architecture.]) -AC_DEFINE([MSP], [2], [MSP430 16-bit architecture.]) -AC_DEFINE([ARM], [3], [ARM 32-bit architecture.]) -AC_DEFINE([X86], [4], [Intel x86-compatible 32-bit architecture.]) -AC_DEFINE([X64], [5], [AMD64-compatible 64-bit architecture.]) - -dnl Relic: Generic options -AC_DEFINE([RELIC_NONE], [0], [Unknown or unrecognized parameter.]) - -dnl Relic: Arithmetic backends -AC_DEFINE([EASY], [1], [Easy C-only backend.]) -AC_DEFINE([GMP], [2], [Backend based on GNU Multiple Precision library.]) -AC_DEFINE([GMP_SEC], [3], [Backend based on GNU Multiple Precision library, but using constant-time code.]) - -AC_DEFUN([GMP_CHECK],[ - AC_REQUIRE([AC_PROG_CC]) - - CPPFLAGS_TEMP="$CPPFLAGS" - CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS" - LIBS_TEMP="$LIBS" - LIBS="$GMP_LDFLAGS $LIBS" - - AC_CHECK_HEADER( - gmp.h, - [AC_CHECK_LIB(gmp, __gmpz_init, [], [gmp_fail_reason="libgmp not found or unusable"; has_gmp=no;])], - [gmp_fail_reason="gmp header not found"; has_gmp=no;] - ) - - if test x"$has_gmp" != x"no"; then - # Proper support for macOS aarch64 was introduced in 6.3.0, but LTS distros - # like Ubuntu 20.04 (focal) use 6.2.0, so, the minimum supported version is - # determined by platform and architecture. - case $host in - *darwin*) - case $host_cpu in - aarch*) - gmp_major_version=6 - gmp_minor_version=3 - ;; - esac - ;; - *) - gmp_major_version=6 - gmp_minor_version=2 - ;; - esac - AC_MSG_CHECKING([gmp version >= $gmp_major_version.$gmp_minor_version]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include ]], - [[ - @%:@if __GNU_MP_VERSION < $gmp_major_version || __GNU_MP_VERSION_MINOR < $gmp_minor_version - @%:@error Unsupported GMP version - @%:@endif]])], - [AC_MSG_RESULT([yes]); GMP_LIBS="-lgmp"; has_gmp=yes;], - [AC_MSG_RESULT([no]); gmp_fail_reason="unsupported gmp version"; has_gmp=no;] - ) - fi - - if test x"$want_backend" = x"gmp" && test x"$has_gmp" = x"no"; then - AC_MSG_ERROR([$gmp_fail_reason]) - fi - - CPPFLAGS="$CPPFLAGS_TEMP" - LIBS="$LIBS_TEMP" -]) - -AC_ARG_WITH([backend], - [AS_HELP_STRING([--with-backend=auto|easy|gmp], - [backend implementation to use [default=auto]])], - [want_backend=$withval], - [want_backend=auto] -) - -case $host in - *darwin*) - AC_PATH_PROG([BREW],brew,) - if test x$BREW != x; then - # These Homebrew packages may be keg-only, meaning that they won't be found - # in expected paths because they may conflict with system files. Ask - # Homebrew where each one is located, then adjust paths accordingly. - gmp_prefix=`$BREW --prefix gmp 2>/dev/null` - if test x$gmp_prefix != x; then - GMP_CPPFLAGS="-I$gmp_prefix/include" - GMP_LDFLAGS="-L$gmp_prefix/lib" - fi - fi - ;; - *freebsd*) - GMP_CPPFLAGS="-I/usr/local/include" - GMP_LDFLAGS="-L/usr/local/lib" - ;; -esac - -if test x"$want_backend" = x"auto"; then - if test x"$use_optimizations" = x"no"; then - want_backend=easy - else - GMP_CHECK - if test x"$has_gmp" = x"yes"; then - want_backend=gmp - else - want_backend=easy - fi - fi -else - case $want_backend in - gmp) - dnl GMP_CHECK will report the reason if and why the backend cannot be used. - GMP_CHECK - ;; - easy) - ;; - *) - AC_MSG_ERROR([invalid backend explicitly requested]) - ;; - esac -fi - -case $want_backend in -gmp) - AC_DEFINE(ARITH, GMP, [Define if GNU MP backend is requested]) - ;; -easy) - AC_DEFINE(ARITH, EASY, [Define if C-only backend is requested].) - ;; -*) - AC_MSG_ERROR([invalid backend explicitly requested]) - ;; -esac - -dnl Relic: Multithreading APIs -AC_DEFINE([OPENMP], [1], [OpenMP multithreading support.]) -AC_DEFINE([PTHREAD], [2], [POSIX multithreading support.]) - -dnl Relic: Supported operating systems -AC_DEFINE([LINUX], [1], [GNU/Linux operating system.]) -AC_DEFINE([FREEBSD], [2], [FreeBSD operating system.]) -AC_DEFINE([MACOSX], [3], [MacOS operating system.]) -AC_DEFINE([WINDOWS], [4], [Windows operating system.]) -AC_DEFINE([DROID], [5], [Android operating system.]) -AC_DEFINE([DUINO], [6], [Arduino platform.]) -dnl AC_DEFINE([OPENBSD], [7], [OpenBSD operating system.]) - -dnl Relic: Supported timers -AC_DEFINE([HREAL], [1], [Per-process high-resolution timer.]) -AC_DEFINE([HPROC], [2], [Per-process high-resolution timer.]) -AC_DEFINE([HTHRD], [3], [Per-thread high-resolution timer.]) -AC_DEFINE([ANSI], [5], [ANSI-compatible timer.]) -AC_DEFINE([POSIX], [4], [POSIX-compatible timer.]) -AC_DEFINE([CYCLE], [6], [Cycle-counting timer.]) -AC_DEFINE([PERF], [7], [Performance monitoring framework.]) - -dnl Relic: Memory-allocation policies -AC_DEFINE([AUTO], [1], [Automatic memory allocation.]) -AC_DEFINE([DYNAMIC], [2], [Dynamic memory allocation.]) - -dnl Relic (CP): Support for faster CRT-based exponentiation in factoring-based cryptosystems -AC_DEFINE([PKCS1], [2], [RSA PKCS#1 v1.5 padding.]) -AC_DEFINE([PKCS2], [3], [RSA PKCS#1 v2.1 padding.]) - -dnl Relic (MD): Available hash functions -AC_DEFINE([SH224], [2], [SHA-224 hash function.]) -AC_DEFINE([SH256], [3], [SHA-256 hash function.]) -AC_DEFINE([SH384], [4], [SHA-384 hash function.]) -AC_DEFINE([SH512], [5], [SHA-512 hash function.]) -AC_DEFINE([B2S160], [6], [BLAKE2s-160 hash function.]) -AC_DEFINE([B2S256], [7], [BLAKE2s-256 hash function.]) - -dnl Relic (RAND): Available pseudo-random number generators -AC_DEFINE([HASHD], [1], [NIST HASH-DRBG generator.]) -AC_DEFINE([RDRND], [2], [Intel RdRand instruction.]) -AC_DEFINE([UDEV], [3], [Operating system underlying generator.]) -AC_DEFINE([CALL], [4], [Override library generator with the callback.]) - -dnl Relic (RAND): Available random number generator seeders -AC_DEFINE([LIBC], [1], [Standard C library generator.]) -dnl AC_DEFINE([RDRND], [2], [Intel RdRand instruction.]) -dnl AC_DEFINE([UDEV], [3], [Operating system underlying generator.]) -AC_DEFINE([WCGR], [4], [Use Windows' CryptGenRandom.]) - -dnl Relic (BN): Options for the multiple precision -AC_DEFINE([SINGLE], [1], [A multiple precision integer can store w words.]) -AC_DEFINE([CARRY], [2], [A multiple precision integer can store the result of an addition.]) -AC_DEFINE([DOUBLE], [3], [A multiple precision integer can store the result of a multiplication.]) - -AC_DEFINE([BASIC], [1], [Basic method.]) -AC_DEFINE([PRIME], [1], [Prime curves.]) -AC_DEFINE([TATEP], [1], [Tate pairing.]) -AC_DEFINE([COMBA], [2], [Comba method.]) -AC_DEFINE([LEHME], [2], [Lehmer's fast GCD Algorithm.]) -AC_DEFINE([SAFEP], [2], [Safe prime generation.]) -AC_DEFINE([QUICK], [2], [Fast reduction modulo special form prime.]) -AC_DEFINE([BINAR], [2], [Binary inversion.]) -AC_DEFINE([LAZYR], [2], [Lazy-reduced extension field arithmetic.]) -AC_DEFINE([LODAH], [2], [Lopez-Dahab multiplication.]) -AC_DEFINE([SLIDE], [2], [Sliding window modular exponentiation.]) -AC_DEFINE([PROJC], [2], [Projective coordinates.]) -AC_DEFINE([COMBS], [2], [Single-table comb method.]) -AC_DEFINE([TRICK], [2], [Shamir's trick.]) -AC_DEFINE([CHAR2], [2], [Binary curves.]) -AC_DEFINE([WEILP], [2], [Weil pairing.]) -AC_DEFINE([MONTY], [3], [Montgomery method.]) -AC_DEFINE([STEIN], [3], [Stein's binary GCD Algorithm.]) -AC_DEFINE([STRON], [3], [Strong prime generation.]) -AC_DEFINE([INTEG], [3], [Integrated modular addtion.]) -AC_DEFINE([INTER], [3], [Interleaving of w-(T)NAFs.]) -AC_DEFINE([ALMOS], [3], [Almost inverse algorithm.]) -AC_DEFINE([JACOB], [3], [Jacobian coordinates.]) -AC_DEFINE([COMBD], [3], [Double-table comb method.]) -AC_DEFINE([HALVE], [3], [Halving.]) -AC_DEFINE([EDDIE], [3], [Edwards curves.]) -AC_DEFINE([EXTND], [3], [Extended projective twisted Edwards coordinates.]) -AC_DEFINE([OATEP], [3], [Optimal ate pairing.]) -AC_DEFINE([PMERS], [4], [Pseudo-Mersenne method.]) -AC_DEFINE([MULTP], [4], [Reuse multiplication for squaring.]) -AC_DEFINE([EXGCD], [4], [Extended Euclidean algorithm.]) -AC_DEFINE([LWNAF], [4], [Left-to-right Width-w NAF.]) -AC_DEFINE([JOINT], [4], [Joint sparse form.]) -AC_DEFINE([DIVST], [5], [Constant-time inversion by Bernstein-Yang division steps.]) -AC_DEFINE([ITOHT], [5], [Itoh-Tsuji inversion.]) -AC_DEFINE([LWREG], [5], [Left-to-right Width-w NAF.]) -AC_DEFINE([BRUCH], [6], [Hardware-friendly inversion by Brunner-Curiger-Hofstetter.]) -AC_DEFINE([CTAIA], [7], [Constant-time version of almost inverse.]) -AC_DEFINE([LOWER], [8], [Use implementation provided by the lower layer.]) - -if test x"$use_debug" = x"yes"; then - AC_DEFINE([DEBUG], [1], [Define this symbol if debugging support is enabled]) -fi - -dnl Define relic switches -AC_ARG_ENABLE([profiling], - [AS_HELP_STRING([--enable-profiling], - [Build with profiling support [default=no]])], - [use_profiling=$enableval], - [use_profiling=no]) - -if test x$use_profiling = xyes; then - AC_DEFINE([PROFL], [1], [Define this symbol if profiling support is enabled]) -fi - -AC_ARG_ENABLE([check], - [AS_HELP_STRING([--enable-check], - [Build with error-checking support [default=no]])], - [use_check=$enableval], - [use_check=no]) - -if test x$use_check = xyes; then - AC_DEFINE([CHECK], [1], [Define this symbol if error-checking support is enabled]) -fi - -AC_ARG_ENABLE([verbs], - [AS_HELP_STRING([--enable-verbs], - [Build with detailed error messages [default=no]])], - [use_verbs=$enableval], - [use_verbs=no]) - -if test x$use_verbs = xyes; then - AC_DEFINE([VERBS], [1], [Define this symbol if detailed error messages are enabled]) -fi - -AC_ARG_ENABLE([overhead], - [AS_HELP_STRING([--enable-overhead], - [Build with overhead estimation [default=no]])], - [use_overhead=$enableval], - [use_overhead=no]) - -if test x$use_overhead = xyes; then - AC_DEFINE([OVERH], [1], [Define this symbol if overhead estimation is enabled]) -fi - -AC_ARG_ENABLE([quiet], - [AS_HELP_STRING([--enable-quiet], - [Build with printing disabled [default=yes]])], - [use_quiet=$enableval], - [use_quiet=yes]) - -if test x$use_quiet = xyes; then - AC_DEFINE([QUIET], [1], [Define this symbol if printing is disabled]) -fi - -AC_ARG_ENABLE([color], - [AS_HELP_STRING([--enable-color], - [Build with colored output support [default=yes]])], - [use_color=$enableval], - [use_color=yes]) - -if test x$use_color = xyes; then - AC_DEFINE([COLOR], [1], [Define this symbol if colored output is enabled]) -fi - -AC_ARG_ENABLE([big_endian], - [AS_HELP_STRING([--enable-big-endian], - [Build with big-endian support [default=no]])], - [use_big_endian=$enableval], - [use_big_endian=no]) - -if test x$use_big_endian = xyes; then - AC_DEFINE([BIGED], [1], [Define this symbol if big-endian support is enabled]) -fi - -use_pkgconfig=yes - -if test x"$use_optimizations" = x"yes"; then - case $host_cpu in - amd64 | x86_64) - dnl Support for AMD64 (also known as x86_64 on some platforms) processors - CPU_ARCH="x64" - AC_DEFINE([ARCH], [X64], [Architecture.]) - AC_DEFINE([WSIZE], [64], [Size of word in this architecture.]) - ;; - aarch*) - dnl Support for 64-bit ARM processors - dnl Relic does not support aarch64 yet, set CPU_ARCH to none and ARCH to RELIC_NONE. - CPU_ARCH="none" - AC_DEFINE([ARCH], [RELIC_NONE], [Architecture.]) - AC_DEFINE([WSIZE], [64], [Size of word in this architecture.]) - ;; - i?86) - dnl Support for Intel x86 processors - CPU_ARCH="x86" - AC_DEFINE([ARCH], [X86], [Architecture.]) - AC_DEFINE([WSIZE], [32], [Size of word in this architecture.]) - ;; - arm*) - dnl Support for 32-bit native ARM processors - CPU_ARCH="arm" - AC_DEFINE([ARCH], [ARM], [Architecture.]) - AC_DEFINE([WSIZE], [32], [Size of word in this architecture.]) - ;; - *64*) - dnl Support for an undefined 64-bit architecture - CPU_ARCH="none" - AC_DEFINE([ARCH], [RELIC_NONE], [Architecture.]) - AC_DEFINE([WSIZE], [64], [Size of word in this architecture.]) - ;; - *32*) - dnl Support for an undefined 32-bit architecture - CPU_ARCH="none" - AC_DEFINE([ARCH], [RELIC_NONE], [Architecture.]) - AC_DEFINE([WSIZE], [32], [Size of word in this architecture.]) - ;; - *) - AC_MSG_ERROR([Unable to determine host architecture, may not be supported!]) - ;; - esac -else - case $host_cpu in - *64*) - dnl Support for an undefined 64-bit architecture - CPU_ARCH="none" - AC_DEFINE([ARCH], [RELIC_NONE], [Architecture.]) - AC_DEFINE([WSIZE], [64], [Size of word in this architecture.]) - ;; - *32* | arm* | i?86) - dnl Support for an undefined 32-bit architecture - CPU_ARCH="none" - AC_DEFINE([ARCH], [RELIC_NONE], [Architecture.]) - AC_DEFINE([WSIZE], [32], [Size of word in this architecture.]) - ;; - *) - AC_MSG_ERROR([Unable to determine host architecture, may not be supported!]) - ;; - esac -fi - -case $host in - *darwin*) - AC_DEFINE([OPSYS], [MACOSX], [Detected operation system.]) - TARGET_OS=darwin - - AC_PATH_PROG([BREW],brew,) - if test x$BREW = x; then - AC_PATH_PROG([PORT],port,) - # If homebrew isn't installed and macports is, add the macports default paths - # as a last resort. - if test x$PORT != x; then - CPPFLAGS="$CPPFLAGS -isystem /opt/local/include" - LDFLAGS="$LDFLAGS -L/opt/local/lib" - fi - fi - ;; - *mingw*) - AC_DEFINE([OPSYS], [WINDOWS], [Detected operation system.]) - TARGET_OS=windows - - use_pkgconfig=no - LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static" - - dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against. - dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override - dnl its command here, with the predeps/postdeps removed, and -static inserted. Postdeps are - dnl also overridden to prevent their insertion later. - dnl This should only affect dll's. - archive_cmds_CXX="\$CC -shared \$libobjs \$deplibs \$compiler_flags -static -o \$output_objdir/\$soname \${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib" - postdeps_CXX= - ;; - *linux*) - AC_DEFINE([OPSYS], [LINUX], [Detected operation system.]) - TARGET_OS=linux - - RELIC_CPPFLAGS="-D_GNU_SOURCE" - ;; - *android*) - AC_DEFINE([OPSYS], [DROID], [Detected operation system.]) - TARGET_OS=android - ;; - *freebsd*) - AC_DEFINE([OPSYS], [FREEBSD], [Detected operation system.]) - TARGET_OS=freebsd - ;; - *netbsd*) - AC_DEFINE([OPSYS], [NETBSD], [Detected operation system.]) - TARGET_OS=netbsd - ;; - *) - AC_DEFINE([OPSYS], [RELIC_NONE], [Detected operation system.]) - ;; -esac - -case $host in - *darwin*) - dnl Relic: Don't define FP_QNRES on Darwin - AC_DEFINE([SEED], [UDEV], [Chosen random generator seeder.]) - ;; - *mingw*) - AC_DEFINE([FP_QNRES], [], [Use -1 as quadratic non-residue.]) - AC_DEFINE([SEED], [WCGR], [Chosen random generator seeder.]) - ;; - *) - AC_DEFINE([FP_QNRES], [], [Use -1 as quadratic non-residue.]) - AC_DEFINE([SEED], [UDEV], [Chosen random generator seeder.]) - ;; -esac - -if test x$use_pkgconfig = xyes; then - m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)]) - m4_ifdef([PKG_PROG_PKG_CONFIG], [ - PKG_PROG_PKG_CONFIG - if test x"$PKG_CONFIG" = "x"; then - AC_MSG_ERROR(pkg-config not found.) - fi - ]) -fi - -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -pipe" -AC_MSG_CHECKING([if ${CC} supports -pipe]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$saved_CFLAGS" - ]) - -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -fomit-frame-pointer" -AC_MSG_CHECKING([if ${CC} supports -fomit-frame-pointer]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$saved_CFLAGS" - ]) - -if test x"$CFLAGS_overridden" = x"no" -a x"$CXXFLAGS_overridden" = x"no"; then - dnl Enable warnings - AX_CHECK_COMPILE_FLAG([-Wall],[WARN_FLAGS="$WARN_FLAGS -Wall"], [], [[$FLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wcast-align],[WARN_FLAGS="$WARN_FLAGS -Wcast-align"], [], [[$FLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wextra],[WARN_FLAGS="$WARN_FLAGS -Wextra"], [], [[$FLAG_WERROR]]) - - dnl Exclude known warnings - AX_CHECK_COMPILE_FLAG([-Wlong-long],[NOWARN_FLAGS="$NOWARN_FLAGS -Wno-long-long"], [], [[$FLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wshadow],[NOWARN_FLAGS="$NOWARN_FLAGS -Wno-shadow"], [], [[$FLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wsign-compare],[NOWARN_FLAGS="$NOWARN_FLAGS -Wno-sign-compare"], [], [[$FLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],[NOWARN_FLAGS="$NOWARN_FLAGS -Wno-strict-prototypes"], [], [[$FLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wunused-function],[NOWARN_FLAGS="$NOWARN_FLAGS -Wno-unused-function"], [], [[$FLAG_WERROR]]) - AX_CHECK_COMPILE_FLAG([-Wunused-parameter],[NOWARN_FLAGS="$NOWARN_FLAGS -Wno-unused-parameter"], [], [[$FLAG_WERROR]]) -fi - -dnl set default settings for relic -AC_DEFINE([ALIGN], [1], [Byte boundary to align digit vectors.]) - -AC_DEFINE(WITH_BN,, Build multiple precision integer module.) -AC_DEFINE(WITH_DV,, Temporary double-precision digit vectors.) -AC_DEFINE(WITH_FP,, Build prime field module.) -AC_DEFINE(WITH_FPX,, Build prime field extension module.) -AC_DEFINE(WITH_FB,, Build binary field module.) -AC_DEFINE(WITH_FBX,, Build binary field extension module.) -AC_DEFINE(WITH_EP,, Build prime elliptic curve module.) -AC_DEFINE(WITH_EPX,, Build prime field extension elliptic curve module.) -AC_DEFINE(WITH_EB,, Build binary elliptic curve module.) -AC_DEFINE(WITH_ED,, Build elliptic Edwards curve module.) -AC_DEFINE(WITH_EC,, Build elliptic curve cryptography module.) -AC_DEFINE(WITH_PP,, Build pairings over prime curves module.) -AC_DEFINE(WITH_PC,, Build pairing-based cryptography module.) -AC_DEFINE(WITH_BC,, Build block ciphers.) -AC_DEFINE(WITH_MD,, Build hash functions.) -AC_DEFINE(WITH_CP,, Build cryptographic protocols.) -AC_DEFINE(WITH_MPC,, Build Multi-party computation primitives.) - -AC_DEFINE(BN_PRECI, 1024, Required precision in bits.) -AC_DEFINE(BN_KARAT, 0, Number of Karatsuba steps.) -AC_DEFINE(BN_MAGNI, [DOUBLE], Effective size of a multiple precision integer.) - -AC_DEFINE(BN_METHD, "COMBA;COMBA;MONTY;SLIDE;BASIC;BASIC", Multiple precision arithmetic method.) -AC_DEFINE(BN_MUL, COMBA, Chosen multiple precision multiplication method.) -AC_DEFINE(BN_SQR, COMBA, Chosen multiple precision multiplication method.) -AC_DEFINE(BN_MOD, MONTY, Chosen multiple precision modular reduction method.) -AC_DEFINE(BN_MXP, SLIDE, Chosen multiple precision modular exponentiation method.) -AC_DEFINE(BN_GCD, BASIC, Chosen multiple precision greatest common divisor method.) -AC_DEFINE(BN_GEN, BASIC, Chosen prime generation algorithm.) - -AC_DEFINE(FP_PRIME, 381, Prime field size in bits.) -AC_DEFINE(FP_METHD, "INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE", Prime field arithmetic method.) -AC_DEFINE(FP_KARAT, 0, Number of Karatsuba steps.) -AC_DEFINE(FP_WIDTH, 4, Width of window processing for exponentiation methods.) -AC_DEFINE(FP_ADD, INTEG, Chosen prime field multiplication method.) -AC_DEFINE(FP_MUL, INTEG, Chosen prime field multiplication method.) -AC_DEFINE(FP_SQR, INTEG, Chosen prime field multiplication method.) -AC_DEFINE(FP_RDC, MONTY, Chosen prime field reduction method.) -AC_DEFINE(FP_INV, LOWER, Chosen prime field inversion method.) -AC_DEFINE(FP_EXP, SLIDE, Chosen multiple precision modular exponentiation method.) - -AC_DEFINE(FPX_METHD, "INTEG;INTEG;LAZYR", Prime extension field arithmetic method.) -AC_DEFINE(FPX_QDR, INTEG, Chosen extension field arithmetic method.) -AC_DEFINE(FPX_CBC, INTEG, Chosen extension field arithmetic method.) -AC_DEFINE(FPX_RDC, LAZYR, Chosen extension field arithmetic method.) - -AC_DEFINE(FB_METHD, "LODAH;QUICK;QUICK;QUICK;QUICK;QUICK;EXGCD;SLIDE;QUICK", Binary field arithmetic method) -AC_DEFINE(FB_POLYN, 283, Irreducible polynomial size in bits.) -AC_DEFINE(FB_KARAT, 0, Number of Karatsuba levels.) -AC_DEFINE(FB_TRINO,, Prefer trinomials over pentanomials.) -AC_DEFINE(FB_PRECO,, Precompute multiplication table for sqrt(z).) -AC_DEFINE(FB_WIDTH, 4, Width of window processing for exponentiation methods.) -AC_DEFINE(FB_MUL, LODAH, Chosen binary field multiplication method.) -AC_DEFINE(FB_SQR, QUICK, Chosen binary field squaring method.) -AC_DEFINE(FB_RDC, QUICK, Chosen binary field modular reduction method.) -AC_DEFINE(FB_SRT, QUICK, Chosen binary field modular reduction method.) -AC_DEFINE(FB_TRC, QUICK, Chosen trace computation method.) -AC_DEFINE(FB_SLV, QUICK, Chosen method to solve a quadratic equation.) -AC_DEFINE(FB_INV, EXGCD, Chosen binary field inversion method.) -AC_DEFINE(FB_EXP, SLIDE, Chosen multiple precision modular exponentiation method.) -AC_DEFINE(FB_ITR, QUICK, Chosen method to solve a quadratic equation.) - -AC_DEFINE(EP_METHD, "PROJC;LWNAF;COMBS;INTER", Prime elliptic curve arithmetic method.) -AC_DEFINE(EP_ENDOM,, Support for prime curves with efficient endormorphisms.) -AC_DEFINE(EP_MIXED,, Use mixed coordinates.) -AC_DEFINE(EP_PRECO,, Build precomputation table for generator.) -AC_DEFINE(EP_CTMAP,, Enable isogeny map for SSWU map-to-curve.) -AC_DEFINE(EP_DEPTH, 4, Width of precomputation table for fixed point methods.) -AC_DEFINE(EP_WIDTH, 4, Width of window processing for unknown point methods.) -AC_DEFINE(EP_ADD, PROJC, Chosen prime elliptic curve coordinate method.) -AC_DEFINE(EP_MUL, LWNAF, Chosen prime elliptic curve point multiplication method.) -AC_DEFINE(EP_FIX, COMBS, Chosen prime elliptic curve point multiplication method.) -AC_DEFINE(EP_SIM, INTER, Chosen prime elliptic curve simulteanous point multiplication method.) - -AC_DEFINE(EB_METHD, "PROJC;LWNAF;COMBS;INTER", Binary elliptic curve arithmetic method.) -AC_DEFINE(EB_PLAIN,, Support for ordinary curves without endormorphisms.) -AC_DEFINE(EB_KBLTZ,, Support for Koblitz anomalous binary curves.) -AC_DEFINE(EB_MIXED,, Use mixed coordinates.) -AC_DEFINE(EB_PRECO,, Build precomputation table for generator.) -AC_DEFINE(EB_DEPTH, 4, Width of precomputation table for fixed point methods.) -AC_DEFINE(EB_WIDTH, 4, Width of window processing for unknown point methods.) -AC_DEFINE(EB_ADD, PROJC, Chosen binary elliptic curve coordinate method.) -AC_DEFINE(EB_MUL, LWNAF, Chosen binary elliptic curve point multiplication method.) -AC_DEFINE(EB_FIX, COMBS, Chosen binary elliptic curve point multiplication method.) -AC_DEFINE(EB_SIM, INTER, Chosen binary elliptic curve simulteanous point multiplication method.) - -AC_DEFINE(ED_METHD, "PROJC;LWNAF;COMBS;INTER", Edwards elliptic curve arithmetic method.) -AC_DEFINE(ED_PRECO,, Build precomputation table for generator.) -AC_DEFINE(ED_DEPTH, 4, Width of precomputation table for fixed point methods.) -AC_DEFINE(ED_WIDTH, 4, Width of window processing for unknown point methods.) -AC_DEFINE(ED_ADD, PROJC, Chosen binary elliptic curve coordinate method.) -AC_DEFINE(ED_MUL, LWNAF, Chosen prime elliptic twisted Edwards curve point multiplication method.) -AC_DEFINE(ED_FIX, COMBS, Chosen prime elliptic twisted Edwards curve point multiplication method.) -AC_DEFINE(ED_SIM, INTER, Chosen prime elliptic curve simulteanous point multiplication method.) - -AC_DEFINE(EC_METHD, "PRIME", Chosen elliptic curve cryptography method.) -AC_DEFINE(EC_CUR, PRIME, Chosen elliptic curve type.) - -AC_DEFINE(PP_METHD, "LAZYR;OATEP", Bilinear pairing method.) -AC_DEFINE(PP_EXT, LAZYR, Chosen extension field arithmetic method.) -AC_DEFINE(PP_MAP, OATEP, Chosen pairing method over prime elliptic curves.) - -AC_DEFINE(MD_METHD, "SH256", Choice of hash function.) -AC_DEFINE(MD_MAP, SH256, Chosen hash function.) - -AC_DEFINE(CP_CRT,, Support for faster CRT-based exponentiation in factoring-based cryptosystems.) -AC_DEFINE(CP_RSAPD, PKCS2, Chosen RSA padding method.) - -AC_DEFINE(ALLOC, AUTO, Chosen memory allocation policy.) -AC_DEFINE(RAND, HASHD, Chosen random generator.) -AC_DEFINE(MULTI, PTHREAD, Chosen multithreading API.) -AC_DEFINE(TIMER, CYCLE, Chosen timer.) - -dnl Check for pthread compile/link requirements -AX_PTHREAD - -AC_SEARCH_LIBS([clock_gettime],[rt]) - -if test "$TARGET_OS" != "windows"; then - dnl All windows code is PIC, forcing it on just adds useless compile warnings - AX_CHECK_COMPILE_FLAG([-fPIC], [HARDENED_FLAGS="$HARDENED_FLAGS -fPIC"], [], [[$FLAG_WERROR]]) -fi - -dnl All versions of gcc that we commonly use for building are subject to bug -dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set -dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag) -AX_CHECK_COMPILE_FLAG([-fstack-reuse=none], [HARDENED_FLAGS="$HARDENED_FLAGS -fstack-reuse=none"], [], [[$FLAG_WERROR]]) -if test "$use_hardening" != "no"; then - use_hardening=yes - AX_CHECK_COMPILE_FLAG([-Wstack-protector], [HARDENED_FLAGS="$HARDENED_FLAGS -Wstack-protector"]) - AX_CHECK_COMPILE_FLAG([-fstack-protector-all], [HARDENED_FLAGS="$HARDENED_FLAGS -fstack-protector-all"], [], [[$FLAG_WERROR]]) - - AX_CHECK_COMPILE_FLAG([-fcf-protection=full], [HARDENED_FLAGS="$HARDENED_FLAGS -fcf-protection=full"], [], [[$FLAG_WERROR]]) - - case $host in - *mingw*) - dnl stack-clash-protection doesn't currently work, and likely should just be skipped for Windows. - dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 for more details. - ;; - *) - AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [HARDENED_FLAGS="$HARDENED_FLAGS -fstack-clash-protection"], [], [[$FLAG_WERROR]]) - ;; - esac - - case $host in - *aarch64*) - AX_CHECK_COMPILE_FLAG([-mbranch-protection=bti], [HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -mbranch-protection=bti"], [], [[$CXXFLAG_WERROR]]) - ;; - esac - - AX_CHECK_LINK_FLAG([-Wl,--enable-reloc-section], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--enable-reloc-section"], [], []) - AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"], [], []) - AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"], [], []) - AX_CHECK_LINK_FLAG([-Wl,--high-entropy-va], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"], [], []) - AX_CHECK_LINK_FLAG([-Wl,-z,relro], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"], [], []) - AX_CHECK_LINK_FLAG([-Wl,-z,now], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"], [], []) - AX_CHECK_LINK_FLAG([-Wl,-z,separate-code], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,separate-code"], [], []) - AX_CHECK_LINK_FLAG([-fPIE -pie], [HARDENED_FLAGS="$HARDENED_FLAGS -fPIE"; HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"], [], []) -fi - -CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO" - -case $host in - *mingw*) - AC_CHECK_LIB([user32], [main], [], [AC_MSG_ERROR([libuser32 missing])]) - AC_CHECK_LIB([shell32], [SHGetSpecialFolderPathW], [], [AC_MSG_ERROR([libshell32 missing])]) - AC_CHECK_LIB([advapi32], [CryptAcquireContextW], [], [AC_MSG_ERROR([libadvapi32 missing])]) - AC_CHECK_LIB([psapi], [GetProcessMemoryInfo], [], [AC_MSG_ERROR([libpsapi missing])]) - AC_CHECK_LIB([bcrypt], [main], [], [AC_MSG_ERROR([libbcrypt missing])]) - - dnl -static is interpreted by libtool, where it has a different meaning. - dnl In libtool-speak, it's -all-static. - AX_CHECK_LINK_FLAG([-static], [LIBTOOL_APP_LDFLAGS="$LIBTOOL_APP_LDFLAGS -all-static"]) - - CORE_CPPFLAGS="$CORE_CPPFLAGS -D_MT -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -DWIN32_LEAN_AND_MEAN" - dnl Prevent the definition of min/max macros. - dnl We always want to use the standard library. - CORE_CPPFLAGS="$CORE_CPPFLAGS -DNOMINMAX" - - dnl libtool insists upon adding -nostdlib and a list of objects/libs to link against. - dnl That breaks our ability to build dll's with static libgcc/libstdc++/libssp. Override - dnl its command here, with the predeps/postdeps removed, and -static inserted. Postdeps are - dnl also overridden to prevent their insertion later. - dnl This should only affect dll's. - archive_cmds_CXX="\$CC -shared \$libobjs \$deplibs \$compiler_flags -static -o \$output_objdir/\$soname \${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker \$lib" - postdeps_CXX= - - dnl We require Windows 7 (NT 6.1) or later - AX_CHECK_LINK_FLAG([-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"], [], []) - ;; - *darwin*) - AX_CHECK_LINK_FLAG([-Wl,-headerpad_max_install_names], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-headerpad_max_install_names"], [], []) - CORE_CPPFLAGS="$CORE_CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0" - OBJCXXFLAGS="$CXXFLAGS" - ;; -esac - -dnl These flags are specific to ld64, and may cause issues with other linkers. -dnl For example: GNU ld will interpret -dead_strip as -de and then try and use -dnl "ad_strip" as the symbol for the entry point. -if test "$TARGET_OS" = "darwin"; then - AX_CHECK_LINK_FLAG([-Wl,-dead_strip], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip"], [], []) - AX_CHECK_LINK_FLAG([-Wl,-dead_strip_dylibs], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,-dead_strip_dylibs"], [], []) - AX_CHECK_LINK_FLAG([-Wl,-bind_at_load], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"], [], []) -fi - -dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review. -AX_CHECK_COMPILE_FLAG([-fno-extended-identifiers], [CORE_FLAGS="$CORE_FLAGS -fno-extended-identifiers"], [], [[$FLAG_WERROR]]) - -AC_LANG_POP([C]) - -AC_MSG_CHECKING([whether to build runtest]) -if test x$use_tests = xyes; then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - -AC_MSG_CHECKING([whether to build runbench]) -if test x$use_bench = xyes; then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - -AM_CONDITIONAL([TARGET_DARWIN], [test "$TARGET_OS" = "darwin"]) -AM_CONDITIONAL([TARGET_LINUX], [test "$TARGET_OS" = "linux"]) -AM_CONDITIONAL([TARGET_WINDOWS], [test "$TARGET_OS" = "windows"]) - -AM_CONDITIONAL(WITH_BN, test 1 -eq 1) -AM_CONDITIONAL(WITH_FP, test 1 -eq 1) -AM_CONDITIONAL(WITH_FPX, test 1 -eq 1) -AM_CONDITIONAL(WITH_FB, test 1 -eq 1) -AM_CONDITIONAL(WITH_EP, test 1 -eq 1) -AM_CONDITIONAL(WITH_EPX, test 1 -eq 1) -AM_CONDITIONAL(WITH_EB, test 1 -eq 1) -AM_CONDITIONAL(WITH_ED, test 1 -eq 1) -AM_CONDITIONAL(WITH_EC, test 1 -eq 1) -AM_CONDITIONAL(WITH_PP, test 1 -eq 1) -AM_CONDITIONAL(WITH_PC, test 1 -eq 1) -AM_CONDITIONAL(WITH_BC, test 1 -eq 1) -AM_CONDITIONAL(WITH_MD, test 1 -eq 1) -AM_CONDITIONAL(WITH_CP, test 1 -eq 1) -AM_CONDITIONAL(WITH_MPC, test 1 -eq 1) -AM_CONDITIONAL(WITH_DV, test 1 -eq 1) -AM_CONDITIONAL(WITH_FBX, test 1 -eq 1) - -AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" = x"yes"]) -AM_CONDITIONAL([USE_BENCH], [test x"$use_bench" = x"yes"]) -AM_CONDITIONAL([HARDEN], [test "$use_hardening" = "yes"]) -AM_CONDITIONAL([OPTIMIZE], [test "$use_optimizations" = "yes"]) - -AM_CONDITIONAL([ARITH_EASY], [test "$want_backend" = "easy"]) -AM_CONDITIONAL([ARITH_GMP], [test "$want_backend" = "gmp"]) - -AC_SUBST(CPU_ARCH) -AC_SUBST(DEBUG_FLAGS) -AC_SUBST(RAND_PATH, hashd) -AC_SUBST(RELIC_CPPFLAGS) -AC_SUBST(WARN_FLAGS) -AC_SUBST(NOWARN_FLAGS) -AC_SUBST(LIBTOOL_APP_LDFLAGS) -AC_SUBST(HARDENED_FLAGS) -AC_SUBST(HARDENED_LDFLAGS) -AC_SUBST(CORE_LDFLAGS) -AC_SUBST(CORE_CPPFLAGS) -AC_SUBST(CORE_FLAGS) - -AC_SUBST(GMP_LDFLAGS) -AC_SUBST(GMP_CPPFLAGS) -AC_SUBST(GMP_LIBS) - -AC_CONFIG_HEADERS([depends/relic/include/relic_conf.h]) -AC_CONFIG_FILES([Makefile]) - -AC_OUTPUT - -dnl Peplace conflict-prone PACKAGE-prefixed macros with DASHBLS -sed -i.old 's/PACKAGE/DASHBLS/g' depends/relic/include/relic_conf.h -sed -i.old 's/PACKAGE/DASHBLS/g' config.status - -echo -echo "Options used to compile and link:" -echo " target os = $TARGET_OS" -echo " backend = $want_backend" -echo " build bench = $use_tests" -echo " build test = $use_bench" -echo " use debug = $use_debug" -echo " use hardening = $use_hardening" -echo " use optimizations = $use_optimizations" -echo -echo " LDFLAGS = $HARDENED_LDFLAGS $CORE_LDFLAGS $GMP_LDFLAGS" -echo " CFLAGS = $DEBUG_FLAGS $HARDENED_FLAGS $CORE_FLAGS $WARN_FLAGS $NOWARN_FLAGS" -echo " CPPFLAGS = $CORE_CPPFLAGS $GMP_CPPFLAGS" -echo " CXXFLAGS = $DEBUG_FLAGS $HARDENED_FLAGS $CORE_FLAGS $WARN_FLAGS $NOWARN_FLAGS" -echo " PTHREAD_FLAGS = $PTHREAD_CFLAGS $PTHREAD_LIBS" -echo From 028dd09233ddf56ab7ca0dd4d93e9ba7156162d8 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Wed, 21 Oct 2026 23:43:07 +0700 Subject: [PATCH 2/2] build: drop the libsodium secure allocator No build selects BLSALLOC_SODIUM: CMake compiles with BLSALLOC_MIMALLOC=1 and Dash Core defines no BLSALLOC_* macro, so it already takes the plain malloc/free branch. Remove the sodium branch of BLS::Init(), the Findsodium.cmake module that no CMakeLists references, and the commented-out sodium link lines in the bindings, so the library has no libsodium dependency, optional or otherwise. --- apple.rust.deps.sh | 1 - cmake_modules/Findsodium.cmake | 294 ---------------------------- include/dashbls/util.hpp | 4 +- rust-bindings/bls-dash-sys/build.rs | 10 - src/bls.cpp | 9 - 5 files changed, 2 insertions(+), 316 deletions(-) delete mode 100644 cmake_modules/Findsodium.cmake diff --git a/apple.rust.deps.sh b/apple.rust.deps.sh index b2ebc41a4..01b562cf4 100755 --- a/apple.rust.deps.sh +++ b/apple.rust.deps.sh @@ -362,7 +362,6 @@ build_target() { mkdir -p "build/artefacts/${BUILD_IN}" cp "build/gmplib-${PFX}/lib/libgmp.a" "build/artefacts/${BUILD_IN}" cp "build/relic-${PFX}/depends/relic/lib/librelic_s.a" "build/artefacts/${BUILD_IN}" -# cp "build/relic-${PFX}/depends/sodium/libsodium.a" "build/artefacts/${BUILD_IN}" cp "build/bls-${PFX}/libbls.a" "build/artefacts/${BUILD_IN}" # cp -rf build/bls-"${PFX}"/*.o build/artefacts/"${BUILD_IN}"/include # cp -rf src/*.hpp build/artefacts/"${BUILD_IN}"/include diff --git a/cmake_modules/Findsodium.cmake b/cmake_modules/Findsodium.cmake deleted file mode 100644 index 0350b67fc..000000000 --- a/cmake_modules/Findsodium.cmake +++ /dev/null @@ -1,294 +0,0 @@ -# Written in 2016 by Henrik Steffen Gaßmann -# -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to the -# public domain worldwide. This software is distributed without any warranty. -# -# You should have received a copy of the CC0 Public Domain Dedication -# along with this software. If not, see -# -# http://creativecommons.org/publicdomain/zero/1.0/ -# -######################################################################## -# Tries to find the local libsodium installation. -# -# On Windows the sodium_DIR environment variable is used as a default -# hint which can be overridden by setting the corresponding cmake variable. -# -# Once done the following variables will be defined: -# -# sodium_FOUND -# sodium_INCLUDE_DIR -# sodium_LIBRARY_DEBUG -# sodium_LIBRARY_RELEASE -# -# -# Furthermore an imported "sodium" target is created. -# - -if (CMAKE_C_COMPILER_ID STREQUAL "GNU" - OR CMAKE_C_COMPILER_ID STREQUAL "Clang") - set(_GCC_COMPATIBLE 1) -endif() - -# static library option -if (NOT DEFINED sodium_USE_STATIC_LIBS) - option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF) -endif() -if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST)) - unset(sodium_LIBRARY CACHE) - unset(sodium_LIBRARY_DEBUG CACHE) - unset(sodium_LIBRARY_RELEASE CACHE) - unset(sodium_DLL_DEBUG CACHE) - unset(sodium_DLL_RELEASE CACHE) - set(sodium_USE_STATIC_LIBS_LAST ${sodium_USE_STATIC_LIBS} CACHE INTERNAL "internal change tracking variable") -endif() - - -######################################################################## -# UNIX -if (UNIX) - # import pkg-config - find_package(PkgConfig QUIET) - if (PKG_CONFIG_FOUND) - pkg_check_modules(sodium_PKG QUIET libsodium) - endif() - - if(sodium_USE_STATIC_LIBS) - foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) - if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a - list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") - endif() - endforeach() - list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) - - # if pkgconfig for libsodium doesn't provide - # static lib info, then override PKG_STATIC here.. - if (NOT sodium_PKG_STATIC_FOUND) - set(sodium_PKG_STATIC_LIBRARIES libsodium.a) - endif() - - set(XPREFIX sodium_PKG_STATIC) - else() - if (NOT sodium_PKG_FOUND) - set(sodium_PKG_LIBRARIES sodium) - endif() - - set(XPREFIX sodium_PKG) - endif() - - find_path(sodium_INCLUDE_DIR sodium.h - HINTS ${${XPREFIX}_INCLUDE_DIRS} - ) - find_library(sodium_LIBRARY_DEBUG NAMES ${${XPREFIX}_LIBRARIES} - HINTS ${${XPREFIX}_LIBRARY_DIRS} - ) - find_library(sodium_LIBRARY_RELEASE NAMES ${${XPREFIX}_LIBRARIES} - HINTS ${${XPREFIX}_LIBRARY_DIRS} - ) - - -######################################################################## -# Windows -elseif (WIN32) - set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory") - mark_as_advanced(sodium_DIR) - - find_path(sodium_INCLUDE_DIR sodium.h - HINTS ${sodium_DIR} - PATH_SUFFIXES include - ) - - if (MSVC) - # detect target architecture - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" [=[ - #if defined _M_IX86 - #error ARCH_VALUE x86_32 - #elif defined _M_X64 - #error ARCH_VALUE x86_64 - #endif - #error ARCH_VALUE unknown - ]=]) - try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" - OUTPUT_VARIABLE _COMPILATION_LOG - ) - string(REGEX REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*" "\\1" _TARGET_ARCH "${_COMPILATION_LOG}") - - # construct library path - if (_TARGET_ARCH STREQUAL "x86_32") - string(APPEND _PLATFORM_PATH "Win32") - elseif(_TARGET_ARCH STREQUAL "x86_64") - string(APPEND _PLATFORM_PATH "x64") - else() - message(FATAL_ERROR "the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake.") - endif() - string(APPEND _PLATFORM_PATH "/$$CONFIG$$") - - if (MSVC_VERSION LESS 1900) - math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60") - else() - math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50") - endif() - string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}") - - if (sodium_USE_STATIC_LIBS) - string(APPEND _PLATFORM_PATH "/static") - else() - string(APPEND _PLATFORM_PATH "/dynamic") - endif() - - string(REPLACE "$$CONFIG$$" "Debug" _DEBUG_PATH_SUFFIX "${_PLATFORM_PATH}") - string(REPLACE "$$CONFIG$$" "Release" _RELEASE_PATH_SUFFIX "${_PLATFORM_PATH}") - - find_library(sodium_LIBRARY_DEBUG libsodium.lib - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} - ) - find_library(sodium_LIBRARY_RELEASE libsodium.lib - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} - ) - if (NOT sodium_USE_STATIC_LIBS) - set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll") - find_library(sodium_DLL_DEBUG libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX} - ) - find_library(sodium_DLL_RELEASE libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX} - ) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK}) - endif() - - elseif(_GCC_COMPATIBLE) - if (sodium_USE_STATIC_LIBS) - find_library(sodium_LIBRARY_DEBUG libsodium.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - find_library(sodium_LIBRARY_RELEASE libsodium.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - else() - find_library(sodium_LIBRARY_DEBUG libsodium.dll.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - find_library(sodium_LIBRARY_RELEASE libsodium.dll.a - HINTS ${sodium_DIR} - PATH_SUFFIXES lib - ) - - file(GLOB _DLL - LIST_DIRECTORIES false - RELATIVE "${sodium_DIR}/bin" - "${sodium_DIR}/bin/libsodium*.dll" - ) - find_library(sodium_DLL_DEBUG ${_DLL} libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES bin - ) - find_library(sodium_DLL_RELEASE ${_DLL} libsodium - HINTS ${sodium_DIR} - PATH_SUFFIXES bin - ) - endif() - else() - message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") - endif() - - -######################################################################## -# unsupported -else() - message(FATAL_ERROR "this platform is not supported by FindSodium.cmake") -endif() - - -######################################################################## -# common stuff - -# extract sodium version -if (sodium_INCLUDE_DIR) - set(_VERSION_HEADER "${_INCLUDE_DIR}/sodium/version.h") - if (EXISTS _VERSION_HEADER) - file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT) - string(REGEX REPLACE ".*#[ \t]*define[ \t]*SODIUM_VERSION_STRING[ \t]*\"([^\n]*)\".*" "\\1" - sodium_VERSION "${_VERSION_HEADER_CONTENT}") - set(sodium_VERSION "${sodium_VERSION}" PARENT_SCOPE) - endif() -endif() - -# communicate results -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - sodium # The name must be either uppercase or match the filename case. - REQUIRED_VARS - sodium_LIBRARY_RELEASE - sodium_LIBRARY_DEBUG - sodium_INCLUDE_DIR - VERSION_VAR - sodium_VERSION -) - -if(Sodium_FOUND) - set(sodium_LIBRARIES - optimized ${sodium_LIBRARY_RELEASE} debug ${sodium_LIBRARY_DEBUG}) -endif() - -# mark file paths as advanced -mark_as_advanced(sodium_INCLUDE_DIR) -mark_as_advanced(sodium_LIBRARY_DEBUG) -mark_as_advanced(sodium_LIBRARY_RELEASE) -if (WIN32) - mark_as_advanced(sodium_DLL_DEBUG) - mark_as_advanced(sodium_DLL_RELEASE) -endif() - -# create imported target -if(sodium_USE_STATIC_LIBS) - set(_LIB_TYPE STATIC) -else() - set(_LIB_TYPE SHARED) -endif() -add_library(sodium ${_LIB_TYPE} IMPORTED) - -set_target_properties(sodium PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${sodium_INCLUDE_DIR}" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" -) - -if (sodium_USE_STATIC_LIBS) - set_target_properties(sodium PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "SODIUM_STATIC" - IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" - IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" - ) -else() - if (UNIX) - set_target_properties(sodium PROPERTIES - IMPORTED_LOCATION "${sodium_LIBRARY_RELEASE}" - IMPORTED_LOCATION_DEBUG "${sodium_LIBRARY_DEBUG}" - ) - elseif (WIN32) - set_target_properties(sodium PROPERTIES - IMPORTED_IMPLIB "${sodium_LIBRARY_RELEASE}" - IMPORTED_IMPLIB_DEBUG "${sodium_LIBRARY_DEBUG}" - ) - if (NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND")) - set_target_properties(sodium PROPERTIES - IMPORTED_LOCATION_DEBUG "${sodium_DLL_DEBUG}" - ) - endif() - if (NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND")) - set_target_properties(sodium PROPERTIES - IMPORTED_LOCATION_RELWITHDEBINFO "${sodium_DLL_RELEASE}" - IMPORTED_LOCATION_MINSIZEREL "${sodium_DLL_RELEASE}" - IMPORTED_LOCATION_RELEASE "${sodium_DLL_RELEASE}" - ) - endif() - endif() -endif() diff --git a/include/dashbls/util.hpp b/include/dashbls/util.hpp index 37fd8547a..4fa164bb2 100644 --- a/include/dashbls/util.hpp +++ b/include/dashbls/util.hpp @@ -80,8 +80,8 @@ class Util { } /* - * Securely allocates a portion of memory, using libsodium. This prevents - * paging to disk, and zeroes out the memory when it's freed. + * Securely allocates a portion of memory. This prevents paging to disk, + * and zeroes out the memory when it's freed. */ template static T* SecAlloc(size_t numTs) { diff --git a/rust-bindings/bls-dash-sys/build.rs b/rust-bindings/bls-dash-sys/build.rs index 0570baaa8..7231004e2 100644 --- a/rust-bindings/bls-dash-sys/build.rs +++ b/rust-bindings/bls-dash-sys/build.rs @@ -186,14 +186,6 @@ fn main() { cc.compile("bls-dash-sys"); - // // Link dependencies - // println!( - // "cargo:rustc-link-search={}", - // bls_dash_build_path.join("_deps/sodium-build").display() - // ); - - // println!("cargo:rustc-link-lib=static=sodium"); - println!( "cargo:rustc-link-search={}", root_path.join("build/depends/relic/lib").display() @@ -312,7 +304,6 @@ fn main() { // } // println!("cargo:rustc-link-search={}", target_path.display()); // println!("cargo:rustc-link-lib=static=gmp"); -// println!("cargo:rustc-link-lib=static=sodium"); // println!("cargo:rustc-link-lib=static=relic_s"); // println!("cargo:rustc-link-search={}", bls_dash_build_path.join("src").display()); // println!("cargo:rustc-link-lib=static=bls"); @@ -436,7 +427,6 @@ fn main() { println!("cargo:rustc-link-lib=static=gmp"); //println!("cargo:rustc-link-lib=c++"); //println!("cargo:rustc-link-lib=c"); - //println!("cargo:rustc-link-lib=static=sodium"); println!("cargo:rustc-link-lib=static=relic_s"); println!("cargo:rustc-link-lib=static=bls"); println!("cargo:rustc-link-search={}", bls_dash_src_path.display()); diff --git a/src/bls.cpp b/src/bls.cpp index e0af3a388..d233afe97 100644 --- a/src/bls.cpp +++ b/src/bls.cpp @@ -18,10 +18,6 @@ #include "mimalloc.h" #endif -#if BLSALLOC_SODIUM -#include "sodium.h" -#endif - namespace bls { const size_t BLS::MESSAGE_HASH_LEN; @@ -51,11 +47,6 @@ bool BLS::Init() } #if BLSALLOC_MIMALLOC SetSecureAllocator(mi_malloc, mi_free); -#elif BLSALLOC_SODIUM - if (sodium_init() < 0) { - throw std::runtime_error("libsodium init failed"); - } - SetSecureAllocator(sodium_malloc, sodium_free); #else SetSecureAllocator(malloc, free); #endif