geany/m4/geany-binreloc.m4
Jiří Techet db4bf54b2f Compile prefix.c and osx.c only when needed to avoid warnings
When mac integration or binary relocation are disabled, the compiled
object file contains no symbols because the guards in the source files
hide all code. On OS X there's a warning during compilation saying:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: .libs/libgeany.a(libgeany_la-prefix.o) has no symbols

If these features are disabled, don't compile the corresponding
sources to avoid the warnings.

Interestingly, waf compilation works without warnings - it appears
linking is done through g++ which doesn't produce these warnings.
2015-04-14 22:21:34 +02:00

63 lines
1.9 KiB
Plaintext

dnl GEANY_CHECK_BINRELOC
dnl Check for binary relocation support
dnl
dnl logic taken from Inkscape (Hongli Lai <h.lai@chello.nl>)
AC_DEFUN([GEANY_CHECK_BINRELOC],
[
AC_ARG_ENABLE([binreloc],
[AS_HELP_STRING([--enable-binreloc],
[compile with binary relocation support [default=no]])],
[enable_binreloc=$enableval],
[enable_binreloc=no])
AC_MSG_CHECKING([whether binary relocation support should be enabled])
if test "$enable_binreloc" = "yes"; then
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for linker mappings at /proc/self/maps])
if test -e /proc/self/maps; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([/proc/self/maps is not available. Binary relocation cannot be enabled.])
enable_binreloc="no"
fi
elif test "$enable_binreloc" = "auto"; then
AC_MSG_RESULT([yes when available])
AC_MSG_CHECKING([for linker mappings at /proc/self/maps])
if test -e /proc/self/maps; then
AC_MSG_RESULT([yes])
enable_binreloc=yes
AC_MSG_CHECKING([whether everything is installed to the same prefix])
if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
"$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
"$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_NOTICE([Binary relocation support will be disabled.])
enable_binreloc=no
fi
else
AC_MSG_RESULT([no])
enable_binreloc=no
fi
elif test "$enable_binreloc" = "no"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([no (unknown value "$enable_binreloc")])
enable_binreloc=no
fi
AM_CONDITIONAL(ENABLE_BINRELOC, [test "$enable_binreloc" = "yes"])
AM_COND_IF(ENABLE_BINRELOC,
[
AC_DEFINE([ENABLE_BINRELOC],,[Use AutoPackage?])
])
GEANY_STATUS_ADD([Enable binary relocation], [$enable_binreloc])
])