Skip to content

Commit

Permalink
Autotools: Work around an absolute path problem
Browse files Browse the repository at this point in the history
Problem: `make distcheck` will perform a `./configure --prefix` call,
that fails when using an absolute path for installing a file (in our
case bash completion). This also happens when a user has no root rights
and want to install in their /home or somewhere.
Solution: bend the path to use the autotools $prefix variable.
Unfortunately this has some sideeffects, because of using pkg-config
directly and needing a way to disable this behaviour alltogether.
This ugly (sic!) way attempts to work with either:
* --with-bash-completion-dir == --with-bash-completion-dir=yes
* --without-bash-completion-dir == --with-bash-completion-dir=no
* --with-bash-completion-dir=/some/path
While the last option will not work with --prefix installs, when given
an absolute path without write permissions, it would be stupid to use
one in a read-only dir anyways.
  • Loading branch information
carstene1ns committed Sep 18, 2016
1 parent bcd6c5f commit b3a8984
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ endif
endif

# bash completion
if HAVE_BASHCOMP
bashcompdir = @bashcompinstdir@
dist_bashcomp_DATA = resources/unix/bash-completion/easyrpg-player
if HAVE_BASHCOMPLETION
bashcompletiondir = $(BASHCOMPLETION_DIR)
dist_bashcompletion_DATA = resources/unix/bash-completion/easyrpg-player
endif

# FIXME make filefinder work without external scripting
Expand Down
20 changes: 15 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ AS_IF([test "x$with_libspeexdsp" != "xno"],[
PKG_CHECK_MODULES([SPEEXDSP],[speexdsp],[AC_DEFINE(HAVE_LIBSPEEXDSP,[1],[Disable resampling support provided by libspeexdsp])],[auto_speexdsp=0])
])

# bash completion
AC_ARG_WITH([bash-completion-dir],[AS_HELP_STRING([--with-bash-completion-dir@<:@=DIR@:>@],
[Install the parameter auto-completion script for bash in DIR. @<:@default=auto@:>@])],
[],[with_bash_completion_dir=yes])
AS_IF([test "x$with_bash_completion_dir" = "xyes"],[
BASHCOMPLETION_DIR="`$PKG_CONFIG --silence-errors --define-variable=prefix="\${prefix}" --variable=completionsdir bash-completion`"
],[
BASHCOMPLETION_DIR=$with_bash_completion_dir
])
AS_IF([test "x$BASHCOMPLETION_DIR" = "x"],[
BASHCOMPLETION_DIR="${datadir}/bash-completion/completions"
])
AC_SUBST([BASHCOMPLETION_DIR])
AM_CONDITIONAL([HAVE_BASHCOMPLETION], [test "x$with_bash_completion_dir" != "xno"])

# Checks for header files.
AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h wchar.h])

Expand Down Expand Up @@ -117,11 +132,6 @@ AS_IF([test x"$A2X" = "xno" && test ! -f "${srcdir}/resources/easyrpg-player.6"]
AC_MSG_WARN([a2x is required to create the manual page]))
AM_CONDITIONAL([HAVE_MANUAL], [test -f "${srcdir}/resources/easyrpg-player.6"])

# bash completion
PKG_CHECK_VAR([bashcompinstdir],[bash-completion],[completionsdir])
AM_CONDITIONAL([HAVE_BASHCOMP], [test "x$bashcompinstdir" != "x"])
AC_SUBST(bashcompinstdir)

# Doxygen source documentation
m4_include([builds/autoconf/m4/ax_prog_doxygen.m4])
DX_DOXYGEN_FEATURE(OFF)
Expand Down

0 comments on commit b3a8984

Please sign in to comment.