[gnome-pilot] Clean up of build system. #607142 2010-02-01 Matt Davey <mcdavey mrao cam ac uk> * bugzilla #60714



commit 8fe0a36fd2195493a2c952a686503b02d8f30d3b
Author: Matt Davey <mcdavey mrao cam ac uk>
Date:   Mon Feb 1 23:30:41 2010 +0000

    Clean up of build system.  #607142
    2010-02-01 Matt Davey <mcdavey mrao cam ac uk>
    	* bugzilla #607142. Clean up build system, thanks to  H.Habighorst
    	  #	modified:   Makefile.am
    	  #	deleted:    acinclude.m4
    	  #	modified:   applet/Makefile.am
    	  #	modified:   autogen.sh
    	  #	modified:   capplet/Makefile.am
    	  #	modified:   conduits/backup/Makefile.am
    	  #	modified:   conduits/file/Makefile.am
    	  #	modified:   conduits/test/Makefile.am
    	  #	deleted:    configure.in
    	  #	modified:   gpilotd/Makefile.am
    	  #	modified:   macros/gob2.m4
    	  #	modified:   utils/Makefile.am

 ChangeLog                    |   14 ++
 Makefile.am                  |    3 +-
 acinclude.m4                 |  500 ------------------------------------------
 applet/Makefile.am           |    2 +-
 autogen.sh                   |    8 +-
 build.sh                     |    4 -
 capplet/Makefile.am          |    2 +-
 conduits/backup/Makefile.am  |    2 +-
 conduits/file/Makefile.am    |    2 +-
 conduits/test/Makefile.am    |    2 +-
 configure.in => configure.ac |  134 +++++-------
 gpilotd/Makefile.am          |    2 +-
 macros/gob2.m4               |    7 +-
 macros/pilot_link.m4         |  113 ++++++++++
 utils/Makefile.am            |    2 +-
 15 files changed, 197 insertions(+), 600 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4a5254f..ffebf4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,20 @@
 2010-02-01 Matt Davey <mcdavey mrao cam ac uk>
 	* removed a few more deprecated Glib symbols.
 		#594214, with thanks to Javier Jardon.
+	* bugzilla #607142. Clean up build system, thanks to  H.Habighorst 
+	  #	modified:   Makefile.am
+	  #	deleted:    acinclude.m4
+	  #	modified:   applet/Makefile.am
+	  #	modified:   autogen.sh
+	  #	modified:   capplet/Makefile.am
+	  #	modified:   conduits/backup/Makefile.am
+	  #	modified:   conduits/file/Makefile.am
+	  #	modified:   conduits/test/Makefile.am
+	  #	deleted:    configure.in
+	  #	modified:   gpilotd/Makefile.am
+	  #	modified:   macros/gob2.m4
+	  #	modified:   utils/Makefile.am
+
 
 2009-10-26 Matt Davey <mcdavey mrao cam ac uk>
 	* removed gnome-vfs from gnome-pilot-client.  Still involved via libgnome
diff --git a/Makefile.am b/Makefile.am
index 6e8ef2e..9e49bcc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-ACLOCAL_AMFLAGS = -I macros
+ACLOCAL_AMFLAGS=-I macros
 
 SUBDIRS = 			\
 	po 			\
@@ -39,4 +39,3 @@ EXTRA_DIST=			\
 	gnome-pilot-2.0.pc.in
 
 DISTCLEANFILES = intltool-extract intltool-merge intltool-update
-
diff --git a/applet/Makefile.am b/applet/Makefile.am
index b4e3d7d..043e8f1 100644
--- a/applet/Makefile.am
+++ b/applet/Makefile.am
@@ -30,7 +30,7 @@ gpilot_applet_LDADD = 				\
 #libpilot_applet_la_SOURCES= \
 #	pilot.c
 
-INCLUDES = 						\
+AM_CPPFLAGS = 						\
 	-I$(top_srcdir)					\
 	$(GNOME_PILOT_CFLAGS)				\
 	$(PILOT_APPLET_CFLAGS)			\
diff --git a/autogen.sh b/autogen.sh
index b1fbe87..0edff85 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -5,9 +5,12 @@ srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
 PKG_NAME="gnome-pilot"
