Skip to content

Commit 74bdb09

Browse files
committed
Add the examples to autotools, run with make check
1 parent e82e6ec commit 74bdb09

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ tests
1010
exhaustive_tests
1111
gen_context
1212
valgrind_ctime_test
13+
keygen_example
14+
ecdh_example
1315
*.exe
1416
*.so
1517
*.a
1618
!.gitignore
19+
*.log
20+
*.trs
1721

1822
Makefile
1923
configure

Makefile.am

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ noinst_HEADERS += contrib/lax_der_parsing.h
4848
noinst_HEADERS += contrib/lax_der_parsing.c
4949
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
5050
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
51+
noinst_HEADERS += examples/random.h
5152

5253
if USE_EXTERNAL_ASM
5354
COMMON_LIB = libsecp256k1_common.la
@@ -121,6 +122,23 @@ exhaustive_tests_LDFLAGS = -static
121122
TESTS += exhaustive_tests
122123
endif
123124

125+
if USE_EXAMPLES
126+
noinst_PROGRAMS += keygen_example
127+
keygen_example_SOURCES = examples/keygen.c
128+
keygen_example_CPPFLAGS = -I$(top_srcdir)/include $(SECP_INCLUDES)
129+
keygen_example_LDADD = libsecp256k1.la $(SECP_LIBS)
130+
keygen_example_LDFLAGS = -static
131+
TESTS += keygen_example
132+
if ENABLE_MODULE_ECDH
133+
noinst_PROGRAMS += ecdh_example
134+
ecdh_example_SOURCES = examples/ecdh.c
135+
ecdh_example_CPPFLAGS = -I$(top_srcdir)/include $(SECP_INCLUDES)
136+
ecdh_example_LDADD = libsecp256k1.la $(SECP_LIBS)
137+
ecdh_example_LDFLAGS = -static
138+
TESTS += ecdh_example
139+
endif
140+
endif
141+
124142
if USE_ECMULT_STATIC_PRECOMPUTATION
125143
CPPFLAGS_FOR_BUILD +=-I$(top_srcdir) -I$(builddir)/src
126144

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ AC_ARG_ENABLE(exhaustive_tests,
116116
[use_exhaustive_tests=$enableval],
117117
[use_exhaustive_tests=yes])
118118

119+
AC_ARG_ENABLE(examples,
120+
AS_HELP_STRING([--enable-examples],[compile the examples [default=yes]]),
121+
[use_examples=$enableval],
122+
[use_examples=yes])
123+
119124
AC_ARG_ENABLE(endomorphism,
120125
AS_HELP_STRING([--enable-endomorphism],[enable endomorphism [default=no]]),
121126
[use_endomorphism=$enableval],
@@ -527,6 +532,7 @@ AC_SUBST(SECP_TEST_INCLUDES)
527532
AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"])
528533
AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"])
529534
AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"])
535+
AM_CONDITIONAL([USE_EXAMPLES], [test x"$use_examples" != x"no"])
530536
AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"])
531537
AM_CONDITIONAL([USE_ECMULT_STATIC_PRECOMPUTATION], [test x"$set_precomp" = x"yes"])
532538
AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"])

0 commit comments

Comments
 (0)