Buildsystem improvements

- Adding Makefile.am
- Fixing configure.ac hacks
- Cleaning configure.ac
This commit is contained in:
amynka@gentoo.org 2018-05-21 14:42:39 +02:00
parent 58c8beefd2
commit 1b1b07d9e6
3 changed files with 62 additions and 63 deletions

1
.gitignore vendored
View File

@ -21,7 +21,6 @@ libtool
ltmain.sh
m4/
Makefile
Makefile.am
Makefile.in
missing
NEWS

15
Makefile.am Normal file
View File

@ -0,0 +1,15 @@
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4
dist_man_MANS = man/ccr.1
dist_noinst_SCRIPTS = autogen.sh
bin_PROGRAMS = ccr
ccr_SOURCES = src/hash.cpp src/sencode.cpp src/gf2m.cpp src/chacha.cpp src/algo_suite.cpp src/fft.cpp src/hashfile.cpp src/symkey.cpp src/bvector.cpp src/str_match.cpp src/keyring.cpp src/ios.cpp src/algos_enc.cpp src/message.cpp src/sc.cpp src/envelope.cpp src/permutation.cpp src/mce_qcmdpc.cpp src/pwrng.cpp src/xsynd.cpp src/serialization.cpp src/generator.cpp src/iohelpers.cpp src/main.cpp src/actions.cpp src/polynomial.cpp src/algos_sig.cpp src/matrix.cpp src/seclock.cpp src/base64.cpp src/privfile.cpp src/fmtseq.cpp
noinst_HEADERS = src/str_match.h src/permutation.h src/rmd_hash.h src/fft.h src/mce_qcmdpc.h src/hash.h src/algo_suite.h src/message.h src/symkey.h src/polynomial.h src/gf2m.h src/factoryof.h src/keyring.h src/sc.h src/fmtseq.h src/cube_hash.h src/xsynd.h src/arcfour.h src/sencode.h src/sha_hash.h src/prng.h src/tiger_hash.h src/generator.h src/decoding.h src/iohelpers.h src/cubehash_impl.h src/algorithm.h src/ios.h src/bvector.h src/hashfile.h src/actions.h src/types.h src/pwrng.h src/algos_sig.h src/matrix.h src/chacha.h src/algos_enc.h src/privfile.h src/vector_item.h src/base64.h src/envelope.h src/seclock.h
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -Wall
ccr_CPPFLAGS = $(FFTW3_CFLAGS) $(CRYPTOPP_CFLAGS)
ccr_LDADD = $(FFTW3_LIBS) $(CRYPTOPP_LIBS)

View File

@ -1,85 +1,70 @@
AC_PREREQ(2.6)
AC_PREREQ([2.69])
AC_INIT([codecrypt], [1.8])
AC_CONFIG_AUX_DIR(.) # because of libtoolize
AC_CONFIG_AUX_DIR([build-aux]) dnl because of libtoolize
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE()
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
CFLAGS="$CFLAGS"
CXXFLAGS="$CXXFLAGS"
LDFLAGS="$LDFLAGS"
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
LT_INIT
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
#check for compilable GMP presence
AC_CHECK_HEADERS([gmp.h], , AC_MSG_ERROR([Codecrypt requires gmp.h]))
AC_CHECK_LIB(gmp, __gmpz_init, , AC_MSG_ERROR([Codecrypt requires libgmp]))
dnl check for compilable GMP presence
AC_CHECK_HEADERS([gmp.h], [], [AC_MSG_ERROR([Codecrypt requires gmp.h])])
AC_SEARCH_LIBS([__gmpz_init], [gmp], [], [AC_MSG_ERROR([Codecrypt requires libgmp])])
#check for FFTW library presence
AC_CHECK_HEADERS([fftw3.h], , AC_MSG_ERROR([Codecrypt requires fftw3.h]))
AC_CHECK_LIB(fftw3, fftw_plan_dft_1d, , AC_MSG_ERROR([Codecrypt requires libfftw3]))
dnl check for FFTW library presence
PKG_CHECK_MODULES([FFTW3], [fftw3])
#check whether to build with crypto++
dnl check whether to build with crypto++
AC_ARG_WITH([cryptopp],
AC_HELP_STRING([--with-cryptopp],[Build algorithms that need Crypto++ support]),
[WITH_CRYPTOPP=$withval],
[WITH_CRYPTOPP=yes])
[AS_HELP_STRING([--with-cryptopp], [Build algorithms that need Crypto++ support])])
#and check crypto++
if test "$WITH_CRYPTOPP" = "yes"; then
PKG_PROG_PKG_CONFIG([0.25])
dnl and check crypto++
AS_IF([test "x$with_cryptopp" != "xno"], [
PKG_PROG_PKG_CONFIG([0.25])
PKG_CHECK_MODULES([CRYPTOPP],[libcrypto++])
PKG_CHECK_MODULES([CRYPTOPP], [libcrypto++], [], [
AC_MSG_CHECKING([for libcrypto++ using known flags])
AC_LANG_PUSH([C++])
saved_LIBS="$LIBS"
LIBS+=" -lcrypto++"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([#include <crypto++/cryptlib.h>], [CryptoPP::NullRNG])], [
CRYPTOPP_LIBS="-lcrypto++"
AC_MSG_RESULT([${CRYPTOPP_LIBS}])
], [
AC_MSG_ERROR([Cannot find crypto++])
])
LIBS="$saved_LIBS"
AC_LANG_POP([C++])
])
#crypto++ headers are either in include/crypto++ or include/cryptopp,
#the information is otherwise unavailable from standard configuration
#means. Please report/add more tests if you encounter distros that
#place them elsewhere.
AC_LANG_PUSH([C++])
AC_CHECK_HEADER([crypto++/config.h],
AC_DEFINE([CRYPTOPP_DIR_PLUS], [1]),
AC_DEFINE([CRYPTOPP_DIR_PLUS], [0])
)
AC_LANG_POP([C++])
AC_DEFINE([HAVE_CRYPTOPP], [1], [Enable support for crypto++ routines])
], [
AC_DEFINE([HAVE_CRYPTOPP], [0], [Enable support for crypto++ routines])
])
AC_DEFINE([HAVE_CRYPTOPP], [1])
else
AC_DEFINE([HAVE_CRYPTOPP], [0])
fi
#check for readpassphrase. If none is found, we use getpass (with a warning)
dnl check for readpassphrase. If none is found, we use getpass (with a warning)
AC_CHECK_HEADER([readpassphrase.h],
[READPASSPHRASE=native],
AC_CHECK_HEADER([bsd/readpassphrase.h],
[READPASSPHRASE=bsd], ))
[READPASSPHRASE=native],
AC_CHECK_HEADER([bsd/readpassphrase.h],
[READPASSPHRASE=bsd], []))
if test "$READPASSPHRASE" = "native"; then
AC_DEFINE([HAVE_READPASSPHRASE], [1])
fi
if test "$READPASSPHRASE" = "bsd"; then
AC_DEFINE([HAVE_BSDREADPASSPHRASE], [1])
AC_CHECK_LIB([bsd], [readpassphrase],
[LIBS="-lbsd $LIBS"], #is there a better version of this?
AC_MSG_ERROR([library for bsd/readpassphrase.h not found]))
fi
AS_IF([test "x$READPASSPHRASE" = "xnative"],[
AC_DEFINE([HAVE_READPASSPHRASE], [1], [Enable readpassphrase])])
#check for standard functions
AC_CHECK_FUNCS([memset mkdir], , AC_MSG_ERROR([Required function missing]))
AS_IF([test "x$READPASSPHRASE" = "xbsd"],[
AC_DEFINE([HAVE_BSDREADPASSPHRASE], [1], [Enable bsdreadpassphrase])
AC_SEARCH_LIBS([readpassphrase], [bsd], [], [AC_MSG_ERROR([library for bsd/readpassphrase.h not found])])])
#unixy headers
AC_CHECK_HEADERS([fcntl.h inttypes.h stddef.h stdlib.h string.h sys/file.h unistd.h], , AC_MSG_ERROR([Required header file missing]))
dnl check for standard functions
AC_CHECK_FUNCS([memset mkdir], [], [AC_MSG_ERROR([Required function missing])])
#other used stuff
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
dnl POSIX headers
AC_CHECK_HEADERS([fcntl.h inttypes.h stddef.h stdlib.h string.h sys/file.h unistd.h], [], [AC_MSG_ERROR([Required header file missing])])
dnl other used stuff
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT32_T