On Sun, 2006-05-21 at 23:39 +0100, Richard Hughes wrote:
> How about we convert pm-utils to use automake and configure (like most
> other OSS projects) so we get stuff like "make dist-check" for free.

As requested, patch attached.

Richard.

--- /dev/null	2006-05-24 12:59:16.536811750 +0100
+++ Makefile.am	2006-05-22 20:23:28.000000000 +0100
@@ -0,0 +1,34 @@
+SUBDIRS = pm po
+
+sbin_PROGRAMS =			\
+	pm-pmu
+
+pm_pmu_SOURCES = pm-pmu.c
+
+extradir = $(sbindir)
+
+extra_SCRIPTS =			\
+	pm-powersave		\
+	pm-action		\
+	on_ac_power
+
+scriptdir = $(sysconfdir)/pm/hooks
+
+man_MANS =			\
+	on_ac_power.1
+
+DISTCLEANFILES =		\
+	intltool-extract	\
+	intltool-merge		\
+	intltool-update
+
+EXTRA_DIST =			\
+	$(extra_SCRIPTS)	\
+	on_ac_power.1		\
+	intltool-extract.in	\
+	intltool-merge.in	\
+	intltool-update.in	\
+	mkinstalldirs
+
+clean-local :
+	rm -f *~
--- /dev/null	2006-05-24 12:59:16.536811750 +0100
+++ pm/Makefile.am	2006-05-22 16:52:29.000000000 +0100
@@ -0,0 +1,4 @@
+SUBDIRS =  hooks power.d
+
+clean-local :
+	rm -f *~
--- /dev/null	2006-05-24 12:59:16.536811750 +0100
+++ pm/hooks/Makefile.am	2006-05-22 17:09:54.000000000 +0100
@@ -0,0 +1,17 @@
+hookdir = $(sysconfdir)/pm/hooks
+
+hook_SCRIPTS =			\
+	00clear			\
+	01grub			\
+	05led			\
+	10NetworkManager	\
+	20video			\
+	49bluetooth		\
+	50modules		\
+	90clock			\
+	95led
+
+EXTRA_DIST=$(hook_SCRIPTS)
+
+clean-local :
+	rm -f *~
--- /dev/null	2006-05-24 12:59:16.536811750 +0100
+++ pm/power.d/Makefile.am	2006-05-22 17:09:51.000000000 +0100
@@ -0,0 +1,9 @@
+powerdir = $(sysconfdir)/pm/power.d
+
+power_SCRIPTS =			\
+	laptop-tools
+
+EXTRA_DIST=$(power_SCRIPTS)
+
+clean-local :
+	rm -f *~
--- /dev/null	2006-05-24 12:59:16.536811750 +0100
+++ NEWS	2006-05-24 18:21:13.000000000 +0100
@@ -0,0 +1 @@
+News goes here
--- /dev/null	2006-05-24 12:59:16.536811750 +0100
+++ configure.in	2006-05-22 16:53:54.000000000 +0100
@@ -0,0 +1,61 @@
+AC_PREREQ(2.52)
+
+AC_INIT(pm-utils, 0.20.0)
+AC_CONFIG_SRCDIR(.)
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AM_CONFIG_HEADER(config.h)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AM_PROG_LIBTOOL
+IT_PROG_INTLTOOL([0.35.0])
+
+dnl ---------------------------------------------------------------------------
+dnl - Extra verbose warning switches
+dnl ---------------------------------------------------------------------------
+CPPFLAGS="$CPPFLAGS -Wall -Werror"
+
+dnl ---------------------------------------------------------------------------
+dnl - Debugging switches (uncomment this if you want to use gdb)
+dnl ---------------------------------------------------------------------------
+CPPFLAGS="$CPPFLAGS -g"
+CPPFLAGS="$CPPFLAGS -fexceptions"
+
+dnl ---------------------------------------------------------------------------
+dnl - gettext stuff
+dnl ---------------------------------------------------------------------------
+GETTEXT_PACKAGE=AC_PACKAGE_NAME
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE(GETTEXT_PACKAGE, "AC_PACKAGE_NAME", [foo])
+AM_GLIB_GNU_GETTEXT
+
+AC_PATH_XTRA
+
+dnl ---------------------------------------------------------------------------
+dnl - Make paths available for source files
+dnl ---------------------------------------------------------------------------
+AC_SUBST(SYSCONFDIR, $sysconfdir)
+AC_SUBST(DATADIR, $datadir)
+AC_SUBST(BINDIR, $bindir)
+AC_SUBST(SBINDIR, $sbindir)
+
+dnl ---------------------------------------------------------------------------
+dnl - Makefiles, etc.
+dnl ---------------------------------------------------------------------------
+AC_OUTPUT([
+Makefile
+pm/Makefile
+pm/hooks/Makefile
+pm/power.d/Makefile
+po/Makefile.in
+])
+
+dnl ==========================================================================
+echo "
+                    pm-utils $VERSION
+                  ==================
+
+        prefix:                    ${prefix}
+        compiler:                  ${CC}
+        cflags:                    ${CFLAGS}
+"
--- /dev/null	2006-05-24 12:59:16.536811750 +0100
+++ autogen.sh	2006-05-22 16:27:14.000000000 +0100
@@ -0,0 +1,96 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+DIE=0
+
+(test -f $srcdir/configure.in) || {
+    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+    echo " top-level package directory"
+    exit 1
+}
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "**Error**: You must have \`autoconf' installed."
+  echo "Download the appropriate package for your distribution,"
+  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/";
+  DIE=1
+}
+
+(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
+  (libtool --version) < /dev/null > /dev/null 2>&1 || {
+    echo
+    echo "**Error**: You must have \`libtool' installed."
+    echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/";
+    DIE=1
+  }
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "**Error**: You must have \`automake' installed."
+  echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/";
+  DIE=1
+  NO_AUTOMAKE=yes
+}
+
+
+# if no automake, don't bother testing for aclocal
+test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
+  echo
+  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
+  echo "installed doesn't appear recent enough."
+  echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/";
+  DIE=1
+}
+
+if test "$DIE" -eq 1; then
+  exit 1
+fi
+
+if test -z "$*"; then
+  echo "**Warning**: I am going to run \`configure' with no arguments."
+  echo "If you wish to pass any to it, please specify them on the"
+  echo \`$0\'" command line."
+  echo
+fi
+
+case $CC in
+xlc )
+  am_opt=--include-deps;;
+esac
+
+      aclocalinclude="$ACLOCAL_FLAGS"
+
+      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
+	if test -z "$NO_LIBTOOLIZE" ; then 
+	  echo "Running libtoolize..."
+	  libtoolize --force --copy
+	fi
+      fi
+      echo "Running aclocal $aclocalinclude ..."
+      aclocal $aclocalinclude
+      if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
+	echo "Running autoheader..."
+	autoheader
+      fi
+      echo "Running automake --gnu $am_opt ..."
+      automake --add-missing --gnu $am_opt
+      echo "Running autoconf ..."
+      autoconf
+
+glib-gettextize --force --copy                              || exit 1
+intltoolize --copy --force --automake                  || exit 1
+
+conf_flags="--enable-maintainer-mode --enable-gtk-doc"
+
+if test x$NOCONFIGURE = x; then
+  echo Running $srcdir/configure $conf_flags "$@" ...
+  $srcdir/configure $conf_flags "$@" \
+  && echo Now type \`make\' to compile. || exit 1
+else
+  echo Skipping configure process.
+fi
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to