configure: Add submodule dependency for libpbc.

This commit is contained in:
Jason Volk 2020-02-03 19:28:45 -08:00
parent 9106e927ba
commit 2eeee6aa48
4 changed files with 111 additions and 1 deletions

7
.gitmodules vendored
View File

@ -8,3 +8,10 @@
path = deps/gecko-dev
url = https://github.com/mozilla/gecko-dev.git
branch = esr45
[submodule "pbc"]
path = pbc
url = https://github.com/blynn/pbc.git
branch = master
[submodule "deps/pbc"]
path = deps/pbc
url = https://github.com/blynn/pbc.git

View File

@ -1476,6 +1476,61 @@ AC_CHECK_LIB([gmp], [__gmp_version],
AM_CONDITIONAL([GMP], [test "x$have_gmp" = "xyes" ])
dnl
dnl
dnl libpbc support
dnl
dnl
AC_SUBST(PBC_CPPFLAGS, [])
AC_SUBST(PBC_LDFLAGS, [])
AC_SUBST(PBC_LIBS, [])
AC_ARG_WITH(pbc-includes,
AC_HELP_STRING([--with-pbc-includes=[[[DIR]]]], [Path to libpbc include directory]),
[
PBC_CPPFLAGS="-isystem $withval"
], [])
AC_ARG_WITH(pbc-libs,
AC_HELP_STRING([--with-pbc-libs=[[[DIR]]]], [Path to libpbc library directory]),
[
PBC_LDFLAGS="-L$withval"
], [])
AC_MSG_CHECKING([whether you asked to use the Pairing-Based Cryptography library included here])
AC_ARG_WITH(included-pbc,
AC_HELP_STRING([--with-included-pbc], [Use the libpbc sources from included submodule]),
[
AC_MSG_RESULT([yes])
have_pbc="yes"
with_included_pbc="yes"
AC_DEFINE(HAVE_PBC, 1, [Define to 1 if libpbc is available.])
PBC_CPPFLAGS="-isystem $PWD/deps/pbc/include"
PBC_LDFLAGS="-L$PWD/deps/pbc/"
PBC_LIBS="$PWD/deps/pbc/libpbc.a"
bash tools/buildpbc.sh
AS_IF([ test $? != 0 ],
[
AC_MSG_ERROR([Failed to build Pairing-Based Cryptography library included submodule])
])
], [
with_included_pbc="no"
AC_CHECK_LIB([pbc], [pbc_set_memory_functions],
[
have_pbc="yes"
AC_DEFINE(HAVE_PBC, 1, [Define to 1 if libpbc is available.])
PBC_LIBS="-lpbc"
], [
have_pbc="no"
AC_MSG_WARN([Unable to find Pairing-Based Cryptography (libpbc) on this system.])
])
])
AM_CONDITIONAL([PBC], [test "x$have_pbc" = "xyes" ])
dnl
dnl
dnl ImageMagick support
@ -2087,9 +2142,10 @@ echo "Ziplinks (libz) support ........... $have_zlib"
echo "LZ4 support ....................... $have_lz4"
echo "Snappy support .................... $have_snappy"
echo "GNU MP support .................... $have_gmp"
echo "Crypto support .................... $have_crypto"
echo "Sodium support .................... $have_sodium"
echo "SSL support ....................... $have_ssl"
echo "Crypto support .................... $have_crypto"
echo "PBC support ....................... $have_pbc"
echo "Magic support ..................... $have_magic"
echo "ImageMagick support ............... $have_imagemagick"
echo "LLVM library support .............. $have_libllvm"

1
deps/pbc vendored Submodule

@ -0,0 +1 @@
Subproject commit fbf4589036ce4f662e2d06905862c9e816cf9d08

46
tools/buildpbc.sh Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
run ()
{
COMMAND=$1
# check for empty commands
if test -z "$COMMAND" ; then
echo -e "\033[1;5;31mERROR\033[0m No command specified!"
return 1
fi
shift;
OPTIONS="$@"
# print a message
if test -n "$OPTIONS" ; then
echo -ne "\033[1m$COMMAND $OPTIONS\033[0m ... "
else
echo -ne "\033[1m$COMMAND\033[0m ... "
fi
# run or die
$COMMAND $OPTIONS ; RESULT=$?
if test $RESULT -ne 0 ; then
echo -e "\033[1;5;31mERROR\033[0m $COMMAND failed. (exit code = $RESULT)"
exit 1
fi
echo -e "\033[0;32myes\033[0m"
return 0
}
echo "*** Building The PBC Library... "
USERDIR=$PWD # Save current dir and return to it later
run git submodule update --init deps/pbc
run cd deps/pbc
run git fetch --tags
run git checkout master
NJOBS=`nproc`
run bash ./setup
run bash ./configure
run make -j$NJOBS
run cd $USERDIR # Return to user's original directory