configure: Add --enable-prefix-only option to restrict to prefix

Restrict 'make install' to --prefix when '--enable-prefix-only'
is used. This will result in a cockpit that doesn't work without
further tweaking, but is an advanced tool for advanced use cases.

Fixes #1343
Closes #1346
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
This commit is contained in:
Stef Walter 2014-10-14 17:47:22 +02:00 committed by Marius Vollmer
parent f1244619a5
commit fae61a1336
4 changed files with 41 additions and 18 deletions

View file

@ -40,7 +40,7 @@ them by running autogen.sh. Maybe like so:
$ mkdir build
$ cd build
$ ../autogen.sh --prefix /usr --enable-maintainer-mode --enable-debug
$ ../autogen.sh --prefix=/usr --enable-maintainer-mode --enable-debug
As shown, autogen.sh also runs 'configure' with the given options.
When working with a Git clone, it is therefore best to simply always
@ -62,6 +62,12 @@ simplistic PAM configuration.
Cockpit has a single non-recursive Makefile. You can only run `make`
from the top-level and it will always rebuild the whole project.
If you prefer to install to a different `--prefix` and would prefer
that `make install` not write outside that prefix, then specify the
`--enable-prefix-only` option to `autogen.sh`. This will result in an
installation of Cockpit that does not work without further tweaking.
For advanced users only.
## Checking
You can run unit tests of the current checkout:

View file

@ -26,22 +26,15 @@ SUFFIXES = .js .min.js .css .min.css .html .min.html
$(AM_V_GEN) $(RCOMPILE) -p -m -o $@ -- $^
if HAVE_SYSTEMD
systemdunitdir = $(systemdsystemunitdir)
else
systemdunitdir = /tmp
endif
ACLOCAL_AMFLAGS = -I tools ${ACLOCAL_FLAGS}
SUBDIRS = . po
DISTCHECK_CONFIGURE_FLAGS= \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) \
--with-pamdir=$$dc_install_base/$(pamdir) \
--disable-debug \
--disable-coverage \
--disable-silent-rules \
--enable-prefix-only \
$(NULL)
AM_CPPFLAGS = \

View file

@ -39,6 +39,12 @@ AC_HEADER_STDC
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_MSG_CHECKING([whether to install to prefix only])
AC_ARG_ENABLE([prefix-only],
[AS_HELP_STRING([--enable-prefix-only], [Whether to install to prefix only])],
[], [enable_prefix_only=no])
AC_MSG_RESULT($enable_prefix_only)
# Initialization
#
@ -131,6 +137,19 @@ else
AC_SUBST(interfacesdir)
fi
# dbus session dir
AC_MSG_CHECKING(for dbus session services directory)
if test "$enable_prefix_only" = "yes"; then
dbusservicedir='${datadir}/dbus-1/services'
else
dbusservicedir=$($PKG_CONFIG dbus-1 --variable=session_bus_services_dir)
if test "$dbusservicedir" = ""; then
AC_MSG_ERROR(Couldn't find dbus services directory. Try installing dbus-devel)
fi
fi
AC_SUBST([dbusservicedir], [$dbusservicedir])
AC_MSG_RESULT(dbusservicedir)
# pam
AC_CHECK_HEADER([security/pam_appl.h], [ ],
[AC_MSG_ERROR([Couldn't find PAM headers. Try installing pam-devel])]
@ -177,14 +196,17 @@ AC_CHECK_LIB(ssh, ssh_gssapi_set_creds,
[AC_DEFINE_UNQUOTED(HAVE_SSH_GSSAPI_SET_CREDS, 1, Whether ssh_gssapi_set_creds is available)])
# systemd
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[],
[with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != "xno"; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
AC_MSG_CHECKING(for systemd unit dir)
if test "$enable_prefix_only" = "yes"; then
systemdunitdir='${prefix}/lib/systemd/system'
else
systemdunitdir=$($PKG_CONFIG systemd --variable=systemdsystemunitdir)
if test "$systemdunitdir" = ""; then
systemdunitdir="/tmp"
fi
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])
AC_SUBST([systemdunitdir], [$systemdunitdir])
AC_MSG_RESULT(systemdunitdir)
# Internationalization
@ -405,14 +427,17 @@ echo "
================
prefix: ${prefix}
exec_prefix: ${exec_prefix}
libdir: ${libdir}
libexecdir: ${libexecdir}
bindir: ${bindir}
sbindir: ${sbindir}
datarootdir: ${datarootdir}
datadir: ${datadir}
sysconfdir: ${sysconfdir}
localstatedir: ${localstatedir}
systemdsystemunitdir: ${systemdsystemunitdir}
systemdsystemunitdir: ${systemdunitdir}
dbusservicedir: ${dbusservicedir}
pamdir: ${pamdir}
compiler: ${CC}

View file

@ -115,7 +115,6 @@ cockpitd_LDADD = \
-lm \
$(NULL)
dbusservicedir = $(datadir)/dbus-1/services
dbusservice_DATA = com.redhat.Cockpit.service
com.redhat.Cockpit.service: src/daemon/com.redhat.Cockpit.service.in Makefile.am