diff mbox

[PATCHv6,1/3] Add crypto library to dependencies and configure script

Message ID 1407856641-6466-2-git-send-email-robking@cisco.com
State Superseded
Headers show

Commit Message

Robbie King Aug. 12, 2014, 3:17 p.m. UTC
Signed-off-by: Robbie King <robking@cisco.com>
---
 DEPENDENCIES |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.ac |   17 ++++++++++++++++
 2 files changed, 77 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/DEPENDENCIES b/DEPENDENCIES
index 4b7faef..53233ff 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -16,3 +16,63 @@  Prerequisites for building the OpenDataPlane (ODP) API
 
    On CentOS/RedHat/Fedora systems:
    $ sudo yum install automake autoconf autoconf-archive libtool libtoolize
+
+3. required libraries
+
+   Libraries currently required to link: openssl
+
+3.1 native compile
+
+   For native compilation, simply load the necessary libraries using the appropriate
+   tool set.
+
+   On Debian/Ubuntu systems:
+   $ sudo apt-get install libssl-dev
+
+   On CentOS/RedHat/Fedora systems:
+   $ sudo yum install openssl-devel
+
+3.2 cross compilation
+
+   Cross compilation requires cross compiling the individual libraries.  In order for
+   a cross compiled executable to run on a target system, one must build the same
+   version as that which is installed on the target rootfs.
+
+   For example, to build openssl for both 32 and 64 bit compilation:
+
+   # Clone openssl repository
+   $ git clone git://git.openssl.org/openssl.git
+   $ cd openssl
+
+   # The command "git tag" will list all tags available in the repo.
+   $ git tag
+
+   # Checkout the specific tag to match openssl library in your target rootfs
+   $ git checkout <tag name>
+
+   # Build and install 32 bit version of openssl
+   $ ./Configure linux-generic32 --cross-compile-prefix=arm-linux-gnueabihf- \
+     --prefix=/home/user/src/install-openssl
+   $ make
+   $ make install
+
+   # Build and install 64 bit version of openssl
+   $ ./Configure linux-aarch64 --cross-compile-prefix=aarch64-linux-gnu- \
+     --prefix=/home/user/src/install-openssl-aarch64
+   $ make
+   $ make install
+
+   # You may now build either 32 or 64 bit ODP
+   $ git clone git://git.linaro.org/lng/odp.git odp
+   $ cd odp
+   $ ./bootstrap
+
+   # Build 32 bit version of ODP
+   $ ./configure --host=arm-linux-gnueabihf \
+     --with-openssl-path=/home/user/src/install-openssl
+   $ make
+
+   # Or build 64 bit version of ODP
+   $ ./configure --host=aarch64-linux-gnu \
+     --with-openssl-path=/home/user/src/install-openssl-aarch64
+   $ make
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 6b75e66..74713a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,23 @@  AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
 AM_LDFLAGS="$AM_LDFLAGS $PTHREAD_LDFLAGS"
 
 ##########################################################################
+# Check for openssl availability
+##########################################################################
+
+AC_ARG_WITH([openssl-path],
+AC_HELP_STRING([--with-openssl-path=DIR Path to openssl libs and headers],
+               [(or in the default path if not specified).]),
+[OPENSSL_PATH=$withval
+AM_CFLAGS="$AM_CFLAGS -I$OPENSSL_PATH/include"
+AM_LDFLAGS="$AM_LDFLAGS -L$OPENSSL_PATH/lib"
+],[
+AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
+             [AC_MSG_FAILURE([can't find openssl crypto lib])])
+AC_CHECK_HEADERS([openssl/des.h openssl/rand.h openssl/hmac.h openssl/evp.h], [],
+             [AC_MSG_FAILURE([can't find openssl crypto headers])])
+    ])
+
+##########################################################################
 # Default warning setup
 ##########################################################################
 ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes"