From 043f8ea1e3365578fff3ec195c2f4e98548edad0 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Tue, 21 May 2019 11:07:47 +0100 Subject: [PATCH] Fix --with-pic in configure (#8632) --with-pic should be adding -fPIC (or equivalent) to $internal_cflags, not $common_cflags. Additionally, unused variable aspp was being updated, instead of ASPP. --- Changes | 3 +++ configure | 22 ++++++++++------------ configure.ac | 16 +++++++--------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Changes b/Changes index f65c433263b0..b08e7864dac0 100644 --- a/Changes +++ b/Changes @@ -916,6 +916,9 @@ OCaml 4.08.0 (Sébastien Hinderer, review by David Allsopp, Gabriel Scherer and Damien Doligez) +- #8632: Correctly propagate flags for --with-pic in configure. + (David Allsopp, review by Sébastien Hinderer and Damien Doligez) + - #8673: restore SpaceTime and libunwind support in configure script (Sébastien Hinderer, review by Damien Doligez) diff --git a/configure b/configure index 532bdeca6517..ae1311c38108 100755 --- a/configure +++ b/configure @@ -13743,6 +13743,16 @@ esac ;; #( ;; esac +if test "$with_pic"; then : + fpic=true + $as_echo "#define CAML_WITH_FPIC 1" >>confdefs.h + + internal_cflags="$internal_cflags $sharedlib_cflags" + default_aspp="$default_aspp $sharedlib_cflags" +else + fpic=false +fi + if test -z "$AS"; then : AS="$default_as" fi @@ -16469,18 +16479,6 @@ if $profinfo; then : fi -## PIC - -if test "$with_pic"; then : - fpic=true - $as_echo "#define CAML_WITH_FPIC 1" >>confdefs.h - - common_cflags="$common_cflags $sharedlib_cflags" - aspp="$aspp $sharedlib_cflags" -else - fpic=false -fi - if test x"$enable_installing_bytecode_programs" = "xno"; then : install_bytecode_programs=false else diff --git a/configure.ac b/configure.ac index c0cdf584c954..bd8a47602143 100644 --- a/configure.ac +++ b/configure.ac @@ -986,6 +986,13 @@ AS_CASE(["$arch,$system"], [clang-*], [default_aspp="${toolpref}clang -c -Wno-trigraphs"], [default_aspp="${toolpref}gcc -c"])]) +AS_IF([test "$with_pic"], + [fpic=true + AC_DEFINE([CAML_WITH_FPIC]) + internal_cflags="$internal_cflags $sharedlib_cflags" + default_aspp="$default_aspp $sharedlib_cflags"], + [fpic=false]) + AS_IF([test -z "$AS"], [AS="$default_as"]) AS_IF([test -z "$ASPP"], [ASPP="$default_aspp"]) @@ -1579,15 +1586,6 @@ AS_IF([test x"$enable_spacetime" != "xyes" ], AC_DEFINE_UNQUOTED([PROFINFO_WIDTH], [$profinfo_width]) AS_IF([$profinfo], [AC_DEFINE([WITH_PROFINFO])]) -## PIC - -AS_IF([test "$with_pic"], - [fpic=true - AC_DEFINE([CAML_WITH_FPIC]) - common_cflags="$common_cflags $sharedlib_cflags" - aspp="$aspp $sharedlib_cflags"], - [fpic=false]) - AS_IF([test x"$enable_installing_bytecode_programs" = "xno"], [install_bytecode_programs=false], [install_bytecode_programs=true])