Commit 6645cc7b authored by Jehan's avatar Jehan

app, libgimpbase: --enable-relocatable-bundle replaces --enable-binreloc

Older --enable-binreloc configure option had basically the same purpose
as the newer --enable-relocatable-bundle, though the old binreloc was
only used for gimpenv.c code.
As a consequence, commit 10ce7021 was still not working fine since
gimp_installation_directory_file() also need binreloc enabled (to be
actually relocatable).

Let's get rid of this whole mess, by implying we want binreloc code to
be used when --enable-relocatable-bundle is ON. We don't need the
m4macros anymore, since AM_BINRELOC was basically just checking that
`/proc/self/maps` was present. But anyway being present at compile time
does not mean it will be at runtime (nor the opposite). So this test is
not that useful. The binreloc code will anyway fallback gracefully to
the non-binreloc code (i.e. trying to use build-time install paths) if
the procfs is lacking at runtime.

(cherry picked from commit 4d84c1d7)
parent a335eb0e
......@@ -252,11 +252,6 @@ These are:
in the user's home directory) to ~/.config/DIR/@GIMP_APP_VERSION@.
If DIR is an absolute path, the directory will be changed to DIR.
--enable-binreloc. When compiled for Linux with this option enabled,
GIMP will be binary relocatable. Plug-ins and data files will
be searched relative to the gimp binary instead of in the paths
defined at compile time.
--with-shm=[none|sysv|posix|auto]. This option allows you to specify
how image data is transported between the core and plug-ins. Usually
the best way to do this is detected automatically.
......
......@@ -4,6 +4,5 @@ m4_include([m4macros/ax_cxx_compile_stdcxx.m4])
m4_include([m4macros/ax_gcc_func_attribute.m4])
m4_include([m4macros/ax_prog_cc_for_build.m4])
m4_include([m4macros/ax_prog_perl_version.m4])
m4_include([m4macros/binreloc.m4])
m4_include([m4macros/detectcflags.m4])
m4_include([m4macros/pythondev.m4])
......@@ -106,7 +106,7 @@ else
libm = -lm
endif
if USE_BINRELOC
if ENABLE_RELOCATABLE_RESOURCES
munix = -Wl,-rpath '-Wl,$$ORIGIN/../lib'
endif
......
......@@ -612,9 +612,6 @@ AC_CHECK_FUNCS(difftime mmap)
AC_CHECK_FUNCS(thr_self)
AM_BINRELOC
# _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
AC_LINK_IFELSE(
......@@ -1500,6 +1497,7 @@ if test "x$enable_relocatable_bundle" = xyes; then
AC_DEFINE(ENABLE_RELOCATABLE_RESOURCES, 1,
[Define to 1 if resources are considered bundled under the same prefix])
fi
AM_CONDITIONAL(ENABLE_RELOCATABLE_RESOURCES, test x$enable_relocatable_bundle = xyes)
AC_MSG_RESULT([$enable_relocatable_bundle])
......
......@@ -65,7 +65,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir) \
$(GIO_CFLAGS) \
$(GEXIV2_CFLAGS) \
$(BINRELOC_CFLAGS) \
-I$(includedir)
AM_CFLAGS = \
......
......@@ -16,11 +16,11 @@
#include <limits.h>
#include <string.h>
#ifdef ENABLE_BINRELOC
#if defined(ENABLE_RELOCATABLE_RESOURCES) && ! defined(G_OS_WIN32)
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#endif /* ENABLE_BINRELOC */
#endif /* ENABLE_RELOCATABLE_RESOURCES && ! G_OS_WIN32 */
#include <glib.h>
#include <glib/gstdio.h>
......@@ -36,7 +36,7 @@
static char *
_br_find_exe (GimpBinrelocInitError *error)
{
#ifndef ENABLE_BINRELOC
#if ! defined(ENABLE_RELOCATABLE_RESOURCES) || defined(G_OS_WIN32)
if (error)
*error = GIMP_RELOC_INIT_ERROR_DISABLED;
return NULL;
......@@ -164,7 +164,7 @@ _br_find_exe (GimpBinrelocInitError *error)
g_free (line);
fclose (f);
return path;
#endif /* ENABLE_BINRELOC */
#endif /* ! ENABLE_RELOCATABLE_RESOURCES || G_OS_WIN32 */
}
......@@ -175,7 +175,7 @@ _br_find_exe (GimpBinrelocInitError *error)
static char *
_br_find_exe_for_symbol (const void *symbol, GimpBinrelocInitError *error)
{
#ifndef ENABLE_BINRELOC
#if ! defined(ENABLE_RELOCATABLE_RESOURCES) || defined(G_OS_WIN32)
if (error)
*error = GIMP_RELOC_INIT_ERROR_DISABLED;
return (char *) NULL;
......@@ -272,7 +272,7 @@ _br_find_exe_for_symbol (const void *symbol, GimpBinrelocInitError *error)
return (char *) NULL;
else
return g_strdup (found);
#endif /* ENABLE_BINRELOC */
#endif /* ! ENABLE_RELOCATABLE_RESOURCES || G_OS_WIN32 */
}
......
# Check for binary relocation support.
# Written by Hongli Lai
# http://autopackage.org/
AC_DEFUN([AM_BINRELOC],
[
AC_ARG_ENABLE(binreloc,
[ --enable-binreloc compile with binary relocation support
(default=no)],
enable_binreloc=$enableval,enable_binreloc=no)
AC_ARG_ENABLE(binreloc-threads,
[ --enable-binreloc-threads compile binary relocation with threads support
(default=yes)],
enable_binreloc_threads=$enableval,enable_binreloc_threads=yes)
BINRELOC_CFLAGS=
BINRELOC_LIBS=
if test "x$enable_binreloc" = "xauto"; then
AC_CHECK_FILE([/proc/self/maps])
AC_CACHE_CHECK([whether everything is installed to the same prefix],
[br_cv_valid_prefixes], [
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
br_cv_valid_prefixes=yes
else
br_cv_valid_prefixes=no
fi
])
fi
AC_CACHE_CHECK([whether binary relocation support should be enabled],
[br_cv_binreloc],
[if test "x$enable_binreloc" = "xyes"; then
br_cv_binreloc=yes
elif test "x$enable_binreloc" = "xauto"; then
if test "x$br_cv_valid_prefixes" = "xyes" -a \
"x$ac_cv_file__proc_self_maps" = "xyes"; then
br_cv_binreloc=yes
else
br_cv_binreloc=no
fi
else
br_cv_binreloc=no
fi])
if test "x$br_cv_binreloc" = "xyes"; then
BINRELOC_CFLAGS="-DENABLE_BINRELOC"
if test "x$enable_binreloc_threads" = "xyes"; then
AC_CHECK_LIB([pthread], [pthread_getspecific])
fi
AC_CACHE_CHECK([whether binary relocation should use threads],
[br_cv_binreloc_threads],
[if test "x$enable_binreloc_threads" = "xyes"; then
if test "x$ac_cv_lib_pthread_pthread_getspecific" = "xyes"; then
br_cv_binreloc_threads=yes
else
br_cv_binreloc_threads=no
fi
else
br_cv_binreloc_threads=no
fi])
if test "x$br_cv_binreloc_threads" = "xyes"; then
BINRELOC_LIBS="-lpthread"
else
BINRELOC_CFLAGS="$BINRELOC_CFLAGS -DBR_PTHREADS=0"
fi
fi
AC_SUBST(BINRELOC_CFLAGS)
AC_SUBST(BINRELOC_LIBS)
AM_CONDITIONAL(USE_BINRELOC, test x$br_cv_binreloc = xyes)
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment