--- Makefile.am +++ Makefile.am @@ -6,6 +6,9 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = hal.pc hal-storage.pc +m4dir = $(datadir)/aclocal +m4_DATA = hal.m4 + dbusdir = $(DBUS_SYS_DIR) dist_dbus_DATA = hal.conf @@ -31,7 +34,7 @@ MAINTAINERCLEANFILES = ChangeLog DISTCLEANFILES = hal.pc hal-storage.pc -EXTRA_DIST = HACKING hal.pc.in hal-storage.pc.in hal.conf.in ChangeLog +EXTRA_DIST = HACKING hal.pc.in hal-storage.pc.in hal.conf.in ChangeLog $(m4_DATA) clean-local : rm -f *~ --- configure.in +++ configure.in @@ -40,6 +40,30 @@ AC_CHECK_HEADERS([sys/ioccom.h sys/inotify.h]) +AC_ARG_WITH([hald-addon-dir], + AS_HELP_STRING([--with-hald-addon-dir=], + [Directory for HAL daemon addons (default ${libexecdir})])) +if test -z "$with_hald_addon_dir" ; then + hald_addondir=${libexecdir} +else + hald_addondir=$with_hald_addon_dir +fi +HALD_ADDON_DIR=$hald_addondir +AC_SUBST(hald_addondir) +AC_DEFINE_UNQUOTED(HALD_ADDON_DIR,"$hald_addondir", [Directory for HAL daemon addons]) + +AC_ARG_WITH([hald-script-dir], + AS_HELP_STRING([--with-hald-script-dir=], + [Directory for HAL daemon scripts (default ${libdir}/hal/scripts)])) +if test -z "$with_hald_script_dir" ; then + hald_scriptdir=${libdir}/hal/scripts +else + hald_scriptdir=$with_hald_script_dir +fi +HALD_SCRIPT_DIR=$hald_scriptdir +AC_SUBST(hald_scriptdir) +AC_DEFINE_UNQUOTED(HALD_SCRIPT_DIR,"$hald_scriptdir", [Directory for HAL daemon scripts]) + AC_ARG_WITH([os-type], AS_HELP_STRING([--with-os-type=], [Distribution or OS (redhat)])) @@ -1091,6 +1115,8 @@ sysconfdir: ${sysconfdir} localstatedir: ${localstatedir} docdir: ${docdir} + hald_addondir: ${hald_addondir} + hald_scriptdir: ${hald_scriptdir} dbus-1 system.d dir: ${DBUS_SYS_DIR} pci.ids dir: ${PCI_IDS_DIR} usb.ids dir: ${USB_IDS_DIR} --- hal.m4 +++ hal.m4 @@ -0,0 +1,79 @@ +## hal.m4 - Macros for building hal addons and scripts. -*-Shell-script-*- +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + + +# Usage: +# HAL_PATHS_INIT(ephy-api-version, [minimum-ephy-version]) +# +# Results: +# variable hald_addondir and macro HALD_ADDON_DIR are set to the directory to install HAL daemon addons +# variable hald_scriptdir and macro HALD_SCRIPT_DIR are set to the directory to install HAL daemon scripts +AC_DEFUN([HAL_PATHS_INIT], +[ +PKG_PROG_PKG_CONFIG() +hald_addondir=`$PKG_CONFIG --variable=hald_addondir hal` +if test -z "$hald_addondir" ; then + for DIR in ${libexecdir} /usr/libexec /usr/libexec/hal /usr/lib/hal /usr/lib64/hal /usr/lib32/hal ; do + if test -f $DIR/hal-storage-mount ; then + hald_addondir=$DIR + break + fi + done + if test -z "$hald_addondir" ; then + AC_MSG_ERROR([Cannot detect hald_addondir. Please use --with-hald-addon-dir=]) + fi +fi +AC_ARG_WITH([hald-addon-dir], + AS_HELP_STRING([--with-hald-addon-dir=], + [Directory for HAL daemon addons ($hald_addondir)])) +if test -z "$with_hald_addon_dir" ; then + hald_addondir=$hald_addondir +else + hald_addondir=$with_hald_addon_dir +fi +HALD_ADDON_DIR=$hald_addondir +AC_SUBST(hald_addondir) +AC_DEFINE_UNQUOTED(HALD_ADDON_DIR,"$hald_addondir", [Directory for HAL daemon addons]) +dnl +hald_scriptdir=`$PKG_CONFIG --variable=hald_scriptdir hal` +if test -z "$hald_scriptdir" ; then + for DIR in ${libdir}/hal/scripts /usr/lib/hal/scripts /usr/lib64/hal/scripts /usr/lib32/hal/scripts ; do + if test -f $DIR/hal-system-power-shutdown ; then + hald_scriptdir=$DIR + break + fi + done + if test -z "$hald_scriptdir" ; then + AC_MSG_ERROR([Cannot detect hald_scriptdir. Please use --with-hald-script-dir=]) + fi +fi +AC_ARG_WITH([hald-script-dir], + AS_HELP_STRING([--with-hald-script-dir=], + [Directory for HAL daemon scripts ($hald_scriptdir)])) +if test -z "$with_hald_script_dir" ; then + hald_scriptdir=$hald_scriptdir +else + hald_scriptdir=$with_hald_script_dir +fi +HALD_SCRIPT_DIR=$hald_scriptdir +AC_SUBST(hald_scriptdir) +AC_DEFINE_UNQUOTED(HALD_SCRIPT_DIR,"$hald_scriptdir", [Directory for HAL daemon scripts]) +]) --- hal.pc.in +++ hal.pc.in @@ -1,6 +1,8 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ +hald_addondir=@hald_addondir@ +hald_scriptdir=@hald_scriptdir@ includedir=@includedir@ haluser=@HAL_USER@ halgroup=@HAL_GROUP@ --- hald-runner/Makefile.am +++ hald-runner/Makefile.am @@ -1,17 +1,15 @@ ## Process this file with automake to produce Makefile.in AM_CPPFLAGS = \ - -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \ - -DPACKAGE_SCRIPT_DIR=\""$(libdir)/hal/scripts"\" \ -DHALD_SOCKET_DIR=\""$(HALD_SOCKET_DIR)"\" \ -I$(top_srcdir) \ @DBUS_CFLAGS@ @GLIB_CFLAGS@ -libexec_PROGRAMS = hald-runner +hald_addon_PROGRAMS = hald-runner hald_runner_SOURCES = main.c runner.c runner.h utils.h utils.c hald_runner_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ --- hald/Makefile.am +++ hald/Makefile.am @@ -3,13 +3,11 @@ SUBDIRS = dummy freebsd linux solaris . AM_CPPFLAGS = \ - -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \ - -DPACKAGE_SCRIPT_DIR=\""$(libdir)/hal/scripts"\" \ -DHALD_SOCKET_DIR=\""$(HALD_SOCKET_DIR)"\" \ -DHALD_PID_FILE=\""$(HALD_PID_FILE)"\" \ -DPCI_IDS_DIR=\""$(PCI_IDS_DIR)"\" \ @@ -37,7 +35,7 @@ TESTS = hald-cache-test.sh sbin_PROGRAMS = hald -libexec_PROGRAMS = hald-generate-fdi-cache +hald_addon_PROGRAMS = hald-generate-fdi-cache BUILT_SOURCES = \ hald_marshal.h \ --- hald/freebsd/addons/Makefile.am +++ hald/freebsd/addons/Makefile.am @@ -8,7 +8,7 @@ @DBUS_CFLAGS@ if HALD_COMPILE_FREEBSD -libexec_PROGRAMS = hald-addon-storage +hald_addon_PROGRAMS = hald-addon-storage endif hald_addon_storage_SOURCES = addon-storage.c --- hald/freebsd/probing/Makefile.am +++ hald/freebsd/probing/Makefile.am @@ -8,7 +8,7 @@ @DBUS_CFLAGS@ if HALD_COMPILE_FREEBSD -libexec_PROGRAMS = \ +hald_addon_PROGRAMS = \ hald-probe-hiddev \ hald-probe-scsi \ hald-probe-smbios \ --- hald/hald.c +++ hald/hald.c @@ -577,9 +577,9 @@ newpath[0] = '\0'; } - g_strlcat (newpath, PACKAGE_LIBEXEC_DIR, sizeof (newpath)); + g_strlcat (newpath, HALD_ADDON_DIR, sizeof (newpath)); g_strlcat (newpath, ":", sizeof (newpath)); - g_strlcat (newpath, PACKAGE_SCRIPT_DIR, sizeof (newpath)); + g_strlcat (newpath, HALD_SCRIPT_DIR, sizeof (newpath)); setenv ("PATH", newpath, TRUE); --- hald/hald_runner.c +++ hald/hald_runner.c @@ -273,13 +273,13 @@ hald_runner_path = g_getenv ("HALD_RUNNER_PATH"); if (hald_runner_path != NULL) { env[1] = - g_strdup_printf ("PATH=%s:" PACKAGE_LIBEXEC_DIR ":" - PACKAGE_SCRIPT_DIR ":" + g_strdup_printf ("PATH=%s:" HALD_ADDON_DIR ":" + HALD_SCRIPT_DIR ":" PACKAGE_BIN_DIR, hald_runner_path); } else { env[1] = - g_strdup_printf ("PATH=" PACKAGE_LIBEXEC_DIR ":" - PACKAGE_SCRIPT_DIR ":" + g_strdup_printf ("PATH=" HALD_ADDON_DIR ":" + HALD_SCRIPT_DIR ":" PACKAGE_BIN_DIR); } --- hald/linux/addons/Makefile.am +++ hald/linux/addons/Makefile.am @@ -9,7 +9,7 @@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ @POLKIT_CFLAGS@ if HALD_COMPILE_LINUX -libexec_PROGRAMS = \ +hald_addon_PROGRAMS = \ hald-addon-generic-backlight \ hald-addon-hid-ups \ hald-addon-input \ @@ -17,59 +17,59 @@ hald-addon-storage if HAVE_PMU -libexec_PROGRAMS += \ +hald_addon_PROGRAMS += \ hald-addon-pmu endif if HAVE_ACPI -libexec_PROGRAMS += \ +hald_addon_PROGRAMS += \ hald-addon-acpi if BUILD_ACPI_TOSHIBA -libexec_PROGRAMS += \ +hald_addon_PROGRAMS += \ hald-addon-acpi-buttons-toshiba endif endif if BUILD_OMAP -libexec_PROGRAMS += \ +hald_addon_PROGRAMS += \ hald-addon-omap-backlight hald_addon_omap_backlight_SOURCES = addon-omap-backlight.c ../../logger.c ../../util_helper.c ../../util_helper_priv.c hald_addon_omap_backlight_LDADD = $(top_builddir)/libhal/libhal.la @GLIB_LIBS@ endif if BUILD_IMAC -libexec_PROGRAMS += hald-addon-imac-backlight +hald_addon_PROGRAMS += hald-addon-imac-backlight hald_addon_imac_backlight_SOURCES = addon-imac-backlight.c ../../logger.c ../../util_helper_priv.c hald_addon_imac_backlight_LDADD = $(top_builddir)/libhal/libhal.la @GLIB_LIBS@ endif if BUILD_MACBOOKPRO -libexec_PROGRAMS += hald-addon-macbookpro-backlight +hald_addon_PROGRAMS += hald-addon-macbookpro-backlight hald_addon_macbookpro_backlight_SOURCES = addon-macbookpro-backlight.c ../../logger.c ../../util_helper_priv.c hald_addon_macbookpro_backlight_LDADD = $(top_builddir)/libhal/libhal.la -lpci -lz @GLIB_LIBS@ endif if BUILD_MACBOOK -libexec_PROGRAMS += hald-addon-macbook-backlight +hald_addon_PROGRAMS += hald-addon-macbook-backlight hald_addon_macbook_backlight_SOURCES = addon-macbook-backlight.c ../../logger.c ../../util_helper.c ../../util_helper_priv.c hald_addon_macbook_backlight_LDADD = $(top_builddir)/libhal/libhal.la -lpci -lz @GLIB_LIBS@ endif if BUILD_CPUFREQ -libexec_PROGRAMS += hald-addon-cpufreq +hald_addon_PROGRAMS += hald-addon-cpufreq hald_addon_cpufreq_SOURCES = addon-cpufreq.c addon-cpufreq.h addon-cpufreq-userspace.h \ addon-cpufreq-userspace.c ../../logger.c ../../util_helper_priv.c hald_addon_cpufreq_LDADD = $(top_builddir)/libhal/libhal.la @GLIB_LIBS@ @POLKIT_LIBS@ endif if BUILD_USBCSR -libexec_PROGRAMS += hald-addon-usb-csr +hald_addon_PROGRAMS += hald-addon-usb-csr hald_addon_usb_csr_SOURCES = addon-usb-csr.c ../../logger.c ../../util_helper.c hald_addon_usb_csr_LDADD = $(top_builddir)/libhal/libhal.la -lusb @GLIB_LIBS@ endif if BUILD_DELL -libexec_PROGRAMS += hald-addon-dell-backlight +hald_addon_PROGRAMS += hald-addon-dell-backlight hald_addon_dell_backlight_SOURCES = addon-dell-backlight.cpp ../../logger.c hald_addon_dell_backlight_LDADD = $(top_builddir)/libhal/libhal.la -lsmbios @GLIB_LIBS@ endif --- hald/linux/probing/Makefile.am +++ hald/linux/probing/Makefile.am @@ -9,7 +9,7 @@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ @VOLUME_ID_CFLAGS@ if HALD_COMPILE_LINUX -libexec_PROGRAMS = \ +hald_addon_PROGRAMS = \ hald-probe-input \ hald-probe-hiddev \ hald-probe-storage \ --- hald/solaris/addons/Makefile.am +++ hald/solaris/addons/Makefile.am @@ -9,7 +9,7 @@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ if HALD_COMPILE_SOLARIS -libexec_PROGRAMS = hald-addon-storage +hald_addon_PROGRAMS = hald-addon-storage endif hald_addon_storage_SOURCES = addon-storage.c ../../logger.c --- hald/solaris/probing/Makefile.am +++ hald/solaris/probing/Makefile.am @@ -9,7 +9,7 @@ @GLIB_CFLAGS@ @DBUS_CFLAGS@ if HALD_COMPILE_SOLARIS -libexec_PROGRAMS = hald-probe-storage hald-probe-volume +hald_addon_PROGRAMS = hald-probe-storage hald-probe-volume endif hald_probe_storage_SOURCES = probe-storage.c cdutils.c cdutils.h fsutils.c fsutils.h ../../logger.c --- tools/Makefile.am +++ tools/Makefile.am @@ -12,12 +12,10 @@ DIST_SUBDIRS = freebsd linux AM_CPPFLAGS = \ - -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \ - -DPACKAGE_SCRIPT_DIR=\""$(libdir)/hal/scripts"\" \ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ -I$(top_srcdir) -I$(top_srcdir)/libhal -I$(top_srcdir)/libhal-storage \ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @POLKIT_CFLAGS@ @@ -95,7 +93,7 @@ endif #BUILD_KEYMAPS -libexec_PROGRAMS = \ +hald_addon_PROGRAMS = \ hal-storage-mount \ hal-storage-unmount \ hal-storage-eject \ @@ -106,17 +104,17 @@ hal-system-power-pm-is-supported if HAVE_PMU -libexec_PROGRAMS += \ +hald_addon_PROGRAMS += \ hal-system-power-pmu endif if HAVE_SONYPIC -libexec_PROGRAMS += \ +hald_addon_PROGRAMS += \ hal-system-sonypic endif if HAVE_ACLMGMT -libexec_PROGRAMS += hal-acl-tool +hald_addon_PROGRAMS += hal-acl-tool hal_acl_tool_SOURCES = hal-acl-tool.c hal_acl_tool_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ $(top_builddir)/libhal/libhal.la @@ -156,9 +154,7 @@ hal_system_sonypic_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la endif -scriptdir = $(libdir)/hal/scripts - -script_SCRIPTS = \ +hald_script_SCRIPTS = \ hal-luks-setup \ hal-luks-teardown \ hal-luks-remove \ @@ -179,7 +175,7 @@ hal-dockstation-undock \ hal-functions -EXTRA_DIST=$(man_MANS) $(MAN_IN_FILES) gen-libgphoto-hal-fdi $(script_SCRIPTS) +EXTRA_DIST=$(man_MANS) $(MAN_IN_FILES) gen-libgphoto-hal-fdi $(hald_script_SCRIPTS) if HAVE_UMOUNT_HAL slashsbindir = /sbin @@ -207,7 +203,7 @@ endif check: - for f in $(script_SCRIPTS); do \ + for f in $(hald_script_SCRIPTS); do \ echo -n "Validate bash syntax in $$f : "; \ bash -n $(srcdir)/$$f 2> bash.error;\ if test -s bash.error; then \ --- tools/freebsd/Makefile.am +++ tools/freebsd/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -scriptdir = $(libdir)/hal/scripts/freebsd +scriptdir = $(hald_scriptdir)/freebsd script_SCRIPTS = \ hal-system-power-suspend-freebsd \ --- tools/linux/Makefile.am +++ tools/linux/Makefile.am @@ -5,19 +5,17 @@ AM_CPPFLAGS = \ - -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \ -DPACKAGE_LOCALSTATEDIR=\""$(localstatedir)"\" \ - -DPACKAGE_SCRIPT_DIR=\""$(libdir)/hal/scripts"\" \ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ -I$(top_srcdir) -I$(top_srcdir)/libhal -I$(top_srcdir)/libhal-storage \ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @POLKIT_CFLAGS@ -libexec_PROGRAMS = +hald_addon_PROGRAMS = -scriptdir = $(libdir)/hal/scripts/linux +scriptdir = $(hald_scriptdir)/linux script_SCRIPTS = \ hal-luks-setup-linux \