From 1349efa34db577947083daee2e521770614fcfe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Fri, 21 Jun 2013 22:38:46 -0400 Subject: Fix buildsytem to always include config.h. - config.h must always be the first file to be included - Use AM_CFLAGS and AM_LDFLAGS consistently and properly. (Modified to disable build without largefile support etc by Milan Broz ) --- configure.ac | 6 +++++- lib/Makefile.am | 11 ++++------- lib/crypto_backend/Makefile.am | 4 ++-- lib/crypto_backend/crypto_backend.h | 1 - lib/internal.h | 4 ---- lib/loopaes/Makefile.am | 6 ++---- lib/loopaes/loopaes.h | 1 - lib/luks1/Makefile.am | 6 ++---- lib/tcrypt/Makefile.am | 6 ++---- lib/utils_crypt.h | 1 - lib/utils_fips.c | 1 - lib/verity/Makefile.am | 6 ++---- lib/verity/verity.h | 1 - python/Makefile.am | 4 ++-- src/Makefile.am | 13 ++++++------- src/cryptsetup.h | 5 ----- tests/Makefile.am | 7 ++++--- 17 files changed, 31 insertions(+), 52 deletions(-) diff --git a/configure.ac b/configure.ac index 5796ff9..325735d 100644 --- a/configure.ac +++ b/configure.ac @@ -50,11 +50,15 @@ LIBS=$saved_LIBS AC_CHECK_FUNCS([posix_memalign]) +if test "x$enable_largefile" = "xno" ; then + AC_MSG_ERROR([Building with --disable-largefile is not supported, it can cause data corruption.]) +fi + AC_C_CONST AC_C_BIGENDIAN AC_TYPE_OFF_T AC_SYS_LARGEFILE - +AC_FUNC_FSEEKO AC_PROG_GCC_TRADITIONAL dnl ========================================================================== diff --git a/lib/Makefile.am b/lib/Makefile.am index 67961fd..0f5b549 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -5,7 +5,7 @@ moduledir = $(libdir)/cryptsetup pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libcryptsetup.pc -AM_CPPFLAGS = \ +AM_CPPFLAGS = -include config.h \ -I$(top_srcdir) \ -I$(top_srcdir)/lib/crypto_backend \ -I$(top_srcdir)/lib/luks1 \ @@ -16,10 +16,7 @@ AM_CPPFLAGS = \ -DLIBDIR=\""$(libdir)"\" \ -DPREFIX=\""$(prefix)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DVERSION=\""$(VERSION)"\" \ - -D_GNU_SOURCE \ - -D_LARGEFILE64_SOURCE \ - -D_FILE_OFFSET_BITS=64 + -DVERSION=\""$(VERSION)"\" lib_LTLIBRARIES = libcryptsetup.la @@ -32,11 +29,11 @@ common_ldadd = \ libcryptsetup_la_DEPENDENCIES = $(common_ldadd) libcryptsetup.sym -libcryptsetup_la_LDFLAGS = \ +libcryptsetup_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined \ -Wl,--version-script=$(top_srcdir)/lib/libcryptsetup.sym \ -version-info @LIBCRYPTSETUP_VERSION_INFO@ -libcryptsetup_la_CFLAGS = -Wall @CRYPTO_CFLAGS@ +libcryptsetup_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@ libcryptsetup_la_LIBADD = \ @UUID_LIBS@ \ diff --git a/lib/crypto_backend/Makefile.am b/lib/crypto_backend/Makefile.am index b8c04bb..e981159 100644 --- a/lib/crypto_backend/Makefile.am +++ b/lib/crypto_backend/Makefile.am @@ -2,7 +2,7 @@ moduledir = $(libdir)/cryptsetup noinst_LTLIBRARIES = libcrypto_backend.la -libcrypto_backend_la_CFLAGS = -Wall @CRYPTO_CFLAGS@ +libcrypto_backend_la_CFLAGS = $(AM_CFLAGS) -Wall @CRYPTO_CFLAGS@ libcrypto_backend_la_SOURCES = crypto_backend.h \ crypto_cipher_kernel.c pbkdf_check.c crc32.c @@ -27,4 +27,4 @@ if CRYPTO_INTERNAL_PBKDF2 libcrypto_backend_la_SOURCES += pbkdf2_generic.c endif -AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/lib +AM_CPPFLAGS = -include config.h -I$(top_srcdir)/lib diff --git a/lib/crypto_backend/crypto_backend.h b/lib/crypto_backend/crypto_backend.h index 32a5976..06f5c81 100644 --- a/lib/crypto_backend/crypto_backend.h +++ b/lib/crypto_backend/crypto_backend.h @@ -23,7 +23,6 @@ #include #include -#include "config.h" struct crypt_device; struct crypt_hash; diff --git a/lib/internal.h b/lib/internal.h index b1a1936..9ca5d48 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -24,10 +24,6 @@ #ifndef INTERNAL_H #define INTERNAL_H -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include #include #include diff --git a/lib/loopaes/Makefile.am b/lib/loopaes/Makefile.am index ededc1a..0687c40 100644 --- a/lib/loopaes/Makefile.am +++ b/lib/loopaes/Makefile.am @@ -2,15 +2,13 @@ moduledir = $(libdir)/cryptsetup noinst_LTLIBRARIES = libloopaes.la -libloopaes_la_CFLAGS = -Wall @CRYPTO_CFLAGS@ +libloopaes_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@ libloopaes_la_SOURCES = \ loopaes.c \ loopaes.h -AM_CPPFLAGS = -D_GNU_SOURCE \ - -D_LARGEFILE64_SOURCE \ - -D_FILE_OFFSET_BITS=64 \ +AM_CPPFLAGS = -include config.h \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/crypto_backend diff --git a/lib/loopaes/loopaes.h b/lib/loopaes/loopaes.h index 10ab5f7..00d1a87 100644 --- a/lib/loopaes/loopaes.h +++ b/lib/loopaes/loopaes.h @@ -23,7 +23,6 @@ #define _LOOPAES_H #include -#include "config.h" struct crypt_device; struct volume_key; diff --git a/lib/luks1/Makefile.am b/lib/luks1/Makefile.am index cc2ecc3..5d6800e 100644 --- a/lib/luks1/Makefile.am +++ b/lib/luks1/Makefile.am @@ -2,7 +2,7 @@ moduledir = $(libdir)/cryptsetup noinst_LTLIBRARIES = libluks1.la -libluks1_la_CFLAGS = -Wall @CRYPTO_CFLAGS@ +libluks1_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@ libluks1_la_SOURCES = \ af.c \ @@ -11,9 +11,7 @@ libluks1_la_SOURCES = \ af.h \ luks.h -AM_CPPFLAGS = -D_GNU_SOURCE \ - -D_LARGEFILE64_SOURCE \ - -D_FILE_OFFSET_BITS=64 \ +AM_CPPFLAGS = -include config.h \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/crypto_backend diff --git a/lib/tcrypt/Makefile.am b/lib/tcrypt/Makefile.am index 03d5ee9..88bf520 100644 --- a/lib/tcrypt/Makefile.am +++ b/lib/tcrypt/Makefile.am @@ -2,15 +2,13 @@ moduledir = $(libdir)/cryptsetup noinst_LTLIBRARIES = libtcrypt.la -libtcrypt_la_CFLAGS = -Wall @CRYPTO_CFLAGS@ +libtcrypt_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@ libtcrypt_la_SOURCES = \ tcrypt.c \ tcrypt.h -AM_CPPFLAGS = -D_GNU_SOURCE \ - -D_LARGEFILE64_SOURCE \ - -D_FILE_OFFSET_BITS=64 \ +AM_CPPFLAGS = -include config.h \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/crypto_backend diff --git a/lib/utils_crypt.h b/lib/utils_crypt.h index e447d9f..3026a7d 100644 --- a/lib/utils_crypt.h +++ b/lib/utils_crypt.h @@ -24,7 +24,6 @@ #define _UTILS_CRYPT_H #include -#include "config.h" #define MAX_CIPHER_LEN 32 #define MAX_CIPHER_LEN_STR "32" diff --git a/lib/utils_fips.c b/lib/utils_fips.c index a4df016..0391d61 100644 --- a/lib/utils_fips.c +++ b/lib/utils_fips.c @@ -23,7 +23,6 @@ #include "libcryptsetup.h" #include "nls.h" #include "utils_fips.h" -#include "config.h" #if !ENABLE_FIPS int crypt_fips_mode(void) { return 0; } diff --git a/lib/verity/Makefile.am b/lib/verity/Makefile.am index 2225e3c..b5ffc92 100644 --- a/lib/verity/Makefile.am +++ b/lib/verity/Makefile.am @@ -2,15 +2,13 @@ moduledir = $(libdir)/cryptsetup noinst_LTLIBRARIES = libverity.la -libverity_la_CFLAGS = -Wall @CRYPTO_CFLAGS@ +libverity_la_CFLAGS = -Wall $(AM_CFLAGS) @CRYPTO_CFLAGS@ libverity_la_SOURCES = \ verity_hash.c \ verity.c \ verity.h -AM_CPPFLAGS = -D_GNU_SOURCE \ - -D_LARGEFILE64_SOURCE \ - -D_FILE_OFFSET_BITS=64 \ +AM_CPPFLAGS = -include config.h \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/lib/crypto_backend diff --git a/lib/verity/verity.h b/lib/verity/verity.h index debeeb6..4f457cb 100644 --- a/lib/verity/verity.h +++ b/lib/verity/verity.h @@ -22,7 +22,6 @@ #define _VERITY_H #include -#include "config.h" #define VERITY_MAX_HASH_TYPE 1 #define VERITY_BLOCK_SIZE_OK(x) ((x) % 512 || (x) < 512 || \ diff --git a/python/Makefile.am b/python/Makefile.am index 199ecc3..a3880a8 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/lib $(PYTHON_INCLUDES) +AM_CPPFLAGS = -include $(top_srcdir)/config.h -I$(top_srcdir)/lib $(PYTHON_INCLUDES) EXTRA_DIST = pycryptsetup-test.py CLEANFILES = *.img @@ -9,7 +9,7 @@ pyexec_LTLIBRARIES = pycryptsetup.la pycryptsetup_la_SOURCES = pycryptsetup.c pycryptsetup_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) -fno-strict-aliasing -pycryptsetup_la_LDFLAGS = -avoid-version -module +pycryptsetup_la_LDFLAGS = -avoid-version -module -shared -export-dynamic pycryptsetup_la_LIBADD = $(top_builddir)/lib/libcryptsetup.la -lpython$(PYTHON_VERSION) else all: diff --git a/src/Makefile.am b/src/Makefile.am index d0d77be..eeec03f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = \ +AM_CPPFLAGS = -include config.h \ -I$(top_srcdir) \ -I$(top_srcdir)/lib \ -DDATADIR=\""$(datadir)"\" \ @@ -6,8 +6,7 @@ AM_CPPFLAGS = \ -DLIBDIR=\""$(libdir)"\" \ -DPREFIX=\""$(prefix)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DVERSION=\""$(VERSION)"\" \ - -D_GNU_SOURCE + -DVERSION=\""$(VERSION)"\" # cryptsetup cryptsetup_SOURCES = \ @@ -25,7 +24,7 @@ cryptsetup_LDADD = \ @FIPSCHECK_LIBS@ \ @PWQUALITY_LIBS@ -cryptsetup_CFLAGS = -Wall +cryptsetup_CFLAGS = $(AM_CFLAGS) -Wall sbin_PROGRAMS=cryptsetup @@ -33,7 +32,7 @@ if STATIC_TOOLS sbin_PROGRAMS += cryptsetup.static cryptsetup_static_SOURCES = $(cryptsetup_SOURCES) cryptsetup_static_CFLAGS = $(cryptsetup_CFLAGS) -cryptsetup_static_LDFLAGS = -all-static +cryptsetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static cryptsetup_static_LDADD = $(cryptsetup_LDADD) \ @CRYPTO_STATIC_LIBS@ \ @PWQUALITY_STATIC_LIBS@ \ @@ -63,7 +62,7 @@ if STATIC_TOOLS sbin_PROGRAMS += veritysetup.static veritysetup_static_SOURCES = $(veritysetup_SOURCES) veritysetup_static_CFLAGS = $(veritysetup_CFLAGS) -veritysetup_static_LDFLAGS = -all-static +veritysetup_static_LDFLAGS = $(AM_LDFLAGS) -all-static veritysetup_static_LDADD = $(veritysetup_LDADD) \ @CRYPTO_STATIC_LIBS@ \ @DEVMAPPER_STATIC_LIBS@ \ @@ -88,7 +87,7 @@ if STATIC_TOOLS sbin_PROGRAMS += cryptsetup-reencrypt.static cryptsetup_reencrypt_static_SOURCES = $(cryptsetup_reencrypt_SOURCES) cryptsetup_reencrypt_static_CFLAGS = $(cryptsetup_reencrypt_CFLAGS) -cryptsetup_reencrypt_static_LDFLAGS = -all-static +cryptsetup_reencrypt_static_LDFLAGS = $(AM_LDFLAGS) -all-static cryptsetup_reencrypt_static_LDADD = $(cryptsetup_reencrypt_LDADD) \ @CRYPTO_STATIC_LIBS@ \ @DEVMAPPER_STATIC_LIBS@ \ diff --git a/src/cryptsetup.h b/src/cryptsetup.h index d427564..1d16a3d 100644 --- a/src/cryptsetup.h +++ b/src/cryptsetup.h @@ -24,11 +24,6 @@ #ifndef CRYPTSETUP_H #define CRYPTSETUP_H -#define _LARGEFILE64_SOURCE -#define _FILE_OFFSET_BITS 64 - -#include - #include #include #include diff --git a/tests/Makefile.am b/tests/Makefile.am index 36b80eb..677ad52 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,12 +33,13 @@ clean-local: -rm -rf tcrypt-images differ_SOURCES = differ.c -differ_CFLAGS = -Wall -O2 +differ_CFLAGS = $(AM_CFLAGS) -Wall -O2 api_test_SOURCES = api-test.c $(top_srcdir)/lib/utils_loop.c api_test_LDADD = ../lib/libcryptsetup.la -api_test_LDFLAGS = -static -api_test_CFLAGS = -g -Wall -O0 -I$(top_srcdir)/lib/ -I$(top_srcdir)/lib/luks1 +api_test_LDFLAGS = $(AM_LDFLAGS) -static +api_test_CFLAGS = -g -Wall -O0 $(AM_CFLAGS) -I$(top_srcdir)/lib/ -I$(top_srcdir)/lib/luks1 +api_test_CPPFLAGS = $(AM_CPPFLAGS) -include config.h check_PROGRAMS = api-test differ -- cgit v1.2.3