Subject: [PATCH] docs/HACKING.CRYPTO: Improve documentation for autoconf build system

[PATCH] docs/HACKING.CRYPTO: Improve documentation for autoconf build system

From: Peter Stuge <peter_at_stuge.se>
Date: Wed, 16 Nov 2016 22:44:20 +0100

---
 docs/HACKING.CRYPTO | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/docs/HACKING.CRYPTO b/docs/HACKING.CRYPTO
index 381b2a9..91e91e0 100644
--- a/docs/HACKING.CRYPTO
+++ b/docs/HACKING.CRYPTO
@@ -15,29 +15,34 @@ indicates the libssh2 core modules never use the function result.
 
 0) Build system.
 
-Add a new crypto backend to the autotools build system (./configure) as such:
+Adding a crypto backend to the autotools build system (./configure) is easy:
 
-* Add one new line to configure.ac:
+0.1) Add one new line in configure.ac
 
 m4_set_add([crypto_backends], [newname])
 
-This automatically creates a new --with-crypto=newname option which users can
-specify when invoking configure at compile-time to select the new backend.
+This automatically creates a --with-crypto=newname option.
 
-* Add a new m4_case stanza to acinclude.m4 within LIBSSH2_CRYPTO_CHECK,
-  with checks for library availability. A successful check should set
-  library linking variables. The LIBSSH2_LIB_HAVE_LINKFLAGS macro creates
-  such a variable automatically if the checked library can be found.
+0.2) Add an m4_case stanza to LIBSSH2_CRYPTO_CHECK in acinclude.m4
 
-* Add a Makefile.newname.inc in the top-level directory which sets
-  CRYPTO_CSOURCES and CRYPTO_HHEADERS to the new backend source files,
-  and CRYPTO_LTLIBS to the libtool linking parameters for the library, set
-  e.g. by a LIBSSH2_LIB_HAVE_LINKFLAGS call in LIBSSH2_CRYPTO_CHECK.
+This must check for all required libraries, and if found set and AC_SUBST a
+variable with the library linking flags. The recommended method is to use
+LIBSSH2_LIB_HAVE_LINKFLAGS from LIBSSH2_CRYPTO_CHECK, which automatically
+creates and handles a --with-$newname-prefix option and sets an
+LTLIBNEWNAME variable on success.
 
-* Add a new block to src/Makefile.am:
-  if NEWNAME
-  include ../Makefile.newname.inc
-  endif
+0.3) Create Makefile.newname.inc in the top-level directory
+
+This must set CRYPTO_CSOURCES, CRYPTO_HHEADERS and CRYPTO_LTLIBS.
+Set CRYPTO_CSOURCES and CRYPTO_HHEADERS to the new backend source files
+and set CRYPTO_LTLIBS to the required library linking parameters, e.g.
+$(LTLIBNEWNAME) as generated by by LIBSSH2_LIB_HAVE_LINKFLAGS.
+
+0.4) Add a new block in src/Makefile.am
+
+if NEWNAME
+include ../Makefile.newname.inc
+endif
 
 
 1) Crypto library initialization/termination.
-- 
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-11-16