-REQUIRED_AUTOMAKE_VERSION=1.6
+REQUIRED_AUTOCONF_VERSION=2.58
+REQUIRED_AUTOMAKE_VERSION=1.9
+REQUIRED_LIBTOOL_VERSION=1.5
+REQUIRED_INTLTOOL_VERSION=0.35.5
 
-(test -f $srcdir/configure.in \
+(test -f $srcdir/configure.ac \
   && test -f $srcdir/gpilotd/gpilotd.c) || {
     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
     echo " top-level gnome directory"
@@ -19,4 +22,3 @@ which gnome-autogen.sh || {
     exit 1
 }
 USE_GNOME2_MACROS=1 . gnome-autogen.sh
-
diff --git a/capplet/Makefile.am b/capplet/Makefile.am
index 4637d6e..15ffbf6 100644
--- a/capplet/Makefile.am
+++ b/capplet/Makefile.am
@@ -2,7 +2,7 @@ NULL=
 
 bin_PROGRAMS = gpilotd-control-applet 
 
-INCLUDES = 						\
+AM_CPPFLAGS = 						\
 	-I$(top_srcdir) 				\
 	-I$(top_srcdir)/gpilotd				\
 	$(GNOME_PILOT_CFLAGS) 				\
diff --git a/conduits/backup/Makefile.am b/conduits/backup/Makefile.am
index 3b9bb16..836984f 100644
--- a/conduits/backup/Makefile.am
+++ b/conduits/backup/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = 					\
+AM_CPPFLAGS = 					\
 	-I$(top_srcdir)/ 			\
 	-I$(top_srcdir)/gpilotd			\
 	$(GNOME_PILOT_CFLAGS) 			\
diff --git a/conduits/file/Makefile.am b/conduits/file/Makefile.am
index ce6cbd7..62f04d6 100644
--- a/conduits/file/Makefile.am
+++ b/conduits/file/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = 					\
+AM_CPPFLAGS = 					\
 	-I$(top_srcdir)	 			\
 	-I$(top_srcdir)/gpilotd			\
 	$(GNOME_PILOT_CFLAGS) 			\
diff --git a/conduits/test/Makefile.am b/conduits/test/Makefile.am
index 8b736f1..bc2ab8f 100644
--- a/conduits/test/Makefile.am
+++ b/conduits/test/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = 			\
+AM_CPPFLAGS = 			\
 	-I$(top_srcdir)		\
 	-I$(top_srcdir)/gpilotd	\
 	$(GNOME_PILOT_CFLAGS)
diff --git a/configure.in b/configure.ac
similarity index 76%
rename from configure.in
rename to configure.ac
index af032be..7f91e52 100644
--- a/configure.in
+++ b/configure.ac
@@ -1,15 +1,21 @@
-AC_INIT(Makefile.am)
-AC_CONFIG_MACRO_DIR([macros])
-AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I macros")
-
 dnl ******************************
 dnl Version
 dnl ******************************
-GNOME_PILOT_MAJOR=2
-GNOME_PILOT_REVISION=0
-GNOME_PILOT_PATCHLEVEL=18
-GNOME_PILOT_VERSION="$GNOME_PILOT_MAJOR.$GNOME_PILOT_REVISION.$GNOME_PILOT_PATCHLEVEL"
-VERSION="$GNOME_PILOT_MAJOR.$GNOME_PILOT_REVISION.$GNOME_PILOT_PATCHLEVEL"
+m4_define([gnome_pilot_major], [2])
+m4_define([gnome_pilot_revision], [0])
+m4_define([gnome_pilot_patchlevel], [18])
+m4_define([gnome_pilot_version], 
+	[gnome_pilot_major.gnome_pilot_revision.gnome_pilot_patchlevel])
+
+dnl *****************************
+dnl Initialize autoconf/automake
+dnl *****************************
+AC_PREREQ(2.58)
+AC_INIT([gnome-pilot],[gnome_pilot_version],[https://bugzilla.gnome.org//enter_bug.cgi?product=gnome-pilot])
+AM_INIT_AUTOMAKE([1.9 -Wall foreign])
+AC_CONFIG_MACRO_DIR([macros])
+AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_SRCDIR([Makefile.am])
 
 dnl ******************************
 dnl Library Versions
@@ -41,19 +47,16 @@ AC_SUBST(GPILOTD_CM_AGE)
 dnl ******************************
 dnl Basic Checks
 dnl ******************************
-
-AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(gnome-pilot, [$VERSION])
-AM_PROG_LIBTOOL
 AM_MAINTAINER_MODE
 
-IT_PROG_INTLTOOL([0.35.0])
+AM_PROG_LIBTOOL
+IT_PROG_INTLTOOL([0.35.5])
 
-AC_ISC_POSIX
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_YACC
-AC_STDC_HEADERS
+AC_HEADER_STDC
+AC_SEARCH_LIBS([strerror],[cposix])
 
 GNOME_COMPILE_WARNINGS
 CFLAGS="$CFLAGS $WARN_CFLAGS"
@@ -72,29 +75,26 @@ if test $PILOT_LINK_MINOR -ge 12; then
 	AC_DEFINE(PILOT_LINK_0_12,,[Building against pilot-link 0.12.0 or greater])
 fi
 
-
 dnl ******************************
 dnl Various Device Support Checks
 dnl ******************************
-AC_ARG_ENABLE([usb],[  --enable-usb         Enable support for the Handspring USB cradle.],[
-	do_usb=$enableval
-],[
-	do_usb=yes
-])
+AC_ARG_ENABLE([usb],
+	[AS_HELP_STRING([--enable-usb],
+	[Enable support for the Handspring USB cradle.])],
+	[do_usb="$enableval"], [do_usb="yes"])
 
-if test x"$do_usb" = xyes ; then
+if test  x"$do_usb" = x"yes"; then
 	AC_DEFINE(WITH_USB_VISOR,, "With USB Visor Support")
 fi
 
 AC_DEFINE(WITH_IRDA,,"With IrDA Support")
 
-AC_ARG_ENABLE([network], [  --enable-network     Enable support for network synchronization],[
-	do_network=$enableval
-],[
-	do_network=yes
-])
+AC_ARG_ENABLE([network],
+	[AS_HELP_STRING([--enable-network],
+	[Enable support for network synchronization])],
+	[do_network="$enableval"],[do_network="yes"])
 
-if test x"$do_network" = xyes ; then
+if test x"$do_network" = x"yes"; then
 	AC_DEFINE(WITH_NETWORK,,"With Network Sync Support")
 fi
 
@@ -104,40 +104,31 @@ dnl ******************************
 dnl Default: use it if it is available
 DBUS_REQUIRED="dbus-glib-1 >= 0.31"
 HAL_REQUIRED="hal >= 0.5.4"
-PKG_CHECK_MODULES(HAL,
-[
-	$DBUS_REQUIRED
-	$HAL_REQUIRED
-],
-[
-	found_hal="yes"
-],
-[:])
-AC_ARG_WITH(hal, [   --with-hal              Enable HAL/DBUS support.],
-[
-if test x"$withval" = xyes; then
-	if test x"$found_hal" = xyes; then
+
+AC_ARG_WITH([hal],
+	[AS_HELP_STRING([--enable-hal],
+	[Enable HAL/DBUS support.])],
+	[enable_hal="$enableval"],[enable_hal="yes"])
+
+if test x"$enable_hal" = x"yes"; then
+	PKG_CHECK_MODULES(HAL,
+	[$DBUS_REQUIRED $HAL_REQUIRED],
+	[found_hal="yes"],[found_hal="no"]) 
+	if test x"$found_hal" = x"yes"; then
 		AC_DEFINE(WITH_HAL,,"Using HAL/DBUS")
-		with_hal=yes
+		with_hal="yes"
 	else
 		AC_MSG_ERROR([HAL/DBUS Library requirements ($DBUS_REQUIRED, $HAL_REQUIRED)
-not met; consider using --without-hal option, or adjusting the PKG_CONFIG_PATH
+not met; consider using --disable-hal option, or adjusting the PKG_CONFIG_PATH
 environment variable if your libraries are in a nonstandard prefix so pkg-config
 can find them.])
 	fi
-fi
-],
-[
 dnl if --with-hal wasn't specified, carry on without HAL if it's not found.
-if test x"$found_hal" = xyes; then
-	AC_DEFINE(WITH_HAL,,"Using HAL/DBUS")
-	with_hal=yes
 else
 	AC_MSG_WARN([HAL/DBUS Library requirements ($DBUS_REQUIRED, $HAL_REQUIRED)
 not met; disabling HAL support.])
 fi
-]
-)
+
 dnl ******************************
 dnl Library Checks
 dnl ******************************
@@ -254,7 +245,7 @@ if test $ac_cv_func_crypt = no; then
 fi
 
 dnl Create files.
-AC_OUTPUT([
+AC_CONFIG_FILES([
 Makefile 
 gpilotd/Makefile
 applet/Makefile
@@ -270,30 +261,13 @@ help/Makefile
 help/C/Makefile
 gnome-pilot-2.0.pc
 ])
-
-echo ""
-echo "  Configuration :"
-echo ""
-
-if test x"$do_network" = xyes; then
-	echo "          network sync : yes"
-else
-	echo "          network sync : no"
-fi
-if test x"$do_usb" = xyes; then
-	echo "          usb          : yes"
-else
-	echo "          usb          : no"
-fi
-if test x"$with_hal" = xyes; then
-	echo "          HAL/DBUS     : yes"
-else
-	echo "          HAL/DBUS     : no"
-fi
-if test x"$GOB" = xno; then
-	echo "          gob          : no"
-else
-	echo "          gob          : yes"
-fi
-	echo "          pilot-link   : $PILOT_LINK_VERSION"
-echo ""
+AC_OUTPUT
+
+AC_MSG_NOTICE([
+Configuration :
+	network sync : $do_network
+	usb          : $do_usb
+	HAL/DBUS     : $with_hal
+	gob          : $GOB
+	pilot-link   : $PILOT_LINK_VERSION
+])
diff --git a/gpilotd/Makefile.am b/gpilotd/Makefile.am
index 7eedb4c..6d0cfa3 100644
--- a/gpilotd/Makefile.am
+++ b/gpilotd/Makefile.am
@@ -3,7 +3,7 @@ libexec_PROGRAMS = gpilotd
 
 bin_PROGRAMS = gpilotd-session-wrapper
 
-INCLUDES = 							\
+AM_CPPFLAGS = 							\
 	-I$(top_srcdir)						\
 	-DG_LOG_DOMAIN=\"gpilotd\" 				\
 	-DGP_PILOT_LINK_VERSION=\"@PILOT_LINK_VERSION \" 	\
diff --git a/macros/gob2.m4 b/macros/gob2.m4
index b3659fa..c1970ea 100644
--- a/macros/gob2.m4
+++ b/macros/gob2.m4
@@ -1,13 +1,12 @@
+#serial 0.2
 dnl
 dnl GOB_HOOK(script if found, fail)
 dnl if fail = "failure", abort if GOB not found
 dnl
-
-
 AC_DEFUN([GOB2_HOOK],[
 	AC_PATH_PROG(GOB2,gob2)
-	if test ! x$GOB2 = x; then	
-		if test ! x$1 = x; then 
+	if test ! x"$GOB2" = x""; then	
+		if test ! x"$1" = x""; then 
 			AC_MSG_CHECKING(for gob-2 >= $1)
 			g_r_ve=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 			g_r_ma=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
diff --git a/macros/pilot_link.m4 b/macros/pilot_link.m4
new file mode 100644
index 0000000..284a40e
--- /dev/null
+++ b/macros/pilot_link.m4
@@ -0,0 +1,113 @@
+#serial 0.2
+AC_SUBST(PISOCK_CFLAGS)
+AC_SUBST(PISOCK_LIBS)
+
+AC_DEFUN([PILOT_LINK_HOOK],
+	[AC_ARG_WITH([pisock],
+	[AS_HELP_STRING([--with-pisock],
+	[Specify prefix for pisock files])],
+	[
+	if test x"$withval" = x"yes"; then
+	    dnl Note that an empty true branch is not valid sh syntax.
+	    ifelse([$1], [], :, [$1])
+	else
+	    PISOCK_CFLAGS="-I$withval/include"
+	    incdir="$withval/include"
+	    PISOCK_LIBS="-L$withval/lib -lpisock -lpisync"
+	    AC_MSG_CHECKING("for existance of $withval/lib/libpisock.so")
+	    if test -r $withval/lib/libpisock.so; then
+		AC_MSG_RESULT([yes])
+	    else
+		AC_MSG_ERROR([Unable to find libpisock. Try http://www.pilot-link.org.])
+	    fi
+	fi
+	])
+
+	if test x"$PISOCK_CFLAGS" = x""; then
+	    AC_CHECK_HEADER(pi-version.h, [incdir="/usr/include"], [
+	    AC_CHECK_HEADER(libpisock/pi-version.h, [PISOCK_CFLAGS="-I/usr/include/libpisock"
+	                                             piversion_include="libpisock/pi-version.h"
+						     incdir="/usr/include/libpisock"
+                                                    ], [
+	    AC_CHECK_HEADER($prefix/include/pi-version.h, [PISOCK_CFLAGS="-I$prefix/include/libpisock"
+	                                                   piversion_include="$prefix/include/pi-version.h"
+						           if test x$PISOCK_LIBDIR = x; then
+							      incdir="$prefix/include"
+							      PISOCK_LIBS="-L$prefix/lib -lpisock -lpisync"
+                                                           fi							  ],
+	    AC_MSG_ERROR([Unable to find pi-version.h])) 
+	    ])
+	    ])
+	fi
+				
+	if test "x$PISOCK_LIBS" = "x"; then
+		AC_CHECK_LIB(pisock, pi_accept, [ PISOCK_LIBS="-lpisock -lpisync"], 
+			[ AC_MSG_ERROR([Unable to find libpisock. Try http://www.pilot-link.org.]) ])
+	fi
+		
+	AC_ARG_ENABLE([pilotlinktest],
+		[AS_HELP_STRING([--enable-pilotlinktest],
+		[Test for correct version of pilot-link])],
+		[testplversion="$enableval"], [testplversion="yes"]
+	)
+
+	if test x"$piversion_include" = x""; then
+		piversion_include="pi-version.h"
+	fi
+
+	pi_major=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_VERSION'|sed 's/#define PILOT_LINK_VERSION \([[0-9]]*\)/\1/'`
+	pi_minor=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_MAJOR'|sed 's/#define PILOT_LINK_MAJOR \([[0-9]]*\)/\1/'`
+	pi_micro=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_MINOR'|sed 's/#define PILOT_LINK_MINOR \([[0-9]]*\)/\1/'`
+	pi_patch=`cat $incdir/pi-version.h|grep '#define PILOT_LINK_PATCH'|sed 's/#define PILOT_LINK_PATCH \"\(.*\)\"/\1/'`
+
+	PILOT_LINK_MAJOR="$pi_major"
+	PILOT_LINK_MINOR="$pi_minor"
+	PILOT_LINK_MICRO="$pi_micro"
+	PILOT_LINK_PATCH="$pi_patch"
+	PILOT_LINK_VERSION="$pi_major.$pi_minor.$pi_micro$pi_patch"
+
+	if test x"$testplversion" = x"yes"; then
+		AC_MSG_CHECKING([for pilot-link version >= $1])
+		pl_ma=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+		pl_mi=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+		pl_mc=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+		CFLAGS_save="$CFLAGS"
+		CFLAGS="$CFLAGS $PISOCK_CFLAGS"
+		AC_TRY_RUN(
+			[
+			#include <$piversion_include>
+			int main(int argc,char *argv[]) {
+				if (PILOT_LINK_VERSION == $pl_ma) {
+					if (PILOT_LINK_MAJOR == $pl_mi) {
+						if (PILOT_LINK_MINOR >= $pl_mc) {
+							return 0;
+				       	  	}
+					} else if (PILOT_LINK_MAJOR > $pl_mi) {
+						return 0;
+					}
+				} else if (PILOT_LINK_VERSION > $pl_ma) {
+					return 0;
+				}
+				return 1;
+			}
+			],
+			[AC_MSG_RESULT([yes (found $PILOT_LINK_VERSION)])],
+			[AC_MSG_ERROR([pilot-link >= $1 required])],
+			[AC_MSG_WARN([No action taken for crosscompile])]
+		)
+		CFLAGS="$CFLAGS_save"
+	fi
+
+	unset piversion_include
+	unset pi_verion
+	unset pi_major
+	unset pi_minor
+	unset pi_patch
+	unset incdir
+	unset pl_mi
+	unset pl_ma
+	unset pl_ve
+])
+
+AC_DEFUN([PILOT_LINK_CHECK],[PILOT_LINK_HOOK($1,[],nofailure)
+])
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 5c3c557..d76a6f4 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = 								\
+AM_CPPFLAGS = 								\
 	-I$(top_srcdir)							\
 	-I$(top_srcdir)/gpilotd						\
 	$(GNOME_PILOT_CFLAGS) 						\



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]