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 <gmazyland@gmail.com>)
This commit is contained in:
Cristian Rodríguez
2013-06-21 22:38:46 -04:00
committed by Milan Broz
parent cf99ecb5a9
commit 1349efa34d
17 changed files with 31 additions and 52 deletions

View File

@@ -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 ==========================================================================

View File

@@ -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@ \

View File

@@ -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

View File

@@ -23,7 +23,6 @@
#include <stdint.h>
#include <string.h>
#include "config.h"
struct crypt_device;
struct crypt_hash;

View File

@@ -24,10 +24,6 @@
#ifndef INTERNAL_H
#define INTERNAL_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdint.h>
#include <stdarg.h>
#include <unistd.h>

View File

@@ -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

View File

@@ -23,7 +23,6 @@
#define _LOOPAES_H
#include <unistd.h>
#include "config.h"
struct crypt_device;
struct volume_key;

View File

@@ -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

View File

@@ -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

View File

@@ -24,7 +24,6 @@
#define _UTILS_CRYPT_H
#include <unistd.h>
#include "config.h"
#define MAX_CIPHER_LEN 32
#define MAX_CIPHER_LEN_STR "32"

View File

@@ -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; }

View File

@@ -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

View File

@@ -22,7 +22,6 @@
#define _VERITY_H
#include <unistd.h>
#include "config.h"
#define VERITY_MAX_HASH_TYPE 1
#define VERITY_BLOCK_SIZE_OK(x) ((x) % 512 || (x) < 512 || \

View File

@@ -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:

View File

@@ -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@ \

View File

@@ -24,11 +24,6 @@
#ifndef CRYPTSETUP_H
#define CRYPTSETUP_H
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <config.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>

View File

@@ -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