configure.ac raw

   1  AC_PREREQ([2.60])
   2  
   3  # The package (a.k.a. release) version is based on semantic versioning 2.0.0 of
   4  # the API. All changes in experimental modules are treated as
   5  # backwards-compatible and therefore at most increase the minor version.
   6  define(_PKG_VERSION_MAJOR, 0)
   7  define(_PKG_VERSION_MINOR, 7)
   8  define(_PKG_VERSION_PATCH, 2)
   9  define(_PKG_VERSION_IS_RELEASE, false)
  10  
  11  # The library version is based on libtool versioning of the ABI. The set of
  12  # rules for updating the version can be found here:
  13  # https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
  14  # All changes in experimental modules are treated as if they don't affect the
  15  # interface and therefore only increase the revision.
  16  define(_LIB_VERSION_CURRENT, 6)
  17  define(_LIB_VERSION_REVISION, 2)
  18  define(_LIB_VERSION_AGE, 0)
  19  
  20  AC_INIT([libsecp256k1],m4_join([.], _PKG_VERSION_MAJOR, _PKG_VERSION_MINOR, _PKG_VERSION_PATCH)m4_if(_PKG_VERSION_IS_RELEASE, [true], [], [-dev]),[https://github.com/bitcoin-core/secp256k1/issues],[libsecp256k1],[https://github.com/bitcoin-core/secp256k1])
  21  
  22  AC_CONFIG_AUX_DIR([autotools-aux])
  23  AC_CONFIG_MACRO_DIR([autotools-aux/m4])
  24  AC_CANONICAL_HOST
  25  
  26  # Require Automake 1.11.2 for AM_PROG_AR
  27  AM_INIT_AUTOMAKE([1.11.2 foreign subdir-objects])
  28  
  29  # Make the compilation flags quiet unless V=1 is used.
  30  m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  31  
  32  if test "${CFLAGS+set}" = "set"; then
  33    CFLAGS_overridden=yes
  34  else
  35    CFLAGS_overridden=no
  36  fi
  37  AC_PROG_CC
  38  AM_PROG_AS
  39  AM_PROG_AR
  40  
  41  # Clear some cache variables as a workaround for a bug that appears due to a bad
  42  # interaction between AM_PROG_AR and LT_INIT when combining MSVC's archiver lib.exe.
  43  # https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54421
  44  AS_UNSET(ac_cv_prog_AR)
  45  AS_UNSET(ac_cv_prog_ac_ct_AR)
  46  LT_INIT([win32-dll])
  47  
  48  build_windows=no
  49  
  50  case $host_os in
  51    *darwin*)
  52       if  test x$cross_compiling != xyes; then
  53         AC_CHECK_PROG([BREW], brew, brew)
  54         if test x$BREW = xbrew; then
  55           # These Homebrew packages may be keg-only, meaning that they won't be found
  56           # in expected paths because they may conflict with system files. Ask
  57           # Homebrew where each one is located, then adjust paths accordingly.
  58           if $BREW list --versions valgrind >/dev/null; then
  59             valgrind_prefix=$($BREW --prefix valgrind 2>/dev/null)
  60             VALGRIND_CPPFLAGS="-I$valgrind_prefix/include"
  61           fi
  62         else
  63           AC_CHECK_PROG([PORT], port, port)
  64           # If homebrew isn't installed and macports is, add the macports default paths
  65           # as a last resort.
  66           if test x$PORT = xport; then
  67             CPPFLAGS="$CPPFLAGS -isystem /opt/local/include"
  68             LDFLAGS="$LDFLAGS -L/opt/local/lib"
  69           fi
  70         fi
  71       fi
  72     ;;
  73     cygwin*|mingw*)
  74       build_windows=yes
  75     ;;
  76  esac
  77  
  78  # Try if some desirable compiler flags are supported and append them to SECP_CFLAGS.
  79  #
  80  # These are our own flags, so we append them to our own SECP_CFLAGS variable (instead of CFLAGS) as
  81  # recommended in the automake manual (Section "Flag Variables Ordering"). CFLAGS belongs to the user
  82  # and we are not supposed to touch it. In the Makefile, we will need to ensure that SECP_CFLAGS
  83  # is prepended to CFLAGS when invoking the compiler so that the user always has the last word (flag).
  84  #
  85  # Another advantage of not touching CFLAGS is that the contents of CFLAGS will be picked up by
  86  # libtool for compiling helper executables. For example, when compiling for Windows, libtool will
  87  # generate entire wrapper executables (instead of simple wrapper scripts as on Unix) to ensure
  88  # proper operation of uninstalled programs linked by libtool against the uninstalled shared library.
  89  # These executables are compiled from C source file for which our flags may not be appropriate,
  90  # e.g., -std=c89 flag has lead to undesirable warnings in the past.
  91  #
  92  # TODO We should analogously not touch CPPFLAGS and LDFLAGS but currently there are no issues.
  93  AC_DEFUN([SECP_TRY_APPEND_DEFAULT_CFLAGS], [
  94      # GCC and compatible (incl. clang)
  95      if test "x$GCC" = "xyes"; then
  96        # Try to append -Werror to CFLAGS temporarily. Otherwise checks for some unsupported
  97        # flags will succeed.
  98        # Note that failure to append -Werror does not necessarily mean that -Werror is not
  99        # supported. The compiler may already be warning about something unrelated, for example
 100        # about some path issue. If that is the case, -Werror cannot be used because all
 101        # of those warnings would be turned into errors.
 102        SECP_TRY_APPEND_DEFAULT_CFLAGS_saved_CFLAGS="$CFLAGS"
 103        SECP_TRY_APPEND_CFLAGS([-Werror], CFLAGS)
 104  
 105        SECP_TRY_APPEND_CFLAGS([-std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef], $1) # GCC >= 3.0, -Wlong-long is implied by -pedantic.
 106        SECP_TRY_APPEND_CFLAGS([-Wno-overlength-strings], $1) # GCC >= 4.2, -Woverlength-strings is implied by -pedantic.
 107        SECP_TRY_APPEND_CFLAGS([-Wall], $1) # GCC >= 2.95 and probably many other compilers
 108        SECP_TRY_APPEND_CFLAGS([-Wno-unused-function], $1) # GCC >= 3.0, -Wunused-function is implied by -Wall.
 109        SECP_TRY_APPEND_CFLAGS([-Wextra], $1) # GCC >= 3.4, this is the newer name of -W, which we don't use because older GCCs will warn about unused functions.
 110        SECP_TRY_APPEND_CFLAGS([-Wcast-align], $1) # GCC >= 2.95
 111        SECP_TRY_APPEND_CFLAGS([-Wcast-align=strict], $1) # GCC >= 8.0
 112        SECP_TRY_APPEND_CFLAGS([-Wconditional-uninitialized], $1) # Clang >= 3.0 only
 113        SECP_TRY_APPEND_CFLAGS([-Wreserved-identifier], $1) # Clang >= 13.0 only
 114        SECP_TRY_APPEND_CFLAGS([-Wtrailing-whitespace=any], $1) # GCC >= 15.0
 115        SECP_TRY_APPEND_CFLAGS([-Wleading-whitespace=spaces], $1) # GCC >= 15.0
 116  
 117        CFLAGS="$SECP_TRY_APPEND_DEFAULT_CFLAGS_saved_CFLAGS"
 118      fi
 119  
 120      # MSVC
 121      # Assume MSVC if we're building for Windows but not with GCC or compatible;
 122      # libtool makes the same assumption internally.
 123      # Note that "/opt" and "-opt" are equivalent for MSVC; we use "-opt" because "/opt" looks like a path.
 124      if test x"$GCC" != x"yes" && test x"$build_windows" = x"yes"; then
 125        SECP_TRY_APPEND_CFLAGS([-W3], $1) # Production quality warning level.
 126        SECP_TRY_APPEND_CFLAGS([-wd4146], $1) # Disable warning C4146 "unary minus operator applied to unsigned type, result still unsigned".
 127        SECP_TRY_APPEND_CFLAGS([-wd4244], $1) # Disable warning C4244 "'conversion' conversion from 'type1' to 'type2', possible loss of data".
 128        SECP_TRY_APPEND_CFLAGS([-wd4267], $1) # Disable warning C4267 "'var' : conversion from 'size_t' to 'type', possible loss of data".
 129        # Eliminate deprecation warnings for the older, less secure functions.
 130        CPPFLAGS="-D_CRT_SECURE_NO_WARNINGS $CPPFLAGS"
 131      fi
 132  ])
 133  SECP_TRY_APPEND_DEFAULT_CFLAGS(SECP_CFLAGS)
 134  
 135  ###
 136  ### Define config arguments
 137  ###
 138  
 139  # In dev mode, we enable all binaries and modules by default but individual options can still be overridden explicitly.
 140  # Check for dev mode first because SECP_SET_DEFAULT needs enable_dev_mode set.
 141  AC_ARG_ENABLE(dev_mode, [], [],
 142      [enable_dev_mode=no])
 143  
 144  AC_ARG_ENABLE(benchmark,
 145      AS_HELP_STRING([--enable-benchmark],[compile benchmark [default=yes]]), [],
 146      [SECP_SET_DEFAULT([enable_benchmark], [yes], [yes])])
 147  
 148  AC_ARG_ENABLE(coverage,
 149      AS_HELP_STRING([--enable-coverage],[enable coverage analysis support [default=no]]), [],
 150      [SECP_SET_DEFAULT([enable_coverage], [no], [no])])
 151  
 152  AC_ARG_ENABLE(tests,
 153      AS_HELP_STRING([--enable-tests],[compile tests [default=yes]]), [],
 154      [SECP_SET_DEFAULT([enable_tests], [yes], [yes])])
 155  
 156  AC_ARG_ENABLE(ctime_tests,
 157      AS_HELP_STRING([--enable-ctime-tests],[compile constant-time tests [default=yes if valgrind enabled]]), [],
 158      [SECP_SET_DEFAULT([enable_ctime_tests], [auto], [auto])])
 159  
 160  AC_ARG_ENABLE(experimental,
 161      AS_HELP_STRING([--enable-experimental],[allow experimental configure options [default=no]]), [],
 162      [SECP_SET_DEFAULT([enable_experimental], [no], [yes])])
 163  
 164  AC_ARG_ENABLE(exhaustive_tests,
 165      AS_HELP_STRING([--enable-exhaustive-tests],[compile exhaustive tests [default=yes]]), [],
 166      [SECP_SET_DEFAULT([enable_exhaustive_tests], [yes], [yes])])
 167  
 168  AC_ARG_ENABLE(examples,
 169      AS_HELP_STRING([--enable-examples],[compile the examples [default=no]]), [],
 170      [SECP_SET_DEFAULT([enable_examples], [no], [yes])])
 171  
 172  AC_ARG_ENABLE(module_ecdh,
 173      AS_HELP_STRING([--enable-module-ecdh],[enable ECDH module [default=yes]]), [],
 174      [SECP_SET_DEFAULT([enable_module_ecdh], [yes], [yes])])
 175  
 176  AC_ARG_ENABLE(module_recovery,
 177      AS_HELP_STRING([--enable-module-recovery],[enable ECDSA pubkey recovery module [default=no]]), [],
 178      [SECP_SET_DEFAULT([enable_module_recovery], [no], [yes])])
 179  
 180  AC_ARG_ENABLE(module_extrakeys,
 181      AS_HELP_STRING([--enable-module-extrakeys],[enable extrakeys module [default=yes]]), [],
 182      [SECP_SET_DEFAULT([enable_module_extrakeys], [yes], [yes])])
 183  
 184  AC_ARG_ENABLE(module_schnorrsig,
 185      AS_HELP_STRING([--enable-module-schnorrsig],[enable schnorrsig module [default=yes]]), [],
 186      [SECP_SET_DEFAULT([enable_module_schnorrsig], [yes], [yes])])
 187  
 188  AC_ARG_ENABLE(module_musig,
 189      AS_HELP_STRING([--enable-module-musig],[enable MuSig2 module [default=yes]]), [],
 190      [SECP_SET_DEFAULT([enable_module_musig], [yes], [yes])])
 191  
 192  AC_ARG_ENABLE(module_ellswift,
 193      AS_HELP_STRING([--enable-module-ellswift],[enable ElligatorSwift module [default=yes]]), [],
 194      [SECP_SET_DEFAULT([enable_module_ellswift], [yes], [yes])])
 195  
 196  AC_ARG_ENABLE(external_default_callbacks,
 197      AS_HELP_STRING([--enable-external-default-callbacks],[enable external default callback functions [default=no]]), [],
 198      [SECP_SET_DEFAULT([enable_external_default_callbacks], [no], [no])])
 199  
 200  # Test-only override of the (autodetected by the C code) "widemul" setting.
 201  # Legal values are:
 202  #  * int64 (for [u]int64_t),
 203  #  * int128 (for [unsigned] __int128),
 204  #  * int128_struct (for int128 implemented as a structure),
 205  #  *  and auto (the default).
 206  AC_ARG_WITH([test-override-wide-multiply], [] ,[set_widemul=$withval], [set_widemul=auto])
 207  
 208  AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm32|no|auto],
 209  [assembly to use (experimental: arm32) [default=auto]])],[req_asm=$withval], [req_asm=auto])
 210  
 211  AC_ARG_WITH([ecmult-window], [AS_HELP_STRING([--with-ecmult-window=SIZE],
 212  [window size for ecmult precomputation for verification, specified as integer in range [2..24].]
 213  [Larger values result in possibly better performance at the cost of an exponentially larger precomputed table.]
 214  [The table will store 2^(SIZE-1) * 64 bytes of data but can be larger in memory due to platform-specific padding and alignment.]
 215  [A window size larger than 15 will require you delete the prebuilt precomputed_ecmult.c file so that it can be rebuilt.]
 216  [For very large window sizes, use "make -j 1" to reduce memory use during compilation.]
 217  [The default value is a reasonable setting for desktop machines (currently 15). [default=15]]
 218  )],
 219  [set_ecmult_window=$withval], [set_ecmult_window=15])
 220  
 221  AC_ARG_WITH([ecmult-gen-kb], [AS_HELP_STRING([--with-ecmult-gen-kb=2|22|86],
 222  [The size of the precomputed table for signing in multiples of 1024 bytes (on typical platforms).]
 223  [Larger values result in possibly better signing/keygeneration performance at the cost of a larger table.]
 224  [The default value is a reasonable setting for desktop machines (currently 86). [default=86]]
 225  )],
 226  [set_ecmult_gen_kb=$withval], [set_ecmult_gen_kb=86])
 227  
 228  AC_ARG_WITH([valgrind], [AS_HELP_STRING([--with-valgrind=yes|no|auto],
 229  [Build with extra checks for running inside Valgrind [default=auto]]
 230  )],
 231  [req_valgrind=$withval], [req_valgrind=auto])
 232  
 233  ###
 234  ### Handle config options (except for modules)
 235  ###
 236  
 237  if test x"$req_valgrind" = x"no"; then
 238    enable_valgrind=no
 239  else
 240    SECP_VALGRIND_CHECK
 241    if test x"$has_valgrind" != x"yes"; then
 242      if test x"$req_valgrind" = x"yes"; then
 243        AC_MSG_ERROR([Valgrind support explicitly requested but valgrind/memcheck.h header not available])
 244      fi
 245      enable_valgrind=no
 246    else
 247      enable_valgrind=yes
 248    fi
 249  fi
 250  
 251  if test x"$enable_ctime_tests" = x"auto"; then
 252      enable_ctime_tests=$enable_valgrind
 253  fi
 254  
 255  print_msan_notice=no
 256  if test x"$enable_ctime_tests" = x"yes"; then
 257    SECP_MSAN_CHECK
 258    # MSan on Clang >=16 reports uninitialized memory in function parameters and return values, even if
 259    # the uninitialized variable is never actually "used". This is called "eager" checking, and it's
 260    # sounds like good idea for normal use of MSan. However, it yields many false positives in the
 261    # ctime_tests because many return values depend on secret (i.e., "uninitialized") values, and
 262    # we're only interested in detecting branches (which count as "uses") on secret data.
 263    if test x"$msan_enabled" = x"yes"; then
 264      SECP_TRY_APPEND_CFLAGS([-fno-sanitize-memory-param-retval], SECP_CFLAGS)
 265      print_msan_notice=yes
 266    fi
 267  fi
 268  
 269  if test x"$enable_coverage" = x"yes"; then
 270      SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DCOVERAGE=1"
 271      SECP_CFLAGS="-O0 --coverage $SECP_CFLAGS"
 272      # If coverage is enabled, and the user has not overridden CFLAGS,
 273      # override Autoconf's value "-g -O2" with "-g". Otherwise we'd end up
 274      # with "-O0 --coverage -g -O2".
 275      if test "$CFLAGS_overridden" = "no"; then
 276        CFLAGS="-g"
 277      fi
 278      LDFLAGS="--coverage $LDFLAGS"
 279  else
 280      # Most likely the CFLAGS already contain -O2 because that is autoconf's default.
 281      # We still add it here because passing it twice is not an issue, and handling
 282      # this case would just add unnecessary complexity (see #896).
 283      SECP_CFLAGS="-O2 $SECP_CFLAGS"
 284  fi
 285  
 286  if test x"$req_asm" = x"auto"; then
 287    SECP_X86_64_ASM_CHECK
 288    if test x"$has_x86_64_asm" = x"yes"; then
 289      set_asm=x86_64
 290    fi
 291    if test x"$set_asm" = x; then
 292      set_asm=no
 293    fi
 294  else
 295    set_asm=$req_asm
 296    case $set_asm in
 297    x86_64)
 298      SECP_X86_64_ASM_CHECK
 299      if test x"$has_x86_64_asm" != x"yes"; then
 300        AC_MSG_ERROR([x86_64 assembly requested but not available])
 301      fi
 302      ;;
 303    arm32)
 304      SECP_ARM32_ASM_CHECK
 305      if test x"$has_arm32_asm" != x"yes"; then
 306        AC_MSG_ERROR([ARM32 assembly requested but not available])
 307      fi
 308      ;;
 309    no)
 310      ;;
 311    *)
 312      AC_MSG_ERROR([invalid assembly selection])
 313      ;;
 314    esac
 315  fi
 316  
 317  # Select assembly
 318  enable_external_asm=no
 319  
 320  case $set_asm in
 321  x86_64)
 322    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DUSE_ASM_X86_64=1"
 323    ;;
 324  arm32)
 325    enable_external_asm=yes
 326    ;;
 327  no)
 328    ;;
 329  *)
 330    AC_MSG_ERROR([invalid assembly selection])
 331    ;;
 332  esac
 333  
 334  if test x"$enable_external_asm" = x"yes"; then
 335    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DUSE_EXTERNAL_ASM=1"
 336  fi
 337  
 338  
 339  # Select wide multiplication implementation
 340  case $set_widemul in
 341  int128_struct)
 342    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DUSE_FORCE_WIDEMUL_INT128_STRUCT=1"
 343    ;;
 344  int128)
 345    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DUSE_FORCE_WIDEMUL_INT128=1"
 346    ;;
 347  int64)
 348    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DUSE_FORCE_WIDEMUL_INT64=1"
 349    ;;
 350  auto)
 351    ;;
 352  *)
 353    AC_MSG_ERROR([invalid wide multiplication implementation])
 354    ;;
 355  esac
 356  
 357  error_window_size=['window size for ecmult precomputation not an integer in range [2..24]']
 358  case $set_ecmult_window in
 359  ''|*[[!0-9]]*)
 360    # no valid integer
 361    AC_MSG_ERROR($error_window_size)
 362    ;;
 363  *)
 364    if test "$set_ecmult_window" -lt 2 -o "$set_ecmult_window" -gt 24 ; then
 365      # not in range
 366      AC_MSG_ERROR($error_window_size)
 367    fi
 368    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DECMULT_WINDOW_SIZE=$set_ecmult_window"
 369    ;;
 370  esac
 371  
 372  case $set_ecmult_gen_kb in
 373  2)
 374    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DCOMB_BLOCKS=2 -DCOMB_TEETH=5"
 375    ;;
 376  22)
 377    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DCOMB_BLOCKS=11 -DCOMB_TEETH=6"
 378    ;;
 379  86)
 380    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DCOMB_BLOCKS=43 -DCOMB_TEETH=6"
 381    ;;
 382  *)
 383    AC_MSG_ERROR(['ecmult gen table size not 2, 22 or 86'])
 384    ;;
 385  esac
 386  
 387  if test x"$enable_valgrind" = x"yes"; then
 388    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES $VALGRIND_CPPFLAGS -DVALGRIND"
 389  fi
 390  
 391  # Add -Werror and similar flags passed from the outside (for testing, e.g., in CI).
 392  # We don't want to set the user variable CFLAGS in CI because this would disable
 393  # autoconf's logic for setting default CFLAGS, which we would like to test in CI.
 394  SECP_CFLAGS="$SECP_CFLAGS $WERROR_CFLAGS"
 395  
 396  ###
 397  ### Handle module options
 398  ###
 399  
 400  # Processing must be done in a reverse topological sorting of the dependency graph
 401  # (dependent module first).
 402  if test x"$enable_module_ellswift" = x"yes"; then
 403    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ELLSWIFT=1"
 404  fi
 405  
 406  if test x"$enable_module_musig" = x"yes"; then
 407    if test x"$enable_module_schnorrsig" = x"no"; then
 408      AC_MSG_ERROR([Module dependency error: You have disabled the schnorrsig module explicitly, but it is required by the musig module.])
 409    fi
 410    enable_module_schnorrsig=yes
 411    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_MUSIG=1"
 412  fi
 413  
 414  if test x"$enable_module_schnorrsig" = x"yes"; then
 415    if test x"$enable_module_extrakeys" = x"no"; then
 416      AC_MSG_ERROR([Module dependency error: You have disabled the extrakeys module explicitly, but it is required by the schnorrsig module.])
 417    fi
 418    enable_module_extrakeys=yes
 419    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_SCHNORRSIG=1"
 420  fi
 421  
 422  if test x"$enable_module_extrakeys" = x"yes"; then
 423    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_EXTRAKEYS=1"
 424  fi
 425  
 426  if test x"$enable_module_recovery" = x"yes"; then
 427    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_RECOVERY=1"
 428  fi
 429  
 430  if test x"$enable_module_ecdh" = x"yes"; then
 431    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DENABLE_MODULE_ECDH=1"
 432  fi
 433  
 434  if test x"$enable_external_default_callbacks" = x"yes"; then
 435    SECP_CONFIG_DEFINES="$SECP_CONFIG_DEFINES -DUSE_EXTERNAL_DEFAULT_CALLBACKS=1"
 436  fi
 437  
 438  ###
 439  ### Check for --enable-experimental if necessary
 440  ###
 441  
 442  if test x"$enable_experimental" = x"no"; then
 443    if test x"$set_asm" = x"arm32"; then
 444      AC_MSG_ERROR([ARM32 assembly is experimental. Use --enable-experimental to allow.])
 445    fi
 446  fi
 447  
 448  # Check for concurrency support (tests only)
 449  if test "x$enable_tests" != x"no"; then
 450    AC_CHECK_HEADERS([sys/types.h sys/wait.h unistd.h])
 451    AS_IF([test "x$ac_cv_header_sys_types_h" = xyes && test "x$ac_cv_header_sys_wait_h" = xyes &&
 452           test "x$ac_cv_header_unistd_h" = xyes], [TEST_DEFINES="-DSUPPORTS_CONCURRENCY=1"], TEST_DEFINES="")
 453    AC_SUBST(TEST_DEFINES)
 454  fi
 455  
 456  ###
 457  ### Generate output
 458  ###
 459  
 460  AC_CONFIG_FILES([Makefile libsecp256k1.pc])
 461  AC_SUBST(SECP_CFLAGS)
 462  AC_SUBST(SECP_CONFIG_DEFINES)
 463  AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"])
 464  AM_CONDITIONAL([USE_TESTS], [test x"$enable_tests" != x"no"])
 465  AM_CONDITIONAL([USE_CTIME_TESTS], [test x"$enable_ctime_tests" = x"yes"])
 466  AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$enable_exhaustive_tests" != x"no"])
 467  AM_CONDITIONAL([USE_EXAMPLES], [test x"$enable_examples" != x"no"])
 468  AM_CONDITIONAL([USE_BENCHMARK], [test x"$enable_benchmark" = x"yes"])
 469  AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])
 470  AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"])
 471  AM_CONDITIONAL([ENABLE_MODULE_EXTRAKEYS], [test x"$enable_module_extrakeys" = x"yes"])
 472  AM_CONDITIONAL([ENABLE_MODULE_SCHNORRSIG], [test x"$enable_module_schnorrsig" = x"yes"])
 473  AM_CONDITIONAL([ENABLE_MODULE_MUSIG], [test x"$enable_module_musig" = x"yes"])
 474  AM_CONDITIONAL([ENABLE_MODULE_ELLSWIFT], [test x"$enable_module_ellswift" = x"yes"])
 475  AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$enable_external_asm" = x"yes"])
 476  AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm32"])
 477  AM_CONDITIONAL([BUILD_WINDOWS], [test "$build_windows" = "yes"])
 478  AC_SUBST(LIB_VERSION_CURRENT, _LIB_VERSION_CURRENT)
 479  AC_SUBST(LIB_VERSION_REVISION, _LIB_VERSION_REVISION)
 480  AC_SUBST(LIB_VERSION_AGE, _LIB_VERSION_AGE)
 481  
 482  AC_OUTPUT
 483  
 484  echo
 485  echo "Build Options:"
 486  echo "  with external callbacks = $enable_external_default_callbacks"
 487  echo "  with benchmarks         = $enable_benchmark"
 488  echo "  with tests              = $enable_tests"
 489  echo "  with exhaustive tests   = $enable_exhaustive_tests"
 490  echo "  with ctime tests        = $enable_ctime_tests"
 491  echo "  with coverage           = $enable_coverage"
 492  echo "  with examples           = $enable_examples"
 493  echo "  module ecdh             = $enable_module_ecdh"
 494  echo "  module recovery         = $enable_module_recovery"
 495  echo "  module extrakeys        = $enable_module_extrakeys"
 496  echo "  module schnorrsig       = $enable_module_schnorrsig"
 497  echo "  module musig            = $enable_module_musig"
 498  echo "  module ellswift         = $enable_module_ellswift"
 499  echo
 500  echo "  asm                     = $set_asm"
 501  echo "  ecmult window size      = $set_ecmult_window"
 502  echo "  ecmult gen table size   = $set_ecmult_gen_kb KiB"
 503  # Hide test-only options unless they're used.
 504  if test x"$set_widemul" != xauto; then
 505  echo "  wide multiplication     = $set_widemul"
 506  fi
 507  echo
 508  echo "  valgrind                = $enable_valgrind"
 509  echo "  CC                      = $CC"
 510  echo "  CPPFLAGS                = $CPPFLAGS"
 511  echo "  SECP_CFLAGS             = $SECP_CFLAGS"
 512  echo "  CFLAGS                  = $CFLAGS"
 513  echo "  LDFLAGS                 = $LDFLAGS"
 514  
 515  if test x"$print_msan_notice" = x"yes"; then
 516    echo
 517    echo "Note:"
 518    echo "  MemorySanitizer detected, tried to add -fno-sanitize-memory-param-retval to SECP_CFLAGS"
 519    echo "  to avoid false positives in ctime_tests. Pass --disable-ctime-tests to avoid this."
 520  fi
 521  
 522  if test x"$enable_experimental" = x"yes"; then
 523    echo
 524    echo "WARNING: Experimental build"
 525    echo "  Experimental features do not have stable APIs or properties, and may not be safe for"
 526    echo "  production use."
 527  fi
 528