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

Re: gEDA-user: pcb library and hid build modification



Hi all,

Please ignore the last patch, this one includes the changes of the
previous patch and additional enhancements.

* Adds configure.ac.in script to dynamically add hid Makefiles to the
configure.ac file.
* Updates autogen.sh to create configure.ac from configure.ac.in for
this purpose.
* PCB executable is now directly linked with the _hid_ modules except
for _hid_common.
   - This allows a single libpcb to be used for all gui hids.
* _hid_common is still incorporated into libpcb.
* Fixes some problems building debian packages by adding @INCLUDES@
substitution that makes the include directories consitent between all
of the Makefiles.
* Header files from /src are now included in the installation in the
${prefix}/include/pcb directory.

This new patch allows you to just add a new hid directory with
Makefile.am, hid.conf, and sources and run autogen.sh to get it
incorporated into the build process.

Please let me know if this can be incorporated or not.

Thanks,
Jason

On Mon, May 25, 2009 at 12:20 AM, Jason Childs
<oblivian@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
>   For your consideration...
>   I've incorporated a libtool based library from the PCB sources, and
>   each HID is now created with libtool as static archives using their
>   own Makefiles.  I hope this will make it easier to incorporate new
>   HID's in the future since it keeps you from editing a single
>   makefile.  New HIDs should only require copying an existing HID
>   directory and modifying the Makefile which should be picked up from
>   the rest of the Makefile hierarchy.  You will still need to add the
>   HID makefile to the configure.ac file for automake creation though,
>   but that should be it.
>   This also separates the pcb executable from the "core" files and
>   creates a libpcb.so file that the main.c is linked against to create
>   the pcb executable.
>   I'm working on python bindings for both libgeda and pcb so this was
>   the "easiest" way I could think of to get access to the pcb functions
>   for export.  This may have added benifit allowing for easier combining
>   of libgeda and libpcb in the future as well if desired.
>   Compiles cleanly and works on Ubuntu.  Tried not to break the WIN32
>   code, but have no way to test.
>   Jason
diff --git a/autogen.sh b/autogen.sh
index d1671fb..d14b565 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -8,6 +8,37 @@
 # for now avoid using bash as not everyone has that installed
 CONFIG_SHELL=/bin/sh
 export CONFIG_SHELL
+############################################################################
+#
+# update configure.ac using configure.ac.in to pull in any new hid's
+#
+echo "Updating configure.ac with hids"
+for hid in $(cd src/hid; echo *); do
+  if test -f src/hid/$hid/hid.conf; then
+     AC_CONFIG_FILES_HIDS="$AC_CONFIG_FILES_HIDS src/hid/$hid/Makefile"
+  fi
+done
+sed -e "s%@AC_CONFIG_FILES_HIDS@%${AC_CONFIG_FILES_HIDS}%" configure.ac.in > configure.ac
+
+
+############################################################################
+#
+# libtoolize
+#
+
+echo "Checking for libtoolize..."
+# Possible names for libtool/libtoolize
+libtoolize_candidates="libtoolize glibtoolize"
+
+LIBTOOLIZE=`which $libtoolize_candidates 2>/dev/null | head -n1`
+(! test -z "$LIBTOOLIZE") || {
+  echo
+  echo "**Error**: You must have \`libtool' installed."
+  echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/";
+  DIE=1
+}
+echo "Running libtoolize..."
+$LIBTOOLIZE --force --copy || exit 1
 
 ############################################################################
 #
diff --git a/configure.ac b/configure.ac
index 08fcd6e..9a96a84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,11 @@ AM_CONFIG_HEADER([config.h])
 
 AM_MAINTAINER_MODE
 
+dnl Initialize libtool
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+AC_CONFIG_MACRO_DIR([m4])
+
 dnl determine host type
 AC_CANONICAL_HOST
 AC_MSG_CHECKING(for windows)
@@ -93,7 +98,6 @@ ftp://ftp.gnu.org/pub/gnu/bison/
 fi
 
 AC_PROG_INSTALL
-AC_PROG_RANLIB
 
 #
 # Used for building the icons
@@ -220,7 +224,7 @@ esac
 
 if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
 then
-    HIDLIST=
+   HIDLIST=
 fi
 
 AC_MSG_CHECKING([whether to enable toporouter])
@@ -315,9 +319,7 @@ AC_ARG_WITH([exporters],
 AC_MSG_RESULT([$with_exporters])
 for e in `echo $with_exporters | sed 's/,/ /g'`; do
     case " $hid_exporters " in
-      *\ $e\ * )
-         HIDLIST="$HIDLIST $e"
-	 ;;
+      *\ $e\ * ) HIDLIST="$HIDLIST $e" ;;
       * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
     esac
 done
@@ -349,8 +351,10 @@ for hid in $HIDLIST; do
    fi
 done
 
-for e in $HIDLIST; do
-    HIDLIBS="$HIDLIBS lib$e.a"
+AC_MSG_RESULT([Processing all enabled HIDs])
+for hid in $HIDLIST; do
+   AC_MSG_RESULT([Adding $hid as _hid_$hid.la])
+   HIDLIBS="$HIDLIBS hid/$hid/_hid_$hid.la"
 done
 
 AC_SUBST(HIDLIST)
@@ -836,6 +840,8 @@ AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
 CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
 CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
 CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
+INCLUDES="-I. -I\$(srcdir) -I\$(top_builddir) -I\$(top_builddir)/src -I\$(top_builddir)/src/hid -I\$(top_builddir)/src/icons -I\$(top_builddir)/src/gts -I\$(top_srcdir) -I\$(top_srcdir)/src -I\$(top_srcdir)/src/hid -I\$(top_srcdir)/src/icons -I\$(top_srcdir)/src/gts"
+AC_SUBST(INCLUDES)
 
 # directory for old-style library and for fonts
 PCBLIBDIR=${datadir}/pcb
@@ -925,7 +931,12 @@ if test -d $srcdir/newlib; then
    AC_CONFIG_FILES(newlib/tests/Makefile)
 fi
 AC_CONFIG_FILES(src/Makefile)
+AC_CONFIG_FILES(src/hid/Makefile)
+AC_CONFIG_FILES(src/hid/common/Makefile)
+AC_CONFIG_FILES([ src/hid/batch/Makefile src/hid/bom/Makefile src/hid/gerber/Makefile src/hid/gtk/Makefile src/hid/lesstif/Makefile src/hid/lpr/Makefile src/hid/nelma/Makefile src/hid/png/Makefile src/hid/ps/Makefile])
+AC_CONFIG_FILES(src/gts/Makefile)
 AC_CONFIG_FILES(src/icons/Makefile)
+
 if test -d $srcdir/tools; then
    AC_CONFIG_FILES(tools/Makefile)
 fi
