diff mbox

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

Message ID 1406648486-12276-2-git-send-email-robking@cisco.com
State New
Headers show

Commit Message

Robbie King July 29, 2014, 3:41 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..681815f 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 97089e9..2d8a8e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,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"