NEWS for release 1.38
[geany-mirror.git] / m4 / geany-binreloc.m4
blob64abf5977b653476b246cc944eca33ea83fb22bd
1 dnl GEANY_CHECK_BINRELOC
2 dnl Check for binary relocation support
3 dnl
4 dnl logic taken from Inkscape (Hongli Lai <h.lai@chello.nl>)
5 AC_DEFUN([GEANY_CHECK_BINRELOC],
7         AC_ARG_ENABLE([binreloc],
8                         [AS_HELP_STRING([--enable-binreloc],
9                                         [compile with binary relocation support [default=no]])],
10                         [enable_binreloc=$enableval],
11                         [enable_binreloc=no])
13         AC_MSG_CHECKING([whether binary relocation support should be enabled])
14         if test "$enable_binreloc" = "yes"; then
15                 AC_MSG_RESULT([yes])
16                 AC_MSG_CHECKING([for linker mappings at /proc/self/maps])
17                 if test -e /proc/self/maps; then
18                         AC_MSG_RESULT([yes])
19                 else
20                         AC_MSG_RESULT([no])
21                         AC_MSG_ERROR([/proc/self/maps is not available. Binary relocation cannot be enabled.])
22                         enable_binreloc="no"
23                 fi
25         elif test "$enable_binreloc" = "auto"; then
26                 AC_MSG_RESULT([yes when available])
27                 AC_MSG_CHECKING([for linker mappings at /proc/self/maps])
28                 if test -e /proc/self/maps; then
29                         AC_MSG_RESULT([yes])
30                         enable_binreloc=yes
32                         AC_MSG_CHECKING([whether everything is installed to the same prefix])
33                         if test "$bindir" = '${exec_prefix}/bin' -a "$sbindir" = '${exec_prefix}/sbin' -a \
34                                 "$datadir" = '${prefix}/share' -a "$libdir" = '${exec_prefix}/lib' -a \
35                                 "$libexecdir" = '${exec_prefix}/libexec' -a "$sysconfdir" = '${prefix}/etc'
36                         then
37                                 AC_MSG_RESULT([yes])
38                         else
39                                 AC_MSG_RESULT([no])
40                                 AC_MSG_NOTICE([Binary relocation support will be disabled.])
41                                 enable_binreloc=no
42                         fi
44                 else
45                         AC_MSG_RESULT([no])
46                         enable_binreloc=no
47                 fi
49         elif test "$enable_binreloc" = "no"; then
50                 AC_MSG_RESULT([no])
51         else
52                 AC_MSG_RESULT([no (unknown value "$enable_binreloc")])
53                 enable_binreloc=no
54         fi
55         AM_CONDITIONAL(ENABLE_BINRELOC, [test "$enable_binreloc" = "yes"])
56         AM_COND_IF(ENABLE_BINRELOC,
57         [
58                 AC_DEFINE([ENABLE_BINRELOC],,[Use AutoPackage?])
59         ])
61         GEANY_STATUS_ADD([Enable binary relocation], [$enable_binreloc])