diff --git a/configure.ac.in b/configure.ac.in
new file mode 100644
index 0000000..ac79b74
--- /dev/null
+++ b/configure.ac.in
@@ -0,0 +1,979 @@
+dnl $Id$
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([pcb], [1.99y])
+AC_CONFIG_SRCDIR([src/draw.c])
+AC_PREREQ([2.60])
+AM_INIT_AUTOMAKE([1.9])
+AC_GNU_SOURCE
+AM_CONFIG_HEADER([config.h])
+
+AM_MAINTAINER_MODE
+
+dnl Initialize libtool
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+AC_CONFIG_MACRO_DIR([m4])
+
+dnl determine host type
+AC_CANONICAL_HOST
+AC_MSG_CHECKING(for windows)
+PCB_PATH_DELIMETER=":"
+PCB_DIR_SEPARATOR_S="/"
+PCB_DIR_SEPARATOR_C='/'
+case $host in
+	*-*-cygwin* )
+		CFLAGS="$CFLAGS ${CYGWIN_CFLAGS}"
+		CPPFLAGS="$CPPFLAGS ${CYGWIN_CPPFLAGS}"
+		;;
+
+	*-*-mingw* )
+		WIN32=yes
+		CFLAGS="$CFLAGS ${MINGW_CFLAGS:--mms-bitfields -mwindows}"
+		CPPFLAGS="$CPPFLAGS ${MINGW_CPPFLAGS:--mms-bitfields -mwindows}"
+		;;
+
+	* )
+		WIN32=no
+		;;
+esac
+
+AC_MSG_RESULT($WIN32)
+AC_SUBST(WIN32)
+AM_CONDITIONAL(WIN32, test x$WIN32 = xyes)
+if test "x$WIN32" = "xyes" ; then
+	PCB_PATH_DELIMETER=";"
+	PCB_DIR_SEPARATOR_S="\\\\"
+	PCB_DIR_SEPARATOR_C='\\'
+fi
+
+AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_C,'$PCB_DIR_SEPARATOR_C',[Directory separator char])
+AC_DEFINE_UNQUOTED(PCB_DIR_SEPARATOR_S,"$PCB_DIR_SEPARATOR_S",[Directory separator string])
+AC_DEFINE_UNQUOTED(PCB_PATH_DELIMETER,"$PCB_PATH_DELIMETER",[Search path separator string])
+
+
+dnl Checks for programs.
+AC_PROG_CC
+
+if test "x$WIN32" = "xyes" ; then
+	AC_CHECK_TOOL(WINDRES, windres, [no])
+	if test "$WINDRES" = "no" ; then
+		AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
+	fi
+fi
+
+# i18n
+GETTEXT_PACKAGE=$PACKAGE
+AH_TEMPLATE([GETTEXT_PACKAGE], [Name of this program's gettext domain])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"])
+AC_SUBST(GETTEXT_PACKAGE)
+
+AM_GNU_GETTEXT_VERSION([0.14])
+AM_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.35.0])
+
+AC_C_INLINE
+AC_PROG_CC_STDC
+AM_PROG_CC_C_O
+AC_PROG_CPP
+AC_PROG_AWK
+
+AM_PROG_LEX
+AC_PATH_PROG(LEX_PATH, $LEX, [notfound])
+if test "$LEX_PATH" = "notfound" ; then
+	AC_MSG_ERROR([Couldn't find a usable lex program.
+Please install flex which is available from
+ftp://ftp.gnu.org/pub/non-gnu/flex/
+])
+fi
+
+
+AC_PROG_YACC
+AC_PATH_PROG(YACC_PATH, $YACC, [notfound])
+if test "$YACC_PATH" = "notfound" ; then
+	AC_MSG_ERROR([Couldn't find a usable yacc program.
+Please install bison which is available from
+ftp://ftp.gnu.org/pub/gnu/bison/
+])
+fi
+
+AC_PROG_INSTALL
+
+#
+# Used for building the icons
+#
+AC_PATH_PROG(XPMTOPPM, xpmtoppm, notfound)
+AC_PATH_PROG(PPMTOWINICON, ppmtowinicon, notfound)
+AC_PATH_PROG(CONVERT, convert, notfound)
+
+docs_yesno=yes
+
+AC_MSG_CHECKING([if the documentation should be built])
+AC_ARG_ENABLE([doc],
+[  --enable-doc            Build and install the documentation [[default=yes]]],
+[
+if test "X$enable_doc" = "Xno" ; then
+        DOC=""
+        AC_MSG_RESULT([no])
+        docs_yesno=no
+else
+        DOC=doc
+        AC_MSG_RESULT([yes])
+        docs_yesno=yes
+fi
+],
+[
+DOC=doc
+AC_MSG_RESULT([yes])
+docs_yesno=yes
+])
+AC_SUBST(DOC)
+
+if test "X$docs_yesno" = "Xyes" -a "X$USE_MAINTAINER_MODE" = "Xyes" ; then
+   AC_CHECK_PROGS(MKINFO, makeinfo, no)
+   if test "X$MKINFO" != "Xno"; then
+      AC_MSG_CHECKING([for GNU makeinfo version >= 4.6])
+      v=`$MKINFO --version | grep "GNU texinfo"`
+      if test $? -ne 0; then
+         AC_MSG_RESULT([non-GNU])
+         MKINFO="no"
+      fi
+   fi
+   if test "X$MKINFO" != "Xno"; then
+      vmajor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\1/'`
+      vminor=`echo "$v" | sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)$/\2/'`
+      AC_MSG_RESULT([$vmajor.$vminor])
+      if test "$vmajor" -lt 4 \
+              || (test "$vmajor" -eq 4 && test "$vminor" -lt 6); then
+         MKINFO=no
+      fi
+   fi
+   if test "X$MKINFO" = "Xno"; then
+      AC_MSG_ERROR([You have requested a maintainer-mode build and a build
+of the documentation.  For this to work, you must have version 4.6 or newer of
+the GNU texinfo package.  You seem to have
+
+$v
+
+])
+   fi
+
+   AC_CHECK_PROGS(TEXI2DVI, texi2dvi, no)
+   if test "X$TEXI2DVI" = "Xno"; then
+      AC_MSG_ERROR([You have requested a maintainer-mode build and a build
+of the documentation.  For this to work, you must have the texi2dvi program
+installed.])
+   fi
+
+
+	AC_PATH_PROG(PERL, perl, notfound)
+	if test "X$PERL" = "Xnotfound"; then
+			AC_MSG_ERROR([You have requested a maintainer-mode build and a build
+of the documentation.  For this to work, you must have perl installed.
+])
+	fi
+fi
+
+# FIXME:  for now, only try to add -rdynamic if we're using gcc.  We really
+# need to figure out what the correct test is here.  In the mean time, this
+# should let things build with SunPRO again.
+if test "x$GCC" = "xyes"; then
+AC_MSG_CHECKING([If the compiler accepts -rdynamic])
+old_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -rdynamic"
+AC_LINK_IFELSE([int main(){}],
+	[AC_MSG_RESULT([yes])],
+	[LDFLAGS="$old_LDFLAGS"
+	AC_MSG_RESULT([no])
+	])
+fi
+
+# ------------- HID config -------------------
+
+hid_guis=""
+hid_printers=""
+hid_exporters=""
+hid_always=""
+
+for hid in `cd $srcdir/src/hid; echo *`; do
+    F=$srcdir/src/hid/$hid/hid.conf
+    if test -f $F 
+    then
+    echo checking $F
+        . $F
+	case $type in
+	  gui ) hid_guis="$hid_guis $hid" ;;
+	  printer ) hid_printers="$hid_printers $hid" ;;
+	  export ) hid_exporters="$hid_exporters $hid" ;;
+	  always ) hid_always="$hid_always $hid" ;;
+	esac
+    fi
+done
+
+AC_MSG_CHECKING([for which gui to use])
+AC_ARG_WITH([gui],
+[  --with-gui=	          Specify the GUI to use: batch gtk lesstif [[default=gtk]]],
+[],
+[with_gui=gtk]
+)
+AC_MSG_RESULT([$with_gui])
+case " $hid_guis no none " in
+     *\ $with_gui\ * ) HIDLIST="$with_gui" ;;
+     * ) AC_MSG_ERROR([$with_gui is not a valid gui]) ;;
+esac
+
+if test x"$with_gui" = x"none" -o x"$with_gui" = x"no"
+then
+   HIDLIST=
+fi
+
+AC_MSG_CHECKING([whether to enable toporouter])
+AC_ARG_ENABLE([toporouter],
+ [AS_HELP_STRING([--enable-toporouter], [build toporouter [default=yes]]) ]
+)
+AS_CASE(["x$enable_toporouter"],[xyes | xno],,
+ [enable_toporouter=yes
+ ]
+)
+AC_MSG_RESULT([$enable_toporouter])
+AM_CONDITIONAL([WITH_TOPOROUTER], test $enable_toporouter != no)
+
+AC_MSG_CHECKING([whether to enable toporouter output])
+AC_ARG_ENABLE([toporouter-output],
+ [AS_HELP_STRING([--enable-toporouter-output], [enable toporouter graphical output [default=no]]) ]
+)
+AS_CASE(["z$enable_toporouter_output"],[zyes | zno],,
+ [enable_toporouter_output=no]
+)
+AC_MSG_RESULT([$enable_toporouter_output])
+AS_CASE([$enable_toporouter_output],[yes],
+ [
+  topo_output_enabled=1
+ ],
+ [
+  topo_output_enabled=0
+ ]
+)
+AC_DEFINE_UNQUOTED([TOPO_OUTPUT_ENABLED], [$topo_output_enabled],
+ [Define to 1 to enable toporouter graphical output]
+)
+
+PKG_PROG_PKG_CONFIG()
+
+if test "x$enable_toporouter_output" = "xyes"; then
+   PKG_CHECK_MODULES(CAIRO, cairo,,
+                     [AC_MSG_ERROR([Cannot find cairo, needed by the toporouter
+Please review the following errors:
+$CAIRO_PKG_ERRORS])]
+   )
+fi
+
+AC_MSG_CHECKING([for whether to use DBUS])
+AC_ARG_ENABLE([dbus],
+[  --enable-dbus           Enable DBUS IPC],
+[],[enable_dbus=no])
+
+AC_MSG_RESULT([$enable_dbus])
+AM_CONDITIONAL(WITH_DBUS, test x$enable_dbus = xyes)
+
+if test "x$enable_dbus" = "xyes"; then
+	case " $with_gui " in
+		*\ gtk\ *) ;;
+		*\ lesstif\ *) ;;
+		* ) AC_MSG_ERROR([DBUS enabled but only works with a mainloop capable GUI HID.
+Either do not use --enable-dbus or enable the gtk or lesstif GUI HID.])
+	esac
+	
+	PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.61,
+		[saved_LIBS="$LIBS"
+		 LIBS="$LIBS $DBUS_LIBS"
+		 AC_CHECK_FUNCS(dbus_watch_get_unix_fd)
+		 LIBS="$saved_LIBS" ],
+		[AC_MSG_ERROR([Cannot find dbus-1 >= 0.61, install it and rerun ./configure
+Please review the following errors:
+$DBUS_PKG_ERRORS])]
+	)
+	DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
+	
+	AC_DEFINE([HAVE_DBUS], 1,
+		[Define to 1 if DBUS IPC is to be compiled in])
+
+fi
+
+AC_MSG_CHECKING([for which printer to use])
+AC_ARG_WITH([printer],
+[  --with-printer= 	  Specify the printer: lpr [[default=lpr]]],
+[],[with_printer=lpr])
+AC_MSG_RESULT([$with_printer])
+case " $hid_printers " in
+     *\ $with_printer\ * )
+         HIDLIST="$HIDLIST $with_printer"
+	 ;;
+     * ) AC_MSG_ERROR([$with_printer is not a valid printer]) ;;
+esac
+
+AC_MSG_CHECKING([for which exporters to use])
+AC_ARG_WITH([exporters],
+[  --with-exporters=       Enable export devices: bom gerber nelma png ps [[default=bom gerber nelma png ps]]],
+[],[with_exporters=$hid_exporters])
+AC_MSG_RESULT([$with_exporters])
+for e in `echo $with_exporters | sed 's/,/ /g'`; do
+    case " $hid_exporters " in
+      *\ $e\ * ) HIDLIST="$HIDLIST $e" ;;
+      * ) AC_MSG_ERROR([$e is not a valid exporter]) ;;
+    esac
+done
+
+if test "X$enable_jpeg" = "Xno" -a "X$enable_gif" = "Xno" -a "X$enable_png" = "Xno" ; then
+	case " ${HIDLIST} " in
+		*\ png\ *)
+			AC_MSG_ERROR([you have requested the png HID but turned off all output
+formats!  If you do not want gif/jpeg/png output, use --with-exporters to list
+which exporters you want and do not list png there.])
+			;;
+
+		*)
+			;;
+	esac
+fi
+
+for hid in $HIDLIST; do
+    F=$srcdir/src/hid/$hid/hid.conf
+    if test -f $F ; then
+        echo checking $hid depedencies
+        deps=
+        . $F
+        for dep in $deps; do
+            if test "X`echo $HIDLIST | grep $dep`" = "X"; then
+                AC_MSG_ERROR([you have requested the $hid HID but not the $dep HID, which it depends on])
+            fi
+        done
+   fi
+done
+
+AC_MSG_RESULT([Processing all enabled HIDs])
+for hid in $HIDLIST; do
+   AC_MSG_RESULT([Adding $hid as _hid_$hid.la])
+   HIDLIBS="$HIDLIBS hid/$hid/_hid_$hid.la"
+done
+
+AC_SUBST(HIDLIST)
+AC_SUBST(HIDLIBS)
+
+# ------------- end HID config -------------------
+
+######################################################################
+#
+# desktop integration
+#
+
+AC_PATH_PROG(SETENV, env, [])
+AC_PATH_PROG(GTK_UPDATE_ICON_CACHE_BIN, gtk-update-icon-path, [true])
+
+# Change default location for XDG files (MIME and Icons)
+AC_ARG_WITH(xdgdatadir, [  --with-xdgdatadir=path  Change where the theme icons 
+and mime registrations are installed [[DATADIR]]], [opt_xdgdatadir=$withval])
+
+# Change default location for KDE data files (KDE MIME registrations)
+AC_ARG_WITH(kdedatadir, [  --with-kdedatadir=path  Change where the KDE mime reg
+istrations are installed [[DATADIR]]], [opt_kdedatadir=$withval])
+
+if test x$opt_xdgdatadir = x; then
+	# path was not specified with --with-xdgdatadir
+	XDGDATADIR='${datadir}'
+else
+	# path WAS specified with --with-xdgdatadir
+	XDGDATADIR="$opt_xdgdatadir"
+fi
+AC_SUBST(XDGDATADIR)
+
+if test x$opt_kdedatadir = x; then
+	# path was not specified with --with-kdedatadir
+	KDEDATADIR='${datadir}'
+else
+	# path WAS specified with --with-kdedatadir
+	KDEDATADIR="$opt_kdedatadir"
+fi
+AC_SUBST(KDEDATADIR)
+
+AC_ARG_ENABLE(update-desktop-database,
+	AC_HELP_STRING([--disable-update-desktop-database],
+	[do not update desktop database after installation]),,
+	enable_update_desktop_database=yes)
+
+AM_CONDITIONAL(ENABLE_UPDATE_DESKTOP_DATABASE, test x$enable_update_desktop_database = xyes)
+
+if test x$enable_update_desktop_database = xyes ; then
+	AC_PATH_PROG(UPDATE_DESKTOP_DATABASE, [update-desktop-database], no)
+	if test $UPDATE_DESKTOP_DATABASE = no; then
+	AC_MSG_ERROR([Cannot find update-desktop-database, make sure it is installed and in your PATH, or configure with --disable-update-desktop-database])
+	fi
+fi
+
+AC_ARG_ENABLE(update-mime-database,
+	AC_HELP_STRING([--disable-update-mime-database],
+	[do not update mime database after installation]),,
+	enable_update_mime_database=yes)
+
+AM_CONDITIONAL(ENABLE_UPDATE_MIME_DATABASE, test x$enable_update_mime_database = xyes)
+
+if test x$enable_update_mime_database = xyes ; then
+	AC_PATH_PROG(UPDATE_MIME_DATABASE, [update-mime-database], no)
+	if test $UPDATE_MIME_DATABASE = no; then
+	AC_MSG_ERROR([Cannot find update-mime-database, make sure it is installed and in your PATH, or configure with --disable-update-mime-database])
+	fi
+fi
+
+#
+######################################################################
+
+AC_PATH_PROGS(M4, gm4 m4, [none])
+if test "X$M4" = "Xnone" ; then
+	AC_MSG_ERROR([Did not find a m4 executible.  You need to make sure
+	that m4 is installed on your system and that m4 is in your path])
+fi
+AC_MSG_CHECKING([if $M4 has the division involving negative numbers bug])
+pcb_m4_r=`echo "eval(-2/2)" | $M4`
+if test "$pcb_m4_r" != "-1" ; then
+	AC_MSG_RESULT([yes])
+	AC_MSG_ERROR([It appears that $M4 has a bug involving division
+with negative numbers.  In particular it just returned the result that
+-2/2 = $pcb_m4_r instead of -1.  This is a known bug in GNU m4-1.4.9.  Please
+install a non-broken m4.])
+else
+	AC_MSG_RESULT([no])
+fi
+
+
+AC_PATH_PROGS(WISH, wish wish83 wish8.3 wish80 wish8.0 cygwish83 cygwish80,[none])
+if test "X$WISH" = "Xnone" ; then
+	AC_MSG_ERROR([Did not find the wish executible.  You need to make sure
+	that tcl is installed on your system and that wish is in your path])
+fi
+
+AC_DEFINE_UNQUOTED(M4,$M4,[m4 executible])
+GNUM4=$M4
+AC_SUBST(GNUM4)
+AC_DEFINE_UNQUOTED(GNUM4,"$M4",[m4 program used by pcb])
+
+AC_CHECK_PROGS(LATEX, latex, notfound)
+AM_CONDITIONAL(MISSING_LATEX, test x$LATEX = xnotfound)
+
+AC_CHECK_PROGS(PDFLATEX, pdflatex, notfound)
+AM_CONDITIONAL(MISSING_PDFLATEX, test x$PDFLATEX = xnotfound)
+
+AC_CHECK_PROGS(DVIPS, dvips, notfound)
+AM_CONDITIONAL(MISSING_DVIPS, test x$DVIPS = xnotfound)
+
+AC_CHECK_PROGS(TEXI2DVI, texi2dvi, notfound)
+AM_CONDITIONAL(MISSING_TEXI2DVI, test x$TEXI2DVI = xnotfound)
+
+AC_CHECK_PROGS(PS2PDF, ps2pdf, notfound)
+AM_CONDITIONAL(MISSING_PS2PDF, test x$PS2PDF = xnotfound)
+
+dnl Checks for libraries.
+AC_CHECK_LIB(m, sqrt)
+AC_CHECK_LIB(dl, dlopen)
+AC_CHECK_LIB(xnet, gethostbyname)
+AC_CHECK_LIB(fl, yywrap)
+AC_CHECK_FUNCS(strerror)
+AC_CHECK_FUNCS(regcomp re_comp)
+AC_CHECK_FUNCS(logf expf rint)
+AC_CHECK_FUNCS(vsnprintf)
+AC_CHECK_FUNCS(getpwuid gethostname getcwd)
+AC_CHECK_FUNCS(random)
+AC_CHECK_FUNCS(stat)
+
+# normally used for all file i/o
+AC_CHECK_FUNCS(popen)
+
+# for lrealpath.c
+AC_CHECK_FUNCS(realpath canonicalize_file_name)
+libiberty_NEED_DECLARATION(canonicalize_file_name)
+
+AC_HEADER_STDC
+AC_CHECK_HEADERS(limits.h locale.h string.h sys/types.h regex.h pwd.h)
+AC_CHECK_HEADERS(sys/socket.h netinet/in.h netdb.h sys/param.h sys/times.h)
+AC_CHECK_HEADERS(dlfcn.h)
+
+if test "x${WIN32}" = "xyes" ; then
+	AC_CHECK_HEADERS(windows.h)
+fi
+# Search for glib
+PKG_CHECK_MODULES(GLIB, glib-2.0, ,
+		[AC_MSG_RESULT([Note: cannot find glib-2.0.
+You may want to review the following errors:
+$GLIB_PKG_ERRORS])]
+)
+
+for e in $HIDLIST; do
+    case $e in
+      lesstif )
+	AC_PATH_XTRA
+	CPPFLAGS="$CFLAGS $X_CFLAGS"
+	AC_CHECK_LIB(X11, XOpenDisplay, , , $X_LIBS)
+	AC_CHECK_LIB(ICE, main, , , $X_LIBS)
+	AC_CHECK_LIB(SM, main, , , $X_LIBS)
+	AC_CHECK_LIB(Xext, main, , , $X_LIBS)
+	AC_CHECK_LIB(Xt, XtOpenDisplay, , , $X_LIBS)
+	AC_CHECK_LIB(Xmu, main, , , $X_LIBS)
+	AC_CHECK_LIB(Xpm, main, , , $X_LIBS)
+        AC_CHECK_LIB(Xm, XmCreateMainWindow, , , $X_LIBS)
+	case $ac_cv_lib_Xm_XmCreateMainWindow in
+	  no )
+	    AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
+	    ;;
+	  * ) ;;
+	esac
+	AC_CHECK_HEADERS(Xm/Xm.h)
+	case $ac_cv_header_Xm_Xm_h in
+	  no )
+	    AC_MSG_ERROR([You don't seem to have the Lesstif development environment installed.])
+	    ;;
+	  * ) ;;
+	esac
+        ;;
+
+      gtk )
+	# Check for pkg-config
+	AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+	if test "$PKG_CONFIG" = "no"; then
+		AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed and in your PATH])
+	fi
+
+	PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4.0, , 
+		[AC_MSG_ERROR([Cannot find gtk+ >= 2.4.0, install it and rerun ./configure
+Please review the following errors:
+$GTK_PKG_ERRORS])]
+	)
+	GTK_VERSION=`$PKG_CONFIG gtk+-2.0 --modversion`
+	
+	# if we are building for gtk >= 2.8.0, we can use gdk_display_warp_pointer()
+	# otherwise we need XWarpPointer and we'll pull in the required headers with
+	# gdk/gdkx.h and we'll need to link with X11
+	if ! $PKG_CONFIG gtk+-2.0 --atleast-version=2.8.0 ; then
+		CPPFLAGS="$CFLAGS $GTK_CFLAGS"
+		AC_CHECK_HEADERS([gdk/gdkx.h])
+	fi
+
+	GLIB_VERSION=`$PKG_CONFIG glib-2.0 --modversion`
+	;;
+
+      nelma|png )
+	# Check for gdlib-config for gd (www.boutell.com/gd)
+	AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, no)
+	if test "$GDLIB_CONFIG" = "no"; then
+		AC_MSG_RESULT([Cannot find gdlib-config.
+Make sure it is installed and in your PATH.
+gdlib-config is part of the GD library available from www.boutell.com/gd.
+This is needed for the png HID.  I will look for libgd anyway and maybe
+you will get lucky.
+])
+		if test "$WIN32" != "yes" ; then
+			AC_CHECK_LIB(gd,main,,
+			AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lgd could not be found]))
+		else 
+			AC_CHECK_LIB(bgd,main,,
+			AC_MSG_ERROR([You have requested the nelma and/or png HID  but -lbgd could not be found]))
+		fi
+	else
+		if test "$WIN32" = "yes" ; then
+			GD=bgd
+		else
+			GD=gd
+		fi
+		AC_MSG_CHECKING([for libgd cflags])
+		GD_CFLAGS="`$GDLIB_CONFIG --cflags`"
+		AC_MSG_RESULT([$GD_CFLAGS])
+		AC_MSG_CHECKING([for libgd libs])
+		GD_LIBS="`$GDLIB_CONFIG --ldflags` `$GDLIB_CONFIG --libs` -l${GD}"
+		AC_MSG_RESULT([$GD_LIBS])
+	fi
+   
+	# since some linux systems evidently install gdlib-config but fail to
+	# install the headers (nice), check for the header too and fail if it
+	# is not there.
+	CFLAGS="$CFLAGS $GD_CFLAGS"
+	CPPFLAGS="$CPPFLAGS $GD_CFLAGS"
+	AC_CHECK_HEADERS(gd.h)
+	case $ac_cv_header_gd_h in
+	     no )
+		AC_MSG_ERROR([
+You evidentally do not have a complete installation of the GD library available from www.boutell.com/gd.
+This is needed for the nelma and/or png HID.
+])
+		;;
+	     * ) ;;
+	esac
+	
+	# Some versions of gd (prior to the expiration of the
+	# patent related to gif compression) do not support
+	# gif output.  Check for that here.
+	save_LIBS="$LIBS"
+	LIBS="$save_LIBS $GD_LIBS $X_LIBS"
+
+	AC_MSG_CHECKING([if GIF output from the png HID is desired])
+	AC_ARG_ENABLE([gif],
+		[  --disable-gif           Disable support for gif output when the png HID is used [[default=include gif support]]],
+		[
+		if test "X$enable_gif" != "Xno" ; then
+			AC_MSG_RESULT([yes])
+			with_gif=yes
+		else
+			AC_MSG_RESULT([no])
+			with_gif=no
+		fi
+		],
+		[
+		AC_MSG_RESULT([yes])
+		with_gif=yes
+		])
+	if test "X$with_gif" = "Xyes" ; then
+		AC_CHECK_FUNCS(gdImageGif)
+		if test "$ac_cv_func_gdImageGif" != "yes"; then
+			AC_MSG_ERROR([Your gd installation does not appear to include gif support.
+You may need to update your installation of gd or disable
+gif export with --disable-gif])
+		fi
+	fi
+
+	AC_MSG_CHECKING([if JPEG output from the png HID is desired])
+	AC_ARG_ENABLE([jpeg],
+		[  --disable-jpeg          Disable support for JPEG output when the png HID is used [[default=include JPEG support]]],
+		[
+		if test "X$enable_jpeg" != "Xno" ; then
+			AC_MSG_RESULT([yes])
+			with_jpeg=yes
+		else
+			AC_MSG_RESULT([no])
+			with_jpeg=no
+		fi
+		],
+		[
+		AC_MSG_RESULT([yes])
+		with_jpeg=yes
+		])
+	if test "X$with_jpeg" = "Xyes" ; then
+		AC_CHECK_FUNCS(gdImageJpeg)
+		if test "$ac_cv_func_gdImageJpeg" != "yes"; then
+			AC_MSG_ERROR([Your gd installation does not appear to include JPEG support.
+You may need to update your installation of gd or disable
+JPEG export with --disable-jpeg])
+		fi
+	fi
+
+
+	AC_MSG_CHECKING([if PNG output from the png HID is desired])
+	AC_ARG_ENABLE([png],
+		[  --disable-png           Disable support for PNG output when the png HID is used [[default=include PNG support]]],
+		[
+		if test "X$enable_png" != "Xno" ; then
+			AC_MSG_RESULT([yes])
+			with_png=yes
+		else
+			AC_MSG_RESULT([no])
+			with_png=no
+		fi
+		],
+		[
+		AC_MSG_RESULT([yes])
+		with_png=yes
+		])
+	if test "X$with_png" = "Xyes" ; then
+		AC_CHECK_FUNCS(gdImagePng)
+		if test "$ac_cv_func_gdImagePng" != "yes"; then
+			AC_MSG_ERROR([Your gd installation does not appear to include PNG support.
+You may need to update your installation of gd or disable
+PNG export with --disable-png])
+		fi
+	fi
+	LIBS="$save_LIBS"
+	;;
+
+    esac
+done
+
+
+AM_CONDITIONAL(PNG, test x$with_png = xyes)
+AM_CONDITIONAL(GIF, test x$with_gif = xyes)
+
+# ------------- check if png previews should be built for pcblib-newlib
+AC_MSG_CHECKING([if the m4lib to newlib export should create png previews])
+AC_ARG_ENABLE(
+	[m4lib-png],
+	[  --enable-m4lib-png      Enable creating png previews for the m4 library],
+	[],[enable_m4lib_png=no])
+AC_MSG_RESULT([$enable_m4lib_png])
+AM_CONDITIONAL(PNG_PREVIEW, test x$enable_m4lib_png = xyes)
+
+if test "X$cross_compiling" = "Xyes" ; then
+	# we are cross compiling so we will need a build host binary for pcb
+	AC_PATH_PROG(PCB, [pcb], [notfound])
+else
+	PCB="\${top_builddir}/src/pcb"
+fi
+AC_SUBST(PCB)
+
+# now make see how essential it was that we have a pcb executable for the build
+# host
+if test "X$USE_MAINTAINER_MODE" = "Xyes" ; then
+	if test "X$docs_yesno" = "Xyes" -o "X$enable_m4lib_png" = "Xyes" ; then
+		if test "$PCB" = "notfound" ; then
+			AC_MSG_ERROR([You have selected a maintainer mode build with m4lib png
+previews enabled and/or with building the documentation enabled but you also
+appear to be cross-compiling.  For this to work, you must have a pcb installed that
+can run on this machine (the build machine) because it is needed for generating
+library footprint png previews as well as some of the figures in the documentation.
+If you wish to skip building the documentation and the footprint previews then add
+--disable-doc --disable-m4lib-png
+This will allow your cross build to work.])
+		fi
+	fi
+fi
+
+# ------------- Xrender -------------------
+have_xrender=no
+AC_CHECK_LIB(Xrender,XRenderQueryExtension,have_xrender=yes,have_xrender=no,$X_LIBS)
+
+AC_ARG_ENABLE([xrender],
+[  --disable-xrender       Compile and link with Xrender [default=yes]])
+case "$have_xrender:$enable_xrender" in
+   no:* ) ;;
+   *:no ) ;;
+   * )
+     X_LIBS="-lXrender $X_LIBS"
+     AC_DEFINE([HAVE_XRENDER], 1,
+		[Define to 1 if Xrender is available])
+     ;;
+esac
+
+# ------------- dmalloc -------------------
+dnl dmalloc checks
+with_dmalloc=no
+AC_MSG_CHECKING([if dmalloc debugging should be enabled])
+AC_ARG_ENABLE([dmalloc],
+[  --enable-dmalloc        Compile and link with dmalloc for malloc debugging [default=no]],
+[
+if test "X$enable_dmalloc" != "Xno" ; then
+	AC_MSG_RESULT([yes])
+	AC_CHECK_HEADER(dmalloc.h,,
+		AC_MSG_ERROR([You have requested dmalloc debugging but dmalloc.h could not be found]))
+	AC_CHECK_LIB(dmalloc,main,,
+		AC_MSG_ERROR([You have requested dmalloc debugging but -ldmalloc could not be found]))
+	DMALLOC_LIBS="-ldmalloc"
+	with_dmalloc=yes
+else
+	AC_MSG_RESULT([no])
+	DMALLOC_LIBS=""
+fi
+],
+[
+	AC_MSG_RESULT([no])
+	DMALLOC_LIBS=""
+])
+
+# ------------- ElectricFence -------------------
+dnl ElectricFence checks
+with_efence=no
+AC_MSG_CHECKING([if ElectricFence debugging should be enabled])
+AC_ARG_ENABLE([efence],
+[  --enable-efence         Link with ElectricFence for malloc debugging [default=no]],
+[
+if test "X$enable_efence" != "Xno" ; then
+	AC_MSG_RESULT([yes])
+	AC_CHECK_LIB(efence,main,,
+		AC_MSG_ERROR([You have requested ElectricFence debugging but -lefence could not be found]))
+	with_efence=yes
+else
+	AC_MSG_RESULT([no])
+fi
+],
+[
+AC_MSG_RESULT([no])
+])
+
+# ------------- Enable Debug code -------------------
+AC_MSG_CHECKING([for whether to enable debugging code])
+AC_ARG_ENABLE([debug],
+[  --enable-debug          Enable debugging code],
+[],[enable_debug=no])
+
+AC_MSG_RESULT([$enable_debug])
+AM_CONDITIONAL(DEBUG_BUILD, test x$enable_debug = xyes)
+
+
+# ------------- Complete set of CFLAGS and LIBS -------------------
+
+CFLAGS="$CFLAGS $X_CFLAGS $DBUS_CFLAGS $GLIB_CFLAGS $GTK_CFLAGS $CAIRO_CFLAGS"
+LIBS="$LIBS $XM_LIBS $DBUS_LIBS $X_LIBS $GLIB_LIBS $GTK_LIBS $DMALLOC_LIBS $GD_LIBS $INTLLIBS $CAIRO_LIBS"
+
+
+# if we have gcc then add -Wall
+if test "x$GCC" = "xyes"; then
+	# see about adding some extra checks if the compiler takes them
+	for flag in -Wall -Wdeclaration-after-statement ; do
+		case " ${CFLAGS} " in
+			*\ ${flag}\ *)
+				# flag is already present
+				;;
+			*)
+				AC_MSG_CHECKING([if the compiler accepts ${flag}])
+				ac_save_CFLAGS="$CFLAGS"
+				CFLAGS="$CFLAGS ${flag}"
+				AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+					[AC_MSG_RESULT([yes])],
+					[AC_MSG_RESULT([no])
+					 CFLAGS="$ac_save_CFLAGS"
+					]
+				)
+				;;
+		esac
+	done
+fi
+
+# font filename
+FONTFILENAME=${FONTFILENAME:-"default_font"}
+AC_SUBST(FONTFILENAME)
+AC_DEFINE_UNQUOTED(FONTFILENAME,"$FONTFILENAME",[File for default font])
+
+# standard autoconf variables
+CPPFLAGS="$CPPFLAGS -DPREFIXDIR=\\\"\${prefix}\\\""
+CPPFLAGS="$CPPFLAGS -DBINDIR=\\\"\${bindir}\\\""
+CPPFLAGS="$CPPFLAGS -DHOST=\\\"\${host}\\\""
+INCLUDES="-I. -I\$(srcdir) -I\$(top_builddir) -I\$(top_builddir)/src -I\$(top_builddir)/src/hid -I\$(top_builddir)/src/icons -I\$(top_builddir)/src/gts -I\$(top_srcdir) -I\$(top_srcdir)/src -I\$(top_srcdir)/src/hid -I\$(top_srcdir)/src/icons -I\$(top_srcdir)/src/gts"
+AC_SUBST(INCLUDES)
+
+# directory for old-style library and for fonts
+PCBLIBDIR=${datadir}/pcb
+AC_SUBST(PCBLIBDIR)
+#AC_DEFINE_UNQUOTED(PCBLIBDIR,"$PCBLIBDIR",[Library directory])
+CPPFLAGS="$CPPFLAGS -DPCBLIBDIR=\\\"$PCBLIBDIR\\\""
+
+# name for old-style library
+LIBRARYFILENAME=pcblib
+AC_SUBST(LIBRARYFILENAME)
+AC_DEFINE_UNQUOTED(LIBRARYFILENAME,"$LIBRARYFILENAME",[library file name])
+
+
+# directory for new library
+PCBTREEDIR=${datadir}/pcb/newlib
+PCBTREEPATH=${PCBTREEDIR}:${PCBLIBDIR}/pcblib-newlib
+PCBTREEDIR=${PCBTREEDIR:-"$PCBTREEDIR"}
+AC_SUBST(PCBTREEDIR)
+AC_SUBST(PCBTREEPATH)
+#AC_DEFINE_UNQUOTED(PCBTREEDIR,"$PCBLIB",[top directory for new style pcb library])
+CPPFLAGS="$CPPFLAGS -DPCBTREEDIR=\\\"$PCBTREEDIR\\\""
+CPPFLAGS="$CPPFLAGS -DPCBTREEPATH=\\\"$PCBTREEPATH\\\""
+
+# Figure out relative paths
+AC_MSG_CHECKING([for the bindir to pcblibdir relative path])
+adl_COMPUTE_RELATIVE_PATHS([bindir:PCBLIBDIR:bindir_to_pcblibdir])
+adl_NORMALIZE_PATH([bindir_to_pcblibdir], [$PCB_DIR_SEPARATOR_S])
+AC_MSG_RESULT([$bindir_to_pcblibdir])
+AC_DEFINE_UNQUOTED(BINDIR_TO_PCBLIBDIR, "$bindir_to_pcblibdir", [Relative path from bindir to pcblibdir])
+
+AC_MSG_CHECKING([for the bindir to pcbtreedir relative path])
+adl_COMPUTE_RELATIVE_PATHS([bindir:PCBTREEDIR:bindir_to_pcbtreedir])
+adl_NORMALIZE_PATH([bindir_to_pcbtreedir], [$PCB_DIR_SEPARATOR_S])
+AC_MSG_RESULT([$bindir_to_pcbtreedir])
+AC_DEFINE_UNQUOTED(BINDIR_TO_PCBTREEDIR, "$bindir_to_pcbtreedir", [Relative path from bindir to pcbtreedir])
+
+
+AC_MSG_CHECKING([for the bindir to exec_prefix relative path])
+adl_COMPUTE_RELATIVE_PATHS([bindir:exec_prefix:bindir_to_execprefix])
+adl_NORMALIZE_PATH([bindir_to_execprefix], [$PCB_DIR_SEPARATOR_S])
+AC_MSG_RESULT([$bindir_to_execprefix])
+AC_DEFINE_UNQUOTED(BINDIR_TO_EXECPREFIX, "$bindir_to_execprefix", [Relative path from bindir to exec_prefix])
+
+
+BTNMOD=${BTNMOD:-"Mod1"}
+AC_SUBST(BTNMOD)
+
+TOPDIRS=
+for dir in src lib newlib doc example tools tutorial README_FILES
+do
+   test -d $dir/. && TOPDIRS="$TOPDIRS $dir"
+done
+AC_SUBST(TOPDIRS)
+
+AC_CONFIG_FILES(Makefile data/Makefile intl/Makefile po/Makefile.in)
+
+if test -d $srcdir/README_FILES; then
+   AC_CONFIG_FILES(README_FILES/Makefile)
+fi
+if test -d $srcdir/doc; then
+   AC_CONFIG_FILES(doc/Makefile)
+   AC_CONFIG_FILES(doc/gs/Makefile)
+fi
+if test -d $srcdir/example; then
+   AC_CONFIG_FILES(example/Makefile)
+   AC_CONFIG_FILES(example/libraries/Makefile)
+fi
+if test -d $srcdir/lib; then
+   AC_CONFIG_FILES(lib/CreateLibraryContents.sh)
+   AC_CONFIG_FILES(lib/CreateLibrary.sh)
+   AC_CONFIG_FILES(lib/ListLibraryContents.sh)
+   AC_CONFIG_FILES(lib/Makefile)
+   AC_CONFIG_FILES(lib/QueryLibrary.sh)
+   AC_CONFIG_FILES(lib/qfp-ui)
+fi
+if test -d $srcdir/newlib; then
+   AC_CONFIG_FILES(newlib/2_pin_thru-hole_packages/Makefile)
+   AC_CONFIG_FILES(newlib/Makefile)
+   AC_CONFIG_FILES(newlib/connectors/Makefile)
+   AC_CONFIG_FILES(newlib/crystal/Makefile)
+   AC_CONFIG_FILES(newlib/electro-optics/Makefile)
+   AC_CONFIG_FILES(newlib/headers/Makefile)
+   AC_CONFIG_FILES(newlib/keystone/Makefile)
+   AC_CONFIG_FILES(newlib/msp430/Makefile)
+   AC_CONFIG_FILES(newlib/not_vetted_ingo/Makefile)
+   AC_CONFIG_FILES(newlib/sockets/Makefile)
+   AC_CONFIG_FILES(newlib/tests/Makefile)
+fi
+AC_CONFIG_FILES(src/Makefile)
+AC_CONFIG_FILES(src/hid/Makefile)
+AC_CONFIG_FILES(src/hid/common/Makefile)
+AC_CONFIG_FILES([@AC_CONFIG_FILES_HIDS@])
+AC_CONFIG_FILES(src/gts/Makefile)
+AC_CONFIG_FILES(src/icons/Makefile)
+
+if test -d $srcdir/tools; then
+   AC_CONFIG_FILES(tools/Makefile)
+fi
+if test -d $srcdir/tutorial; then
+   AC_CONFIG_FILES(tutorial/Makefile)
+fi
+
+AC_CONFIG_FILES(win32/Makefile)
+
+AC_OUTPUT
+
+with_gui=`echo $with_gui`
+with_printer=`echo $with_printer`
+with_exporters=`echo $with_exporters | sed 's/,/ /g'`
+
+expandedXDGDATADIR=`eval "echo $XDGDATADIR"`
+expandedKDEDATADIR=`eval "echo $KDEDATADIR"`
+
+AC_MSG_RESULT([
+** Configuration summary for $PACKAGE $VERSION:
+
+   GUI:                      $with_gui
+   Printer:                  $with_printer
+   Exporters:                $with_exporters
+   Build documentation:      $docs_yesno
+   Build toporouter:         $enable_toporouter
+   Enable toporouter output: $enable_toporouter_output
+   xdg data directory:       $expandedXDGDATADIR
+   KDE data directory:       $expandedKDEDATADIR
+   dmalloc debugging:        $with_dmalloc
+   ElectricFence debugging:  $with_efence
+
+   Cross Compiling:          $cross_compiling
+   CC:                       $CC
+   CPPFLAGS:                 $CPPFLAGS
+   CFLAGS:                   $CFLAGS
+   LIBS:                     $LIBS
+   PCB:                      $PCB
+
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index ebff648..3fbcecb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,24 +2,18 @@
 ## $Id$
 ##
 
-SUBDIRS=	icons
+SUBDIRS = hid gts icons
 
-pcbtreedir=	@PCBTREEDIR@
-pcblibdir=	@PCBLIBDIR@
+pcblibdir = @PCBLIBDIR@
 
 AUTOMAKE_OPTIONS = subdir-objects
-HIDLIST = @HIDLIST@
-noinst_LIBRARIES = @HIDLIBS@
-EXTRA_LIBRARIES = \
-	libgtk.a liblesstif.a libbatch.a \
-	liblpr.a libgerber.a libbom.a libpng.a libps.a libnelma.a libgts.a
-
-pcblib_DATA=	\
+pcblib_DATA = \
 	default_font \
 	gpcb-menu.res \
 	pcb-menu.res
 
-bin_PROGRAMS=	pcb
+bin_PROGRAMS = pcb
+lib_LTLIBRARIES = libpcb.la
 
 if DEBUG_BUILD
 # don't disable assert()
@@ -27,193 +21,155 @@ else
 AM_CFLAGS = -DNDEBUG
 endif
 
-PCB_SRCS = \
+libpcb_la_SOURCES = \
 	action.c \
-	action.h \
 	autoplace.c \
-	autoplace.h \
 	autoroute.c \
-	autoroute.h \
-	box.h \
 	buffer.c \
-	buffer.h \
 	change.c \
-	change.h \
 	clip.c \
-	clip.h \
 	command.c \
-	command.h \
 	compat.c \
-	compat.h \
-	const.h \
 	copy.c \
-	copy.h \
 	create.c \
-	create.h \
 	crosshair.c \
-	crosshair.h \
 	data.c \
-	data.h \
 	djopt.c \
-	djopt.h \
-	dolists.h \
 	draw.c \
-	draw.h \
 	drill.c \
-	drill.h \
 	edif.y \
-	edif_parse.h \
 	error.c \
-	error.h \
 	file.c \
-	file.h \
 	find.c \
-	find.h \
 	flags.c \
 	fontmode.c \
-	global.h \
 	heap.c \
-	heap.h \
-	hid.h \
 	insert.c \
-	insert.h \
 	intersect.c \
-	intersect.h \
 	line.c \
-	line.h \
 	lrealpath.c \
-	lrealpath.h \
-	macro.h \
-	main.c \
 	mirror.c \
-	mirror.h \
 	misc.c \
-	misc.h \
 	move.c \
-	move.h \
 	mtspace.c \
-	mtspace.h \
 	mymem.c \
-	mymem.h \
 	netlist.c \
-	parse_l.h \
 	parse_l.l \
-	parse_y.h \
 	parse_y.y \
 	polygon.c \
-	polygon.h \
 	polygon1.c \
-	polyarea.h \
 	puller.c \
 	print.c \
-	print.h \
 	rats.c \
-	rats.h \
 	remove.c \
-	remove.h \
 	report.c \
-	report.h \
 	res_parse.y \
 	res_lex.l \
-	resource.h \
 	rotate.c \
-	rotate.h \
 	rtree.c \
-	rtree.h \
 	rubberband.c \
-	rubberband.h \
 	search.c \
-	search.h \
 	select.c \
-	select.h \
 	set.c \
-	set.h \
 	strflags.c \
-	strflags.h \
 	thermal.c \
-	thermal.h \
 	undo.c \
-	undo.h \
 	vector.c \
-	vector.h \
-	vendor.c \
-	vendor.h \
-	hid/common/actions.c \
-	hid/common/flags.c \
-	hid/common/hidinit.c \
-	hid/common/hidnogui.c \
-	hid/common/extents.c \
-	hid/common/draw_helpers.c \
-	hid/common/draw_helpers.h \
-	hid/hidint.h 
-
-EXTRA_pcb_SOURCES = ${DBUS_SRCS} toporouter.c toporouter.h
-DBUS_SRCS= \
-	dbus-pcbmain.c \
-	dbus-pcbmain.h \
-	dbus.h \
-	dbus.c
+	vendor.c
 
 BUILT_SOURCES = \
 	core_lists.h \
 	gpcb-menu.h \
-	hid/gtk/gtk_lists.h \
-	hid/lesstif/lesstif_lists.h \
-	hid/batch/batch_lists.h \
-	hid/png/png_lists.h \
-	hid/nelma/nelma_lists.h \
-	hid/ps/ps_lists.h \
 	parse_y.h \
 	pcb-menu.h \
-	res_parse.h \
-	hid/common/hidlist.h
-
-pcb_LDADD = @HIDLIBS@
-pcb_DEPENDENCIES = @HIDLIBS@
-
-if WITH_TOPOROUTER
-PCB_SRCS += toporouter.c toporouter.h
-noinst_PROGRAMS = predicates_init
-noinst_LIBRARIES += libgts.a
-pcb_LDADD += libgts.a
-pcb_DEPENDENCIES += libgts.a
-BUILT_SOURCES += gts/predicates_init.h
-endif
+	res_parse.h
 
-pcb_SOURCES = ${PCB_SRCS} core_lists.h
+libpcb_la_LIBADD = hid/common/_hid_common.la
+libpcb_la_DEPENDENCIES = hid/common/_hid_common.la
 
 # Action, Attribute, and Flag lists.
-core_lists.h : ${PCB_SRCS} Makefile
+core_lists.h : ${libpcb_la_SOURCES} Makefile
 	true > $@
-	(for f in ${PCB_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
+	(for f in ${libpcb_la_SOURCES} ${pcb_SOURCES} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
 	mv $@.tmp $@
 
-# for globalconst.h
-INCLUDES=	-I$(top_srcdir) -I$(srcdir)/icons -I$(srcdir)/gts
+pcb_SOURCES = main.c
+pcb_LDADD = libpcb.la @HIDLIBS@
+pcb_DEPENDENCIES = libpcb.la @HIDLIBS@
 
-DEFS= 	-DLOCALEDIR=\"$(localedir)\" @DEFS@
+INCLUDES = @INCLUDES@
 
-EXTRA_DIST= \
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = \
 	check_icon.data \
 	default_font \
-	$(srcdir)/hid/batch/hid.conf \
-	$(srcdir)/hid/bom/hid.conf \
-	$(srcdir)/hid/gerber/hid.conf \
-	$(srcdir)/hid/gtk/gui-icons-misc.data \
-	$(srcdir)/hid/gtk/gui-icons-mode-buttons.data \
-	$(srcdir)/hid/gtk/hid.conf \
-	$(srcdir)/hid/gtk/pcb.rc \
-	$(srcdir)/hid/lesstif/hid.conf \
-	$(srcdir)/hid/lpr/hid.conf \
-	$(srcdir)/hid/png/hid.conf \
-	$(srcdir)/hid/nelma/hid.conf \
-	$(srcdir)/hid/ps/hid.conf \
 	gpcb-menu.res \
 	pcb-menu.res \
 	pcbtest.sh.in \
 	dbus.xml
 
-AM_YFLAGS=	-d
+libpcbincludedir = $(includedir)/pcb
+libpcbinclude_HEADERS = \
+	action.h \
+	autoplace.h \
+	autoroute.h \
+	box.h \
+	buffer.h \
+	change.h \
+	clip.h \
+	command.h \
+	compat.h \
+	const.h \
+	copy.h \
+	create.h \
+	crosshair.h \
+	data.h \
+	djopt.h \
+	dolists.h \
+	draw.h \
+	drill.h \
+	edif.h \
+	edif_parse.h \
+	file.h \
+	find.h \
+	global.h \
+	gpcb-menu.h \
+	heap.h \
+	hid.h \
+	insert.h \
+	intersect.h \
+	line.h \
+	lrealpath.h \
+	macro.h \
+	mirror.h \
+	misc.h \
+	move.h \
+	mtspace.h \
+	mymem.h \
+	pcb-menu.h \
+	polyarea.h \
+	polygon.h \
+	print.h \
+	rats.h \
+	remove.h \
+	report.h \
+	resource.h \
+	res_parse.h \
+	rotate.h \
+	rtree.h \
+	rubberband.h \
+	search.h \
+	select.h \
+	set.h \
+	strflags.h \
+	thermal.h \
+	undo.h \
+	vector.h \
+	vendor.h
+
+
+AM_YFLAGS = -d
 
 all-local: pcbtest.sh
 
@@ -229,48 +185,14 @@ gpcb-menu.h : gpcb-menu.res
 	sed 's/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$$/",/' < ${srcdir}/gpcb-menu.res >> $@
 	echo '0};' >> $@
 
-hid/common/hidlist.h : Makefile
-	true > $@
-	for e in ${HIDLIST}; do \
-	  echo "HID_DEF($${e})" >> $@; \
-	done
-
-libgtk_a_CPPFLAGS = -I./hid/gtk
-LIBGTK_SRCS = \
-	dolists.h \
-	hid/hidint.h \
-	hid/gtk/gtkhid-main.c \
-	hid/gtk/gtkhid.h \
-	hid/gtk/gui.h \
-	hid/gtk/gui-command-window.c \
-	hid/gtk/gui-config.c \
-	hid/gtk/gui-dialog-print.c \
-	hid/gtk/gui-dialog-size.c \
-	hid/gtk/gui-dialog.c \
-	hid/gtk/gui-drc-window.c \
-	hid/gtk/gui-drc-window.h \
-	hid/gtk/gui-keyref-window.c \
-	hid/gtk/gui-library-window.c \
-	hid/gtk/gui-library-window.h \
-	hid/gtk/gui-log-window.c \
-	hid/gtk/gui-misc.c \
-	hid/gtk/gui-netlist-window.c \
-	hid/gtk/gui-output-events.c \
-	hid/gtk/gui-pinout-preview.c \
-	hid/gtk/gui-pinout-preview.h \
-	hid/gtk/gui-pinout-window.c \
-	hid/gtk/gui-render-pixmap.c \
-	hid/gtk/gui-top-window.c \
-	hid/gtk/gui-utils.c
-libgtk_a_SOURCES = ${LIBGTK_SRCS} hid/gtk/gtk_lists.h
-
-hid/gtk/gtk_lists.h : ${LIBGTK_SRCS} Makefile
-	true > $@
-	(for f in ${LIBGTK_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
-	mv $@.tmp $@
-
 # If we are building with dbus support, we need some extra files
 if WITH_DBUS
+DBUS_SRCS= \
+	dbus-pcbmain.c \
+	dbus-pcbmain.h \
+	dbus.h \
+	dbus.c
+
 dbus-introspect.h : dbus.xml Makefile
 	echo '/* AUTOMATICALLY GENERATED FROM dbus.xml DO NOT EDIT */' > $@.tmp
 	echo "static char *pcb_dbus_introspect_xml ="  > $@.tmp
@@ -278,10 +200,14 @@ dbus-introspect.h : dbus.xml Makefile
 	echo ";" >> $@.tmp
 	mv $@.tmp $@
 
-PCB_SRCS+=	${DBUS_SRCS}
-BUILT_SOURCES+=	dbus-introspect.h
+libpcb_la_SOURCES += ${DBUS_SRCS}
+BUILT_SOURCES += dbus-introspect.h
+libpcbinclude_HEADERS += \
+	dbus-pcbmain.h \
+	dbus.h \
+	dbus-introspect.h
 
-endif
+endif # WITH_DBUS
 
 # If we are building on win32, then compile in some icons for the
 # desktop and application toolbar
@@ -292,156 +218,18 @@ pcb_icon.o : pcb_icon.ico $(srcdir)/hid/gtk/pcb.rc
 pcb_icon.ico: $(top_srcdir)/data/pcb_icon.ico
 	cp $(top_srcdir)/data/pcb_icon.ico $@
 
-pcb_LDADD+=			pcb_icon.o
-pcb_DEPENDENCIES+=	pcb_icon.o
+libpcb_la_LIBADD += pcb_icon.o
 
-endif
+endif # WIN32
 
-
-liblesstif_a_CPPFLAGS = -I./hid/lesstif
-LIBLESSTIF_SRCS = \
-	dolists.h \
-	hid/hidint.h \
-	hid/lesstif/dialogs.c \
-	hid/lesstif/lesstif.h \
-	hid/lesstif/library.c \
-	hid/lesstif/main.c \
-	hid/lesstif/menu.c \
-	hid/lesstif/netlist.c \
-	hid/lesstif/styles.c \
-	hid/lesstif/xincludes.h 
-liblesstif_a_SOURCES = ${LIBLESSTIF_SRCS} hid/lesstif/lesstif_lists.h
-
-hid/lesstif/lesstif_lists.h : ${LIBLESSTIF_SRCS} Makefile
-	true > $@
-	(for f in ${LIBLESSTIF_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
-	mv $@.tmp $@
-
-predicates_init_SOURCES = gts/predicates_init.c gts/rounding.h
-
-gts/predicates_init.h: predicates_init
-	./predicates_init >  gts/predicates_init.h
-
-libgts_a_CPPFLAGS = -I./gts
-LIBGTS_SRCS = \
-	gts/object.c \
-	gts/point.c \
-	gts/vertex.c \
-	gts/segment.c \
-	gts/edge.c \
-	gts/triangle.c \
-	gts/face.c \
-	gts/kdtree.c \
-	gts/bbtree.c \
-	gts/misc.c \
-	gts/gts-private.h \
-	gts/predicates.c \
-	gts/predicates.h \
-	gts/rounding.h \
-	gts/heap.c \
-	gts/eheap.c \
-	gts/fifo.c \
-	gts/gts.h \
-	gts/matrix.c \
-	gts/surface.c \
-	gts/stripe.c \
-	gts/vopt.c \
-	gts/refine.c \
-	gts/iso.c \
-	gts/isotetra.c \
-	gts/split.c \
-	gts/psurface.c \
-	gts/hsurface.c \
-	gts/cdt.c \
-	gts/boolean.c \
-	gts/named.c \
-	gts/oocs.c \
-	gts/container.c \
-	gts/graph.c \
-	gts/pgraph.c \
-	gts/partition.c \
-	gts/curvature.c \
-	gts/tribox3.c
-libgts_a_SOURCES = ${LIBGTS_SRCS} gts/gts_lists.h
-libgts_a_DEPENDENCIES = gts/predicates_init.h
-
-gts/gts_lists.h : ${LIBGTS_SRCS} Makefile
-	true > $@
-	(for f in ${LIBGTS_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
-	mv $@.tmp $@
-
-libbatch_a_CPPFLAGS = -I./hid/batch
-LIBBATCH_SRCS = \
-	hid/hidint.h \
-	hid/batch/batch.c 
-libbatch_a_SOURCES = ${LIBBATCH_SRCS} hid/batch/batch_lists.h
-
-hid/batch/batch_lists.h : ${LIBBATCH_SRCS} Makefile
-	true > $@
-	(for f in ${LIBBATCH_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
-	mv $@.tmp $@
-
-libgerber_a_SOURCES = \
-	hid/hidint.h \
-	hid/gerber/gerber.c
-
-libbom_a_SOURCES = \
-	hid/hidint.h \
-	hid/bom/bom.c
-
-libps_a_CPPFLAGS = -I./hid/ps
-LIBPS_SRCS = \
-	dolists.h \
-	hid/hidint.h \
-	hid/ps/ps.c \
-	hid/ps/ps.h \
-	hid/ps/eps.c 
-libps_a_SOURCES = ${LIBPS_SRCS} hid/ps/ps_lists.h
-
-hid/ps/ps_lists.h : ${LIBPS_SRCS} Makefile
-	true > $@
-	(for f in ${LIBPS_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
-	mv $@.tmp $@
-
-libpng_a_CPPFLAGS = -I./hid/png
-LIBPNG_SRCS = \
-	dolists.h \
-	hid/hidint.h \
-	hid/png/png.c \
-	hid/png/png.h 
-libpng_a_SOURCES = ${LIBPNG_SRCS} hid/png/png_lists.h
-
-hid/png/png_lists.h : ${LIBPNG_SRCS} Makefile
-	true > $@
-	(for f in ${LIBPNG_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
-	mv $@.tmp $@
-
-libnelma_a_CPPFLAGS = -I./hid/nelma
-LIBNELMA_SRCS = \
-	dolists.h \
-	hid/hidint.h \
-	hid/nelma/nelma.c \
-	hid/nelma/nelma.h 
-libnelma_a_SOURCES = ${LIBNELMA_SRCS} hid/nelma/nelma_lists.h
-
-hid/nelma/nelma_lists.h : ${LIBNELMA_SRCS} Makefile
-	true > $@
-	(for f in ${LIBNELMA_SRCS} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
-	mv $@.tmp $@
-
-liblpr_a_SOURCES = \
-	hid/hidint.h \
-	hid/lpr/lpr.c
+if WITH_TOPOROUTER
+libpcb_la_SOURCES += toporouter.c
+libpcbinclude_HEADERS += toporouter.h
+libpcb_la_DEPENDENCIES += gts/libgts.la
+libpcb_la_LIBADD += gts/libgts.la
+endif # WITH_TOPOROUTER
 
 DISTCLEANFILES= pcbtest.sh gpcb-menu.h pcb-menu.h \
-	hid/batch/batch_lists.h \
-	hid/common/hidlist.h \
-	hid/gtk/gtk_lists.h \
-	hid/lesstif/lesstif_lists.h \
-	hid/png/png_lists.h \
-	hid/nelma/nelma_lists.h \
-	hid/ps/ps_lists.h \
-	gts/gts_lists.h \
 	core_lists.h \
 	dbus-introspect.h
 
diff --git a/src/gts/Makefile.am b/src/gts/Makefile.am
new file mode 100644
index 0000000..7bfe1d7
--- /dev/null
+++ b/src/gts/Makefile.am
@@ -0,0 +1,73 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+AM_YFLAGS = -d
+
+BUILT_SOURCES = predicates_init.h
+predicates_init_SOURCES = predicates_init.c
+
+predicates_init.h: predicates_init
+	./predicates_init > predicates_init.h
+
+if WITH_TOPOROUTER
+noinst_PROGRAMS = predicates_init
+noinst_LTLIBRARIES = libgts.la
+
+libgts_la_CFLAGS = $(INCLUDES)
+libgts_la_SOURCES = \
+	object.c \
+	point.c \
+	vertex.c \
+	segment.c \
+	edge.c \
+	triangle.c \
+	face.c \
+	kdtree.c \
+	bbtree.c \
+	misc.c \
+	predicates.c \
+	rounding.h \
+	heap.c \
+	eheap.c \
+	fifo.c \
+	matrix.c \
+	surface.c \
+	stripe.c \
+	vopt.c \
+	refine.c \
+	iso.c \
+	isotetra.c \
+	split.c \
+	psurface.c \
+	hsurface.c \
+	cdt.c \
+	boolean.c \
+	named.c \
+	oocs.c \
+	container.c \
+	graph.c \
+	pgraph.c \
+	partition.c \
+	curvature.c \
+	tribox3.c
+	
+libgts_la_DEPENDENCIES = predicates_init.h
+
+endif # WITH_TOPOROUTER
+
+DISTCLEANFILES = \
+		predicates_init \
+		predicates_init.h
diff --git a/src/hid/Makefile.am b/src/hid/Makefile.am
new file mode 100644
index 0000000..131578f
--- /dev/null
+++ b/src/hid/Makefile.am
@@ -0,0 +1,5 @@
+## -*- makefile -*-
+## $Id$
+##
+
+SUBDIRS = common @HIDLIST@
diff --git a/src/hid/batch/Makefile.am b/src/hid/batch/Makefile.am
new file mode 100644
index 0000000..43e398a
--- /dev/null
+++ b/src/hid/batch/Makefile.am
@@ -0,0 +1,32 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_batch.la
+_hid_batch_la_CFLAGS = $(INCLUDES)
+_hid_batch_la_LDFLAGS = -module
+_hid_batch_la_SOURCES = batch.c
+BUILT_SOURCES = batch_lists.h
+
+batch_lists.h : ${_hid_batch_la_SOURCES} Makefile
+	true > $@
+	(for f in ${_hid_batch_la_SOURCES} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
+	mv $@.tmp $@
+
+DISTCLEANFILES = batch_lists.h
diff --git a/src/hid/bom/Makefile.am b/src/hid/bom/Makefile.am
new file mode 100644
index 0000000..0e7e782
--- /dev/null
+++ b/src/hid/bom/Makefile.am
@@ -0,0 +1,24 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_bom.la
+_hid_bom_la_CFLAGS = $(INCLUDES)
+_hid_bom_la_LDFLAGS = -module
+_hid_bom_la_SOURCES = bom.c
diff --git a/src/hid/common/Makefile.am b/src/hid/common/Makefile.am
new file mode 100644
index 0000000..53dab90
--- /dev/null
+++ b/src/hid/common/Makefile.am
@@ -0,0 +1,39 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+HIDLIST = @HIDLIST@
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_common.la
+_hid_common_la_CFLAGS = $(INCLUDES)
+_hid_common_la_LDFLAGS = -module
+_hid_common_la_SOURCES = \
+	actions.c \
+	draw_helpers.c \
+	extents.c \
+	flags.c \
+	hidinit.c \
+	hidnogui.c
+
+BUILT_SOURCES = hidlist.h
+
+hidlist.h : Makefile
+	true > $@
+	for e in ${HIDLIST}; do \
+	  echo "HID_DEF($${e})" >> ${srcdir}/$@; \
+	done
+
+DISTCLEANFILES = hidlist.h
diff --git a/src/hid/gerber/Makefile.am b/src/hid/gerber/Makefile.am
new file mode 100644
index 0000000..ab5b3d1
--- /dev/null
+++ b/src/hid/gerber/Makefile.am
@@ -0,0 +1,24 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_gerber.la
+_hid_gerber_la_CFLAGS = $(INCLUDES)
+_hid_gerber_la_LDFLAGS = -module
+_hid_gerber_la_SOURCES = gerber.c
diff --git a/src/hid/gtk/Makefile.am b/src/hid/gtk/Makefile.am
new file mode 100644
index 0000000..fb0db25
--- /dev/null
+++ b/src/hid/gtk/Makefile.am
@@ -0,0 +1,55 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = \
+	hid.conf \
+	gui-icons-misc.data \
+	gui-icons-mode-buttons.data \
+	pcb.rc
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_gtk.la
+_hid_gtk_la_CFLAGS = $(INCLUDES)
+_hid_gtk_la_LDFLAGS = -module
+_hid_gtk_la_SOURCES = \
+	gtkhid-main.c \
+	gui-command-window.c \
+        gui-config.c \
+        gui-dialog-print.c \
+        gui-dialog-size.c \
+        gui-dialog.c \
+        gui-drc-window.c \
+        gui-keyref-window.c \
+        gui-library-window.c \
+        gui-log-window.c \
+        gui-misc.c \
+        gui-netlist-window.c \
+        gui-output-events.c \
+        gui-pinout-preview.c \
+        gui-pinout-window.c \
+        gui-render-pixmap.c \
+        gui-top-window.c \
+        gui-utils.c
+ 
+BUILT_SOURCES = gtk_lists.h
+
+gtk_lists.h : ${_hid_gtk_la_SOURCES} Makefile
+	true > $@
+	(for f in ${_hid_gtk_la_SOURCES} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
+	mv $@.tmp $@
+
+DISTCLEANFILES = gtk_lists.h
diff --git a/src/hid/lesstif/Makefile.am b/src/hid/lesstif/Makefile.am
new file mode 100644
index 0000000..06c1719
--- /dev/null
+++ b/src/hid/lesstif/Makefile.am
@@ -0,0 +1,40 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_lesstif.la
+_hid_lesstif_la_CFLAGS = $(INCLUDES)
+_hid_lesstif_la_LDFLAGS = -module
+_hid_lesstif_la_SOURCES = \
+	dialogs.c \
+        library.c \
+        main.c \
+        menu.c \
+        netlist.c \
+        styles.c
+
+ 
+BUILT_SOURCES = lesstif_lists.h
+
+lesstif_lists.h : ${_hid_lesstif_la_SOURCES} Makefile
+	true > $@
+	(for f in ${_hid_lesstif_la_SOURCES} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
+	mv $@.tmp $@
+
+DISTCLEANFILES = lesstif_lists.h
diff --git a/src/hid/lpr/Makefile.am b/src/hid/lpr/Makefile.am
new file mode 100644
index 0000000..508808b
--- /dev/null
+++ b/src/hid/lpr/Makefile.am
@@ -0,0 +1,24 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_lpr.la
+_hid_lpr_la_CFLAGS = $(INCLUDES)
+_hid_lpr_la_LDFLAGS = -module
+_hid_lpr_la_SOURCES = lpr.c
diff --git a/src/hid/nelma/Makefile.am b/src/hid/nelma/Makefile.am
new file mode 100644
index 0000000..e4c0c8f
--- /dev/null
+++ b/src/hid/nelma/Makefile.am
@@ -0,0 +1,34 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_nelma.la
+_hid_nelma_la_CFLAGS = $(INCLUDES)
+_hid_nelma_la_LDFLAGS = -module
+_hid_nelma_la_SOURCES = nelma.c
+
+ 
+BUILT_SOURCES = nelma_lists.h
+
+nelma_lists.h : ${_hid_nelma_la_SOURCES} Makefile
+	true > $@
+	(for f in ${_hid_nelma_la_SOURCES} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
+	mv $@.tmp $@
+
+DISTCLEANFILES = nelma_lists.h
diff --git a/src/hid/png/Makefile.am b/src/hid/png/Makefile.am
new file mode 100644
index 0000000..d0dd7e4
--- /dev/null
+++ b/src/hid/png/Makefile.am
@@ -0,0 +1,35 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+# for globalconst.h
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_png.la
+_hid_png_la_CFLAGS = $(INCLUDES)
+_hid_png_la_LDFLAGS = -module
+_hid_png_la_SOURCES = png.c
+
+ 
+BUILT_SOURCES = png_lists.h
+
+png_lists.h : ${_hid_png_la_SOURCES} Makefile
+	true > $@
+	(for f in ${_hid_png_la_SOURCES} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
+	mv $@.tmp $@
+
+DISTCLEANFILES = png_lists.h
diff --git a/src/hid/ps/Makefile.am b/src/hid/ps/Makefile.am
new file mode 100644
index 0000000..70bd001
--- /dev/null
+++ b/src/hid/ps/Makefile.am
@@ -0,0 +1,35 @@
+## -*- makefile -*-
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = subdir-objects
+
+if DEBUG_BUILD
+# don't disable assert()
+else
+AM_CFLAGS = -DNDEBUG
+endif
+
+INCLUDES = @INCLUDES@
+
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+
+EXTRA_DIST = hid.conf
+
+AM_YFLAGS = -d
+
+noinst_LTLIBRARIES = _hid_ps.la
+_hid_ps_la_CFLAGS = $(INCLUDES)
+_hid_ps_la_LDFLAGS = -module
+_hid_ps_la_SOURCES = \
+	ps.c \
+	eps.c
+ 
+BUILT_SOURCES = ps_lists.h
+
+ps_lists.h : ${_hid_ps_la_SOURCES} Makefile
+	true > $@
+	(for f in ${_hid_ps_la_SOURCES} ; do cat $(srcdir)/$$f ; done) | grep "^REGISTER" > $@.tmp
+	mv $@.tmp $@
+
+DISTCLEANFILES = ps_lists.h

_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user