Skip to content

Commit 901a702

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

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,23 @@ exhaustive_tests_LDFLAGS = -static
121121
TESTS += exhaustive_tests
122122
endif
123123

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

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)