[dwm] autoconf

From: Kurt Van Dijck <kurt.van.dijck_AT_eia.be>
Date: Thu, 19 Mar 2009 16:36:44 +0100

Hi,

I'm in the process of cross-compiling dwm. I understand the idea of
having a config.mk for this, but it is not the easiest.
Since I had to fix some other packets too, I learned myself to setup a
minimal autoconf. This allows one to do:
./configure && make && make install

Since dwm is distributed as a source package and not binary, I suspect
this can mean a serious improvement.

to use this, I had to:
* apply patch
* automake -ac (create missing scripts for autoconf/automake)
* autoconf
* ./configure ....

I have 1 configurable option, to keep debugging symbols (interesting for
cross-compile setup).

Kurt Van Dijck
-----
Index: dwm-5.4.1/configure.ac
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dwm-5.4.1/configure.ac 2009-03-17 11:40:38.000000000 +0100
@@ -0,0 +1,32 @@
+AC_PREREQ(2.61)
+AC_INIT([dwm],[5.4.1])
+#AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+#AC_CONFIG_HEADERS([config.h])
+AC_CANONICAL_HOST
+
+CFLAGS="$CFLAGS -std=c99 -pedantic -Wall -Os"
+CPPFLAGS="$CPPFLAGS -I."
+LDFLAGS="$LDFLAGS"
+
+dnl test compilers, tools
+AC_PROG_CC_C99
+AC_PROG_INSTALL
+AC_PROG_SED
+
+#AC_CHECK_HEADERS([stddef.h])
+#AC_HEADER_STDC
+
+AC_ARG_ENABLE(debug, AC_HELP_STRING(--enable-debug, [keep debugging info]))
+case x$enable_debug in
+ xyes)
+ CFLAGS="$CFLAGS -g3"
+ ;;
+ *)
+ CFLAGS="$CFLAGS -g0 -s"
+ ;;
+esac
+
+AC_SEARCH_LIBS(XOpenDisplay, X11, , AC_MSG_ERROR(library X11 not found))
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
Index: dwm-5.4.1/Makefile.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dwm-5.4.1/Makefile.in 2009-03-17 11:45:22.000000000 +0100
@@ -0,0 +1,34 @@
+default:
+
+PREFIX = @prefix@
+VPATH = @srcdir@
+
+CC = @CC@
+INSTALL = @INSTALL@
+SED = @SED@
+
+CFLAGS = @CFLAGS@
+CPPFLAGS= @CPPFLAGS@ @DEFS@
+LDFLAGS = @LDFLAGS@
+LDLIBS = @LIBS@
+
+config.h:
+ cp config.def.h config.h
+
+dwm.o: config.h
+
+dwm: dwm.o
+
+default: dwm
+
+dwm.1.ver: dwm.1
+ $(SED) -e "s,VERSION,@PACKAGE_VERSION@,g" < $< > $@
+default: dwm.1.ver
+
+clean:
+ rm -rf dwm.o dwm dwm.1.ver
+
+install: dwm dwm.1.ver
+ $(INSTALL) $(INSTOPTS) -D dwm $(DESTDIR)$(PREFIX)/bin/dwm
+ $(INSTALL) $(INSTOPTS) -D dwm.1.ver $(DESTDIR)$(PREFIX)/share/man/dwm.1
+
Index: dwm-5.4.1/dwm.c
===================================================================
--- dwm-5.4.1.orig/dwm.c 2009-02-08 13:10:49.000000000 +0100
+++ dwm-5.4.1/dwm.c 2009-03-17 11:40:38.000000000 +0100
@@ -1627,7 +1627,7 @@
 void
 updatestatus() {
         if(!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
- strcpy(stext, "dwm-"VERSION);
+ strcpy(stext, PACKAGE_NAME"-"PACKAGE_VERSION);
         drawbar();
 }
 
@@ -1708,7 +1708,7 @@
 int
 main(int argc, char *argv[]) {
         if(argc == 2 && !strcmp("-v", argv[1]))
- die("dwm-"VERSION", © 2006-2009 dwm engineers, see LICENSE for details\n");
+ die(PACKAGE_NAME"-"PACKAGE_VERSION", © 2006-2009 dwm engineers, see LICENSE for details\n");
         else if(argc != 1)
                 die("usage: dwm [-v]\n");
 
Received on Thu Mar 19 2009 - 15:36:44 UTC

This archive was generated by hypermail 2.2.0 : Thu Mar 19 2009 - 15:48:04 UTC