summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2018-05-10 18:25:56 +0530
committerAmar Tumballi <amarts@redhat.com>2018-05-18 04:22:42 +0000
commit89e1a4e5720509c096ff6860c1a8c483e0019278 (patch)
tree88f1fabf37eff57db85c23822f305f4f16c4e280 /configure.ac
parentc2cf3f686f3ea0efd936d2eafc404fc9d2e0acc7 (diff)
build: Disallow unresolved symbol references
In the past, it was often[1] forgotten for xlators to be linked against the symbols they refer to. This often caused glusterd2 to fail while loading xlator's shared object (.so) file. This change adds "--no-undefined" as a linker flag which causes the linker to treat unresolved symbol references as an error and hence fail linking. [1]: https://review.gluster.org/#/c/19912/ https://review.gluster.org/#/c/19664/ https://review.gluster.org/#/c/19056/ https://review.gluster.org/#/c/17659/ https://bugzilla.redhat.com/show_bug.cgi?id=1532238 Bonus: Added cloudsync and utime xlator's generated source files to .gitignore Updates: bz#1193929 Change-Id: I9604a4a87b7313a5fa43bda5fdb37dfa7ef8facd Signed-off-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac27
1 files changed, 21 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index b818d3fac0d..fe25ec2bc02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -340,11 +340,12 @@ AC_ARG_WITH([ipv6-default],
AC_HELP_STRING([--with-ipv6-default], [Set IPv6 as default.]),
[with_ipv6_default=${with_libtirpc}], [with_ipv6_default="no"])
-if test "x$ac_cv_file__etc_redhat_release" = "xyes"; then
- if rpm -qa centos-release | grep centos; then
- if rpm -q centos-release | grep "release-6"; then
- with_ipv6_default="no"
- fi
+AC_CHECK_FILE([/etc/centos-release])
+if test "x$ac_cv_file__etc_centos_release" = "xyes"; then
+ dnl On CentOS '-ldl' isn't automatically added to LIBS
+ AC_CHECK_LIB([dl], [dlopen])
+ if grep "release 6" /etc/centos-release; then
+ with_ipv6_default="no"
fi
fi
@@ -1600,7 +1601,20 @@ AC_SUBST(USE_EC_DYNAMIC_NEON)
dnl libglusterfs.so uses math functions
GF_LDADD="${GF_LDADD} ${MATH_LIB}"
-GF_XLATOR_DEFAULT_LDFLAGS='-avoid-version -export-symbols $(top_srcdir)/xlators/xlator.sym'
+case $host_os in
+ dnl Can't use libtool's portable "-no-undefined" as it seems to be ignored on Linux
+ linux*)
+ GF_NO_UNDEFINED='-Wl,--no-undefined'
+ ;;
+ darwin*)
+ GF_NO_UNDEFINED='-Wl,-undefined'
+ ;;
+ *)
+ dnl There's an issue on FreeBSD with reference to __progname used in some parts of code
+ GF_NO_UNDEFINED=''
+ ;;
+esac
+GF_XLATOR_DEFAULT_LDFLAGS='-avoid-version -export-symbols $(top_srcdir)/xlators/xlator.sym '${GF_NO_UNDEFINED}
AC_SUBST(GF_HOST_OS)
AC_SUBST(GF_CFLAGS)
@@ -1612,6 +1626,7 @@ AC_SUBST(RLLIBS)
AC_SUBST(LIBAIO)
AC_SUBST(AM_MAKEFLAGS)
AC_SUBST(AM_LIBTOOLFLAGS)
+AC_SUBST(GF_NO_UNDEFINED)
AC_SUBST(GF_XLATOR_DEFAULT_LDFLAGS)
CONTRIBDIR='$(top_srcdir)/contrib'