summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Martin <amartin@nvidia.com>2012-03-30 13:55:15 -0700
committerAllen Martin <amartin@nvidia.com>2012-04-03 09:28:43 -0700
commita89b12af1332cb84f3a2b8ea8ceea5b9a013fa16 (patch)
treec7e72b3a6a73bd1c8b0918fa61286e6f0c3e41ac
parentd55c0ac2c147c6e88605f576b534e58c81a5ee38 (diff)
downloadtegrarcm-a89b12af1332cb84f3a2b8ea8ceea5b9a013fa16.tar.gz
Handle multiple names for libcrypto++
Add automake code to handle the different names libcrypto++ has on different systems (libcrypto++ vs libcryptopp). Change-Id: I052a9b099138478cf3324f5f99757f34c42eeb67 Reviewed-on: http://git-master/r/94266 Reviewed-by: Allen Martin <amartin@nvidia.com> Tested-by: Allen Martin <amartin@nvidia.com>
-rw-r--r--Makefile.in1
-rwxr-xr-xconfigure27
-rw-r--r--configure.ac13
-rw-r--r--src/Makefile.am4
-rw-r--r--src/Makefile.in5
5 files changed, 40 insertions, 10 deletions
diff --git a/Makefile.in b/Makefile.in
index 575cd64..d6f585e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -109,6 +109,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CRYPTOLIB = @CRYPTOLIB@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
diff --git a/configure b/configure
index 628b0c9..cfffc3f 100755
--- a/configure
+++ b/configure
@@ -565,7 +565,7 @@ PACKAGE_STRING='tegrarcm 1.0'
PACKAGE_BUGREPORT='amartin@nvidia.com'
PACKAGE_URL=''
-ac_unique_file="config.h.in"
+ac_unique_file="src/main.c"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
@@ -607,6 +607,7 @@ am__EXEEXT_TRUE
EGREP
GREP
CPP
+CRYPTOLIB
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
@@ -5469,6 +5470,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
SAVED_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -lcryptopp"
+CRYPTOLIB=
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -5482,12 +5484,31 @@ enum CryptoPP::ByteOrder bo = CryptoPP::LITTLE_ENDIAN_ORDER
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
- HAVE_CRYPTOPP=1
+ CRYPTOLIB="cryptopp"
else
- as_fn_error $? "libcryptopp is not installed." "$LINENO" 5
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <crypto++/cryptlib.h>
+int
+main ()
+{
+enum CryptoPP::ByteOrder bo = CryptoPP::LITTLE_ENDIAN_ORDER
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ CRYPTOLIB="crypto++"
+else
+ as_fn_error $? "libcrypto++/libcryptopp is not installed." "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+
LDFLAGS=$SAVED_LDFLAGS
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
diff --git a/configure.ac b/configure.ac
index 214857f..3f5b8a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ AC_PREREQ([2.67])
AC_INIT([tegrarcm], [1.0], [amartin@nvidia.com])
AM_INIT_AUTOMAKE(tegrarcm, 1.0)
AC_OUTPUT(Makefile src/Makefile)
-AC_CONFIG_SRCDIR([config.h.in])
+AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
@@ -24,11 +24,18 @@ AC_CHECK_LIB([usb-1.0],
AC_LANG(C++)
SAVED_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -lcryptopp"
+CRYPTOLIB=
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <cryptopp/cryptlib.h>],
[enum CryptoPP::ByteOrder bo = CryptoPP::LITTLE_ENDIAN_ORDER])],
- [HAVE_CRYPTOPP=1],
- [AC_MSG_ERROR([libcryptopp is not installed.])])
+ [CRYPTOLIB="cryptopp"],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#include <crypto++/cryptlib.h>],
+ [enum CryptoPP::ByteOrder bo = CryptoPP::LITTLE_ENDIAN_ORDER])],
+ [CRYPTOLIB="crypto++"],
+ [AC_MSG_ERROR([libcrypto++/libcryptopp is not installed.])])]
+)
+AC_SUBST(CRYPTOLIB)
LDFLAGS=$SAVED_LDFLAGS
AC_LANG(C)
diff --git a/src/Makefile.am b/src/Makefile.am
index 3e8ec33..0b8ea3c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
AM_CFLAGS = -Wall -std=c99 -O2
-AM_CPPFLAGS = -isystem /usr/include/cryptopp
+AM_CPPFLAGS = -isystem /usr/include/$(CRYPTOLIB)
bin_PROGRAMS = tegrarcm
tegrarcm_SOURCES = main.c usb.c nv3p.c debug.c rcm.c aes-cmac.cpp aes-cmac.h debug.h nv3p.h nv3p_status.h rcm.h tegra2-miniloader.h tegra3-miniloader.h usb.h
-tegrarcm_LDADD = -lusb-1.0 -lcryptopp -lpthread
+tegrarcm_LDADD = -lusb-1.0 -l$(CRYPTOLIB) -lpthread
diff --git a/src/Makefile.in b/src/Makefile.in
index b54d3a9..9f5316d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -78,6 +78,7 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CRYPTOLIB = @CRYPTOLIB@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
@@ -158,9 +159,9 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = -Wall -std=c99 -O2
-AM_CPPFLAGS = -isystem /usr/include/cryptopp
+AM_CPPFLAGS = -isystem /usr/include/$(CRYPTOLIB)
tegrarcm_SOURCES = main.c usb.c nv3p.c debug.c rcm.c aes-cmac.cpp aes-cmac.h debug.h nv3p.h nv3p_status.h rcm.h tegra2-miniloader.h tegra3-miniloader.h usb.h
-tegrarcm_LDADD = -lusb-1.0 -lcryptopp -lpthread
+tegrarcm_LDADD = -lusb-1.0 -l$(CRYPTOLIB) -lpthread
all: all-am
.SUFFIXES: