From 2f8497aae7e2f7c173c54080d94a06818890634d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Wed, 3 Sep 2014 19:35:43 +0200 Subject: [PATCH] Reorganized PIC handling, deleting CCPIC_MAYBE. --- ChangeLog | 17 +++++++++++++++++ Makefile.in | 9 +++++---- aclocal.m4 | 3 +-- config.make.in | 9 +++------ configure.ac | 18 ++++++------------ 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index a213a3fa..5ef350e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2014-09-03 Niels Möller <nisse@lysator.liu.se> + + * aclocal.m4 (LSH_CCPIC): Don't substitute CCPIC here, let + configure.ac do that if needed. + + * configure.ac (CCPIC_MAYBE, SHLIBCFLAGS): Deleted substituted + variables. Instead, use CCPIC directly when compiling all library + files. + (CCPIC): Set to empty, if --disable-pic is used. + + * config.make.in (SHLIBCFLAGS, CCPIC_MAYBE): Deleted. + (COMPILE, COMPILE_CXX): Drop CCPIC. New variable EXTRA_CFLAGS, + which can be set by individual Makefiles. + + * Makefile.in (EXTRA_CFLAGS): Set using CCPIC. + Also delete all uses of CCPIC_MAYBE and SHLIBCFLAGS. + 2014-09-02 Niels Möller <nisse@lysator.liu.se> * curve25519-eh-to-x.c (curve25519_eh_to_x): New file, new diff --git a/Makefile.in b/Makefile.in index 50fcfb4b..3f859b2a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -23,6 +23,7 @@ include config.make # $(srcdir) is needed for includes in bignum.h. PRE_CPPFLAGS = -I. -I$(srcdir) +EXTRA_CFLAGS = $(CCPIC) # FIXME: Add configuration of LIBEXT? LIBTARGETS = @IF_STATIC@ libnettle.a @IF_HOGWEED@ libhogweed.a @@ -238,7 +239,7 @@ libhogweed.a: $(hogweed_OBJS) echo hogweed > libhogweed.stamp .c.$(OBJEXT): - $(COMPILE) $(CCPIC_MAYBE) -c $< \ + $(COMPILE) -c $< \ && $(DEP_PROCESS) # Rules building shared libraries. @@ -265,7 +266,7 @@ $(LIBHOGWEED_FORLINK): $(hogweed_PURE_OBJS) $(LIBNETTLE_FORLINK) echo hogweed > libhogweed.stamp .c.p$(OBJEXT): - $(COMPILE) $(SHLIBCFLAGS) -c $< -o $@ \ + $(COMPILE) -c $< -o $@ \ && $(DEP_PROCESS) # For Solaris and BSD make, we have to use an explicit rule for each @@ -378,11 +379,11 @@ ecc-25519.p$(OBJEXT): ecc-25519.h && test -s $@T && mv -f $@T $@ .s.$(OBJEXT): - $(COMPILE) $(CCPIC_MAYBE) -c $< + $(COMPILE) -c $< @echo > $@.d .s.p$(OBJEXT): - $(COMPILE) $(SHLIBCFLAGS) -c $< -o $@ + $(COMPILE) -c $< -o $@ @echo > $@.d # Texinfo rules diff --git a/aclocal.m4 b/aclocal.m4 index b77b8863..36daec6f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -58,8 +58,7 @@ AC_CACHE_VAL(lsh_cv_sys_ccpic,[ CFLAGS="$OLD_CFLAGS" ]) CCPIC="$lsh_cv_sys_ccpic" -AC_MSG_RESULT($CCPIC) -AC_SUBST([CCPIC])]) +AC_MSG_RESULT($CCPIC)]) dnl LSH_PATH_ADD(path-id, directory) AC_DEFUN([LSH_PATH_ADD], diff --git a/config.make.in b/config.make.in index ac3393de..a8ab49fa 100644 --- a/config.make.in +++ b/config.make.in @@ -5,7 +5,6 @@ CXX = @CXX@ CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ CCPIC = @CCPIC@ -CCPIC_MAYBE = @CCPIC_MAYBE@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ LDFLAGS = @LDFLAGS@ @@ -29,8 +28,6 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ -SHLIBCFLAGS = @SHLIBCFLAGS@ - LIBNETTLE_MAJOR = @LIBNETTLE_MAJOR@ LIBNETTLE_MINOR = @LIBNETTLE_MINOR@ LIBNETTLE_SONAME = @LIBNETTLE_SONAME@ @@ -69,10 +66,10 @@ includedir = @includedir@ infodir = @infodir@ # PRE_CPPFLAGS and PRE_LDFLAGS lets each Makefile.in prepend its own -# flags before CPPFLAGS and LDFLAGS. +# flags before CPPFLAGS and LDFLAGS. While EXTRA_CFLAGS are added at the end. -COMPILE = $(CC) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(CCPIC) $(DEP_FLAGS) -COMPILE_CXX = $(CXX) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CCPIC) $(DEP_FLAGS) +COMPILE = $(CC) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(DEP_FLAGS) +COMPILE_CXX = $(CXX) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DEP_FLAGS) LINK = $(CC) $(CFLAGS) $(PRE_LDFLAGS) $(LDFLAGS) LINK_CXX = $(CXX) $(CXXFLAGS) $(PRE_LDFLAGS) $(LDFLAGS) diff --git a/configure.ac b/configure.ac index 19fe06cb..4591701d 100644 --- a/configure.ac +++ b/configure.ac @@ -390,9 +390,12 @@ AC_CONFIG_COMMANDS([asm.d], [ asm_file_list="$asm_file_list" ] ) -LSH_CCPIC - -SHLIBCFLAGS="$CCPIC" +if test "x$enable_pic" = xyes; then + LSH_CCPIC +else + CCPIC='' +fi +AC_SUBST(CCPIC) IF_DLL='#' LIBNETTLE_FILE_SRC='$(LIBNETTLE_FORLINK)' @@ -490,13 +493,6 @@ case "$host_os" in ;; esac -if test "x$enable_pic" = xyes; then - CCPIC_MAYBE="$CCPIC" -else - CCPIC_MAYBE='' -fi -AC_SUBST([CCPIC_MAYBE]) - ASM_SYMBOL_PREFIX='' ASM_ELF_STYLE='no' ASM_COFF_STYLE='no' @@ -627,8 +623,6 @@ AC_SUBST(ASM_ALIGN_LOG) AC_SUBST(W64_ABI) AC_SUBST(EMULATOR) -AC_SUBST(SHLIBCFLAGS) - AC_SUBST(LIBNETTLE_MAJOR) AC_SUBST(LIBNETTLE_MINOR) AC_SUBST(LIBNETTLE_FORLINK) -- GitLab