autotools: Make petitboot autoreconfable
authorJeff Bailey <jeffbailey@google.com>
Fri, 14 Mar 2014 00:49:10 +0000 (08:49 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 16 Jul 2014 00:43:08 +0000 (08:43 +0800)
The standard way to regenerate the autotools bits is with 'autoreconf',
but that doesn't work with our custom bootstrap script. We only need the
bootstrap script to generate the version in configure.ac, which we can
easily do with m4_esyscmd_s instead.

This change allows autoreconfiguration with `autoreconf -f -i`.

Includes changes proposed by Yann E. Morin <yann.morin.1998@free.fr>,
and modifications from the original patch from
Jeremy Kerr <jk@ozlabs.org>

Signed-off-by: Jeff Bailey <jeffbailey@google.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Makefile.am
bootstrap
configure.ac [new file with mode: 0644]
configure.ac.in [deleted file]
version.sh [new file with mode: 0755]

index 42921b31c5f4f32372b5a746d1bc75d4fa0a3f3a..0eca29cf95f2d5ee38d759de445705384da3ddf9 100644 (file)
@@ -26,7 +26,7 @@ LIBTOOL_DEPS = @LIBTOOL_DEPS@
 libtool: $(LIBTOOL_DEPS)
        $(SHELL) ./config.status libtool
 
-EXTRA_DIST = bootstrap configure.ac.in $(srcdir)/m4
+EXTRA_DIST = version.sh configure.ac $(srcdir)/m4
 
 MAINTAINERCLEANFILES = aclocal.m4 config.* configure configure.ac depcomp \
        install-sh ltmain.sh Makefile.in missing ylwrap $(PACKAGE)-*.gz
index 91ba8c827b1a2add8c910f43f174e7bd05308da1..e72dad67c279f3b3e4b174311ae66c67a26fa15d 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,44 +1,3 @@
-#! /bin/bash
-# bootstrap -- Use this script to create generated files from a VCS checkout
-#
+#!/bin/sh
 
-version=
-
-if [ "$1" ]; then
-       version=$1
-elif head=$(git rev-parse --short --verify HEAD 2>/dev/null); then
-
-       # If available, use the git commit revision for the package version.
-
-       # Add a date prefix for easy reading.
-       # date='2010-11-30 16:36:09 -0800'
-
-       date=$(git log --pretty=format:"%ci" -1 HEAD)
-       date=${date##20}
-       date=${date%%:[0-9][0-9] *}
-       date=${date//-/.}
-       date=${date// /.}
-       date=${date//:/.}
-
-       version=$(printf '%s-%s%s' ${date} g ${head})
-
-       # Add a '-dirty' postfix for uncommitted changes.
-
-       if git diff-index HEAD | read dummy; then
-               version=`printf '%s%s' ${version} -dirty`
-       fi
-else
-       # Default to current date and time.
-
-       version="dev-$(date +%y.%m.%d-%H.%M.%S)"
-fi
-
-set -x
-
-sed -e s,@version@,${version},g configure.ac.in > configure.ac
-
-aclocal
-libtoolize --force --copy
-autoheader
-automake --add-missing --copy
-autoconf
+exec autoreconf -f -i
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..3d2ec18
--- /dev/null
@@ -0,0 +1,276 @@
+## configure.ac -- Process this file with autoconf to produce configure
+#
+#  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; version 2 of the License.
+#
+#  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+AC_INIT([petitboot],
+    [m4_esyscmd_s([./version.sh])],
+    [Geoff Levand <geoff@infradead.org>])
+
+AC_CONFIG_MACRO_DIR([m4])
+
+AC_PREFIX_DEFAULT([/usr/local])
+
+AS_IF([test "x$CFLAGS" = "x"], [AC_SUBST([CFLAGS], [""])])
+
+AC_PROG_CC
+AC_PROG_LEX
+AC_PROG_YACC
+AC_PROG_INSTALL
+
+AM_INIT_AUTOMAKE
+AC_GNU_SOURCE
+LT_INIT
+
+AX_WITH_CURSES
+AX_WITH_CURSES_MENU
+AX_WITH_CURSES_FORM
+
+AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
+
+if test "x$ax_cv_curses" = xyes; then
+       if test "x$ax_cv_menu" != xyes; then
+               AC_MSG_ERROR([--with-ncurses requires the ncurses menu library])
+       fi
+       if test "x$ax_cv_form" != xyes; then
+               AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
+       fi
+fi
+
+AC_CHECK_LIB([udev], [udev_new],
+       [],
+       [AC_MSG_FAILURE([The libudev development library is required by petitboot.  Try installing the package libudev-dev or libudev-devel.])]
+)
+
+AC_CHECK_HEADERS([stdarg.h])
+AC_CHECK_HEADERS([varargs.h])
+
+dnl Checking for va_copy availability
+AC_MSG_CHECKING([for va_copy])
+AC_TRY_LINK([#include <stdarg.h>
+va_list ap1,ap2;], [va_copy(ap1,ap2);],
+have_va_copy=yes,
+have_va_copy=no)
+AC_MSG_RESULT($have_va_copy)
+if test x"$have_va_copy" = x"yes"; then
+    AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
+else
+    AC_MSG_CHECKING([for __va_copy])
+    AC_TRY_LINK([#include <stdarg.h>
+    va_list ap1,ap2;], [__va_copy(ap1,ap2);],
+    have___va_copy=yes,
+    have___va_copy=no)
+    AC_MSG_RESULT($have___va_copy)
+    if test x"$have___va_copy" = x"yes"; then
+        AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
+    fi
+fi
+
+AC_ARG_WITH(
+       [twin-x11],
+       [AS_HELP_STRING([--with-twin-x11],
+               [build x11 GUI programs using the twin window system [default=yes]]
+       )],
+       [],
+       [with_twin_x11=yes]
+)
+AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
+
+AC_ARG_WITH(
+       [twin-fbdev],
+       [AS_HELP_STRING(
+               [--with-twin-fbdev],
+               [build frame buffer GUI programs using the twin window system [default=no]]
+       )],
+       [],
+       [with_twin_fbdev=yes]
+)
+AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
+
+AM_CONDITIONAL(
+       [WITH_TWIN],
+       [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
+
+AS_IF(
+       [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
+       [PKG_CHECK_MODULES(
+               [twin],
+               [libtwin],
+               [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
+                       AC_CHECK_LIB(
+                               [twin],
+                               [twin_feature_init],
+                               [],
+                               [AC_MSG_FAILURE([--with-twin was given but the test for libtwin failed.])]
+                       )
+                       LIBS="$SAVE_LIBS"
+               ],
+               [AC_MSG_RESULT([$twin_PKG_ERRORS])
+                       AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
+               ]
+       )]
+)
+
+AS_IF(
+       [test "x$with_twin_x11" = "xyes"],
+       [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
+               AC_CHECK_HEADERS(
+                       [libtwin/twin_x11.h],
+                       [],
+                       [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
+               )
+               CPPFLAGS="$SAVE_CPPFLAGS"
+       ]
+)
+
+AS_IF(
+       [test "x$with_twin_fbdev" = "xyes"],
+       [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
+               AC_CHECK_HEADERS(
+                       [libtwin/twin_fbdev.h],
+                       [],
+                       [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
+               )
+               CPPFLAGS="$SAVE_CPPFLAGS"
+       ]
+)
+
+AC_ARG_ENABLE(
+       [busybox],
+       [AS_HELP_STRING(
+               [--enable-busybox],
+               [build programs with extra support for busybox [default=no]])
+       ],
+       [],
+       [enable_busybox=no]
+)
+#AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
+
+AC_ARG_ENABLE(
+       [ps3],
+       [AS_HELP_STRING(
+               [--enable-ps3],
+               [build additional programs for the PS3 game console [default=no]]
+       )],
+       [],
+       [enable_ps3=no]
+)
+AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
+
+AC_ARG_ENABLE(
+       [debug],
+       [AS_HELP_STRING([--enable-debug],
+               [build programs with extra debug info [default=no]]
+       )],
+       [],
+       [enable_debug=check]
+)
+#AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
+
+AC_ARG_ENABLE(
+       [test-valgrind],
+       [AS_HELP_STRING([--enable-test-valgrind],
+               [run all tests with valgrind]
+       )],
+)
+AM_CONDITIONAL([ENABLE_TEST_VALGRIND], [test "x$enable_test_valgrind" = "xyes"])
+
+# host program paths
+AC_DEFUN([DEFINE_HOST_PROG],
+       [
+               AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
+               if test "x$HOST_PROG_$1" = "x"; then
+                       HOST_PROG_$1="$3"
+               fi
+               AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
+                               [Path to "$2" on the host])
+       ])
+
+DEFINE_HOST_PROG(CP, cp, [/bin/cp])
+DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
+DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
+DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
+DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
+DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
+DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
+DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
+DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
+DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
+
+AC_ARG_WITH(
+    [tftp],
+    [AS_HELP_STRING([--with-tftp=TYPE],
+        [Use TYPE-type ftp client (either hpa or busybox) [default=runtime-check]]
+    )],
+    [],
+    [with_tftp=detect]
+)
+
+case x$with_tftp in
+'xhpa')
+    tftp_type='TFTP_TYPE_HPA'
+    ;;
+'xbusybox')
+    tftp_type='TFTP_TYPE_BUSYBOX'
+    ;;
+*)
+    tftp_type='TFTP_TYPE_UNKNOWN'
+    ;;
+esac
+
+AC_DEFINE_UNQUOTED(TFTP_TYPE, $tftp_type, [tftp client type])
+
+default_cflags="--std=gnu99 -g \
+       -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
+       -Wmissing-declarations -Wredundant-decls"
+
+AC_ARG_ENABLE(
+       [werror],
+       [AS_HELP_STRING([--enable-werror],
+               [build programs with -Werror]
+       )],
+       [default_cflags="$default_cflags -Werror"]
+)
+
+AS_IF(
+       [test "x$enable_debug" = "xyes"],
+       [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0 -DDEBUG"])],
+       [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
+)
+
+AC_SUBST([LIBTOOL_DEPS])
+AC_SUBST([DESTDIR])
+AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([
+       Makefile
+       discover/Makefile
+       discover/grub2/Makefile
+       lib/Makefile
+       man/Makefile
+       test/Makefile
+       test/lib/Makefile
+       test/parser/Makefile
+       test/urls/Makefile
+       ui/Makefile
+       ui/common/Makefile
+       ui/ncurses/Makefile
+       ui/test/Makefile
+       ui/twin/Makefile
+       utils/Makefile
+])
+
+AC_OUTPUT
diff --git a/configure.ac.in b/configure.ac.in
deleted file mode 100644 (file)
index 332c718..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-## configure.ac -- Process this file with autoconf to produce configure
-#
-#  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; version 2 of the License.
-#
-#  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-
-AC_INIT([petitboot], [@version@], [Geoff Levand <geoff@infradead.org>])
-
-AC_CONFIG_MACRO_DIR([m4])
-
-AC_PREFIX_DEFAULT([/usr/local])
-
-AS_IF([test "x$CFLAGS" = "x"], [AC_SUBST([CFLAGS], [""])])
-
-AC_PROG_CC
-AC_PROG_LEX
-AC_PROG_YACC
-AC_PROG_INSTALL
-
-AM_INIT_AUTOMAKE
-AC_GNU_SOURCE
-LT_INIT
-
-AX_WITH_CURSES
-AX_WITH_CURSES_MENU
-AX_WITH_CURSES_FORM
-
-AM_CONDITIONAL([WITH_NCURSES], [test "x$ax_cv_curses" = "xyes"])
-
-if test "x$ax_cv_curses" = xyes; then
-       if test "x$ax_cv_menu" != xyes; then
-               AC_MSG_ERROR([--with-ncurses requires the ncurses menu library])
-       fi
-       if test "x$ax_cv_form" != xyes; then
-               AC_MSG_ERROR([--with-ncurses requires the ncurses form library])
-       fi
-fi
-
-AC_CHECK_LIB([udev], [udev_new],
-       [],
-       [AC_MSG_FAILURE([The libudev development library is required by petitboot.  Try installing the package libudev-dev or libudev-devel.])]
-)
-
-AC_CHECK_HEADERS([stdarg.h])
-AC_CHECK_HEADERS([varargs.h])
-
-dnl Checking for va_copy availability
-AC_MSG_CHECKING([for va_copy])
-AC_TRY_LINK([#include <stdarg.h>
-va_list ap1,ap2;], [va_copy(ap1,ap2);],
-have_va_copy=yes,
-have_va_copy=no)
-AC_MSG_RESULT($have_va_copy)
-if test x"$have_va_copy" = x"yes"; then
-    AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
-else
-    AC_MSG_CHECKING([for __va_copy])
-    AC_TRY_LINK([#include <stdarg.h>
-    va_list ap1,ap2;], [__va_copy(ap1,ap2);],
-    have___va_copy=yes,
-    have___va_copy=no)
-    AC_MSG_RESULT($have___va_copy)
-    if test x"$have___va_copy" = x"yes"; then
-        AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
-    fi
-fi
-
-AC_ARG_WITH(
-       [twin-x11],
-       [AS_HELP_STRING([--with-twin-x11],
-               [build x11 GUI programs using the twin window system [default=yes]]
-       )],
-       [],
-       [with_twin_x11=yes]
-)
-AM_CONDITIONAL([WITH_TWIN_X11], [test "x$with_twin_x11" = "xyes"])
-
-AC_ARG_WITH(
-       [twin-fbdev],
-       [AS_HELP_STRING(
-               [--with-twin-fbdev],
-               [build frame buffer GUI programs using the twin window system [default=no]]
-       )],
-       [],
-       [with_twin_fbdev=yes]
-)
-AM_CONDITIONAL([WITH_TWIN_FBDEV], [test "x$with_twin_fbdev" = "xyes"])
-
-AM_CONDITIONAL(
-       [WITH_TWIN],
-       [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"])
-
-AS_IF(
-       [test "x$with_twin_x11" = "xyes" || test "x$with_twin_fbdev" = "xyes"],
-       [PKG_CHECK_MODULES(
-               [twin],
-               [libtwin],
-               [SAVE_LIBS="$LIBS" LIBS="$LIBS $twin_LIBS"
-                       AC_CHECK_LIB(
-                               [twin],
-                               [twin_feature_init],
-                               [],
-                               [AC_MSG_FAILURE([--with-twin was given but the test for libtwin failed.])]
-                       )
-                       LIBS="$SAVE_LIBS"
-               ],
-               [AC_MSG_RESULT([$twin_PKG_ERRORS])
-                       AC_MSG_FAILURE([ Consider adjusting PKG_CONFIG_PATH environment variable])
-               ]
-       )]
-)
-
-AS_IF(
-       [test "x$with_twin_x11" = "xyes"],
-       [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
-               AC_CHECK_HEADERS(
-                       [libtwin/twin_x11.h],
-                       [],
-                       [AC_MSG_FAILURE([ --with-twin-x11 given but libtwin/twin_x11.h not found])]
-               )
-               CPPFLAGS="$SAVE_CPPFLAGS"
-       ]
-)
-
-AS_IF(
-       [test "x$with_twin_fbdev" = "xyes"],
-       [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $twin_CFLAGS"
-               AC_CHECK_HEADERS(
-                       [libtwin/twin_fbdev.h],
-                       [],
-                       [AC_MSG_FAILURE([ --with-twin-fbdev given but libtwin/twin_fbdev.h not found])]
-               )
-               CPPFLAGS="$SAVE_CPPFLAGS"
-       ]
-)
-
-AC_ARG_ENABLE(
-       [busybox],
-       [AS_HELP_STRING(
-               [--enable-busybox],
-               [build programs with extra support for busybox [default=no]])
-       ],
-       [],
-       [enable_busybox=no]
-)
-#AM_CONDITIONAL([ENABLE_BUSYBOX], [test "x$enable_busybox" = "xyes"])
-
-AC_ARG_ENABLE(
-       [ps3],
-       [AS_HELP_STRING(
-               [--enable-ps3],
-               [build additional programs for the PS3 game console [default=no]]
-       )],
-       [],
-       [enable_ps3=no]
-)
-AM_CONDITIONAL([ENABLE_PS3], [test "x$enable_ps3" = "xyes"])
-
-AC_ARG_ENABLE(
-       [debug],
-       [AS_HELP_STRING([--enable-debug],
-               [build programs with extra debug info [default=no]]
-       )],
-       [],
-       [enable_debug=check]
-)
-#AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
-
-AC_ARG_ENABLE(
-       [test-valgrind],
-       [AS_HELP_STRING([--enable-test-valgrind],
-               [run all tests with valgrind]
-       )],
-)
-AM_CONDITIONAL([ENABLE_TEST_VALGRIND], [test "x$enable_test_valgrind" = "xyes"])
-
-# host program paths
-AC_DEFUN([DEFINE_HOST_PROG],
-       [
-               AC_ARG_VAR([HOST_PROG_$1], [Path to "$2" on the host [default $3]])
-               if test "x$HOST_PROG_$1" = "x"; then
-                       HOST_PROG_$1="$3"
-               fi
-               AC_DEFINE_UNQUOTED(HOST_PROG_$1, ["$HOST_PROG_$1"],
-                               [Path to "$2" on the host])
-       ])
-
-DEFINE_HOST_PROG(CP, cp, [/bin/cp])
-DEFINE_HOST_PROG(KEXEC, kexec, [/sbin/kexec])
-DEFINE_HOST_PROG(MOUNT, mount, [/bin/mount])
-DEFINE_HOST_PROG(SHUTDOWN, shutdown, [/sbin/shutdown])
-DEFINE_HOST_PROG(SFTP, sftp, [/usr/bin/sftp])
-DEFINE_HOST_PROG(TFTP, tftp, [/usr/bin/tftp])
-DEFINE_HOST_PROG(UMOUNT, umount, [/bin/umount])
-DEFINE_HOST_PROG(WGET, wget, [/usr/bin/wget])
-DEFINE_HOST_PROG(IP, ip, [/sbin/ip])
-DEFINE_HOST_PROG(UDHCPC, udhcpc, [/sbin/udhcpc])
-
-AC_ARG_WITH(
-    [tftp],
-    [AS_HELP_STRING([--with-tftp=TYPE],
-        [Use TYPE-type ftp client (either hpa or busybox) [default=runtime-check]]
-    )],
-    [],
-    [with_tftp=detect]
-)
-
-case x$with_tftp in
-'xhpa')
-    tftp_type='TFTP_TYPE_HPA'
-    ;;
-'xbusybox')
-    tftp_type='TFTP_TYPE_BUSYBOX'
-    ;;
-*)
-    tftp_type='TFTP_TYPE_UNKNOWN'
-    ;;
-esac
-
-AC_DEFINE_UNQUOTED(TFTP_TYPE, $tftp_type, [tftp client type])
-
-default_cflags="--std=gnu99 -g \
-       -Wall -W -Wunused -Wstrict-prototypes -Wmissing-prototypes \
-       -Wmissing-declarations -Wredundant-decls"
-
-AC_ARG_ENABLE(
-       [werror],
-       [AS_HELP_STRING([--enable-werror],
-               [build programs with -Werror]
-       )],
-       [default_cflags="$default_cflags -Werror"]
-)
-
-AS_IF(
-       [test "x$enable_debug" = "xyes"],
-       [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O0 -DDEBUG"])],
-       [AC_SUBST([DEFAULT_CFLAGS], ["$default_cflags -O2 -DNDEBUG"])]
-)
-
-AC_SUBST([LIBTOOL_DEPS])
-AC_SUBST([DESTDIR])
-AC_SUBST([pkgsysconfdir], ["${sysconfdir}/${package}"])
-
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_FILES([
-       Makefile
-       discover/Makefile
-       discover/grub2/Makefile
-       lib/Makefile
-       man/Makefile
-       test/Makefile
-       test/lib/Makefile
-       test/parser/Makefile
-       test/urls/Makefile
-       ui/Makefile
-       ui/common/Makefile
-       ui/ncurses/Makefile
-       ui/test/Makefile
-       ui/twin/Makefile
-       utils/Makefile
-])
-
-AC_OUTPUT
diff --git a/version.sh b/version.sh
new file mode 100755 (executable)
index 0000000..eed8d3a
--- /dev/null
@@ -0,0 +1,34 @@
+#! /bin/bash
+#
+# version.sh: create a version string for use by configure.ac
+
+version=
+
+if head=$(git rev-parse --short --verify HEAD 2>/dev/null); then
+
+       # If available, use the git commit revision for the package version.
+
+       # Add a date prefix for easy reading.
+       # date='2010-11-30 16:36:09 -0800'
+
+       date=$(git log --pretty=format:"%ci" -1 HEAD)
+       date=${date##20}
+       date=${date%%:[0-9][0-9] *}
+       date=${date//-/.}
+       date=${date// /.}
+       date=${date//:/.}
+
+       version=$(printf '%s-%s%s' ${date} g ${head})
+
+       # Add a '-dirty' postfix for uncommitted changes.
+
+       if git diff-index HEAD | read dummy; then
+               version=`printf '%s%s' ${version} -dirty`
+       fi
+else
+       # Default to current date and time.
+
+       version="dev-$(date +%y.%m.%d-%H.%M.%S)"
+fi
+
+echo $version