From 6645cc7ba53baba2a30d044a3b1e3fa500e25d03 Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 5 Feb 2019 14:21:23 +0100 Subject: [PATCH] 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 10ce702188 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 4d84c1d7ee5bdd2d9cf8bfb07455547856ae6b59) --- INSTALL.in | 5 --- acinclude.m4 | 1 - app/Makefile.am | 2 +- configure.ac | 4 +-- libgimpbase/Makefile.am | 1 - libgimpbase/gimpreloc.c | 12 +++---- m4macros/binreloc.m4 | 75 ----------------------------------------- 7 files changed, 8 insertions(+), 92 deletions(-) delete mode 100644 m4macros/binreloc.m4 diff --git a/INSTALL.in b/INSTALL.in index 46cfb33387..029205f5dc 100644 --- a/INSTALL.in +++ b/INSTALL.in @@ -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. diff --git a/acinclude.m4 b/acinclude.m4 index 2984fe97cf..f0ceffb4d5 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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]) diff --git a/app/Makefile.am b/app/Makefile.am index 46dd220bd0..7bb07dbf99 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -106,7 +106,7 @@ else libm = -lm endif -if USE_BINRELOC +if ENABLE_RELOCATABLE_RESOURCES munix = -Wl,-rpath '-Wl,$$ORIGIN/../lib' endif diff --git a/configure.ac b/configure.ac index 4ca7905d09..56bafecdb5 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/libgimpbase/Makefile.am b/libgimpbase/Makefile.am index 8642cc933e..4214939b09 100644 --- a/libgimpbase/Makefile.am +++ b/libgimpbase/Makefile.am @@ -65,7 +65,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ $(GIO_CFLAGS) \ $(GEXIV2_CFLAGS) \ - $(BINRELOC_CFLAGS) \ -I$(includedir) AM_CFLAGS = \ diff --git a/libgimpbase/gimpreloc.c b/libgimpbase/gimpreloc.c index c00d64c54e..d98525b960 100644 --- a/libgimpbase/gimpreloc.c +++ b/libgimpbase/gimpreloc.c @@ -16,11 +16,11 @@ #include #include -#ifdef ENABLE_BINRELOC +#if defined(ENABLE_RELOCATABLE_RESOURCES) && ! defined(G_OS_WIN32) #include #include #include -#endif /* ENABLE_BINRELOC */ +#endif /* ENABLE_RELOCATABLE_RESOURCES && ! G_OS_WIN32 */ #include #include @@ -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 */ } diff --git a/m4macros/binreloc.m4 b/m4macros/binreloc.m4 deleted file mode 100644 index dff79be341..0000000000 --- a/m4macros/binreloc.m4 +++ /dev/null @@ -1,75 +0,0 @@ -# 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) -])