fixed linking to be clang compatible, made -g and -O? configurable

This commit is contained in:
git@daemon.de
2015-01-07 12:31:21 +01:00
parent d92d130dbd
commit 6600d79325
5 changed files with 76 additions and 12 deletions

View File

@@ -18,9 +18,13 @@
#
# You can contact me by mail: <tlinden AT cpan DOT org>.
#
AM_CXXFLAGS = -I../../include -I../../libpcp/scrypt/crypto -I../../libpcp/scrypt/util -Wall -g
AM_CXXFLAGS = -I../../include -I../../libpcp/scrypt/crypto -I../../libpcp/scrypt/util
lib_LTLIBRARIES = libpcp1++.la
libpcp1___la_SOURCES = pcp++.h ptx.cpp key.cpp vault.cpp crypto.cpp sign.cpp buffer.cpp
include_HEADERS = pcp++.h
libpcp1___la_CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@

View File

@@ -34,6 +34,7 @@ LT_INIT
ORIG_CFLAGS="${CFLAGS:-none}"
# Checks for programs
AC_PROG_CXX
AC_PROG_CXXCPP
@@ -45,7 +46,9 @@ AC_PROG_SED
AC_PROG_AWK
AC_PROG_INSTALL
# remove flags set by AC_PROG_CC (duplicates and/or invalid for clang)
CFLAGS=""
CXXFLAGS=""
# Host speciffic checks
@@ -291,9 +294,37 @@ if test "x$bigendian" = "xyes"; then
CFLAGS="$CFLAGS -D__CPU_IS_BIG_ENDIAN=1"
fi
CFLAGS="$CFLAGS -Werror -Wextra -O2"
# prepare FLAGS
CFLAGS="$CFLAGS -Werror -Wextra -Wall"
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--disable-debug], [Disable debugging]))
AS_IF([test "x$enable_debug" != "xno"], [
CFLAGS="$CFLAGS -g"
enable_debug="yes"
])
AC_ARG_ENABLE([optimize],
AS_HELP_STRING([--disable-optimize], [Disable optimization]))
AS_IF([test "x$enable_optimize" != "xno"], [
case $enable_optimize in
-O*)
CFLAGS="$CFLAGS $enable_optimize"
enable_optimize="$enable_optimize"
;;
*)
CFLAGS="$CFLAGS -O2"
enable_optimize="-O2"
;;
esac
])
CXXFLAGS="$CFLAGS"
# conditionals for bindings and stuff
# c++
@@ -302,12 +333,17 @@ AC_ARG_ENABLE([cpp-binding],
[Disable C++ binding])],
)
AS_IF([test "x$enable_cpp_binding" != "xno"], [
enable_cpp_binding=yes
])
AM_CONDITIONAL([BUILDCPP], [test "x$enable_cpp_binding" != "xno"])
# py
AC_ARG_ENABLE([python-binding],
[AS_HELP_STRING([--enable-python-binding],
[Enable python binding])],
[Enable python binding])
],
[python="yes"],
[])
@@ -336,20 +372,26 @@ AC_CONFIG_FILES([Makefile include/Makefile libpcp/Makefile src/Makefile man/Make
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE $VERSION
Build configured for $PACKAGE $VERSION:
CC: ${CC}
CFLAGS: ${CFLAGS}
CXX: ${CXX}
CXXFLAGS: ${CXXFLAGS}
LDFLAGS: ${LDFLAGS}
LIBS: ${LIBS}
debug: ${enable_debug}
optimize: ${enable_optimize}
prefix: ${prefix}
sysconfdir: ${sysconfdir}
libdir: ${libdir}
includedir: ${includedir}
bigendian: ${bigendian}
target platform: ${host}
big endian cpu: ${bigendian}
build python binding: ${python}
build c++ binding: ${enable_cpp_binding}
Type 'make' to build, 'make install' to install.
To execute unit tests, type 'make test'.
])

View File

@@ -18,7 +18,9 @@
#
# You can contact me by mail: <tlinden AT cpan DOT org>.
#
AM_CFLAGS = -I../include/pcp -Iscrypt/crypto -Iscrypt/util -Wall -g
AM_CFLAGS = -I../include/pcp -Iscrypt/crypto -Iscrypt/util
lib_LTLIBRARIES = libpcp1.la
@@ -33,3 +35,7 @@ libpcp1_la_SOURCES = platform.c mac.c mem.c pad.c version.c \
base85.c util.c buffer.c mgmt.c keysig.c pcpstream.c
include_HEADERS = ../include/pcp.h
libpcp1_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@

View File

@@ -20,7 +20,7 @@
#
AM_CFLAGS = -I../include/pcp -I../libpcp/scrypt/crypto -Wall -g
AM_CFLAGS = -I../include/pcp -I../libpcp/scrypt/crypto
bin_PROGRAMS = pcp1
@@ -29,3 +29,6 @@ pcp1_SOURCES = pcp.c keymgmt.c keyprint.c readpass.c \
encryption.c z85util.c signature.c \
compat_getopt.c
pcp1_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@

View File

@@ -19,10 +19,19 @@
# You can contact me by mail: <tlinden AT cpan DOT org>.
#
AM_CFLAGS = -I../include/pcp -I../src -I../libpcp/scrypt/crypto -Wall -g
AM_CFLAGS = -I../include/pcp -I../src -I../libpcp/scrypt/crypto
check_PROGRAMS = col invalidkeys gencheader statictest cpptest \
buffertest sample streamtest pipetest decodertest mangle
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
gencheader_LDADD = ../libpcp/.libs/libpcp1.a
gencheader_SOURCES = gencheader.c
@@ -54,7 +63,7 @@ invalidkeys_LDADD = ../libpcp/.libs/libpcp1.a \
../src/keyprint.o ../src/keymgmt.o ../src/readpass.o
invalidkeys_SOURCES = invalidkeys.c
AM_CXXFLAGS = -I../include -I../bindings/cpp -I../libpcp/scrypt/crypto -Wall -g
AM_CXXFLAGS = -I../include -I../bindings/cpp -I../libpcp/scrypt/crypto
cpptest_LDADD = ../bindings/cpp/.libs/libpcp1++.a ../libpcp/.libs/libpcp1.a
cpptest_SOURCES = cpptest.cpp