[glom] Switch to non-recursive build process



commit 1c5e87d31b8def4658c2fa2f0cb489bb078e77c9
Author: Daniel Elstner <danielk openismus com>
Date:   Thu Jul 23 17:17:48 2009 +0200

    Switch to non-recursive build process
    
    * macros/mm-pkg.m4: New file, defining the MM_PKG_CONFIG_SUBST macro.
    * macros/mm-python.m4: New file, defining the MM_CHECK_MODULE_PYTHON
    macro to replace the old and messy AM_CHECK_PYTHON_HEADERS.
    * acinclude.m4: Remove file which defined AM_CHECK_PYTHON_HEADERS.
    
    * Makefile.am: Merge the contents of the Makefile.am files from all
    subdirectories into a single top-level Makefile.am, with the exception
    of docs/user-guide/Makefile.am.  Add the full subdirectory prefix to
    all listed files and change the Automake variable names accordingly.
    Get rid of the intermediate static libraries previously created for
    each source subdirectory, and list the source files directly in the
    toplevel target's SOURCES variable.  Overall, refactor and modernize
    the build rules and organization.
    * **/Makefile.am: Except for docs/user-guide/Makefile.am, remove the
    Makefile.am files recursively from all subdirectories.
    
    * config.h.in: Remove file, and use autoheader to generate it.
    * autogen.sh: Replace with a modern minimalistic script which lets
    autoreconf do the bulk of the work.
    * configure.ac: Massive refactoring.  Adapt to the new non-recursive
    build organization.  Modernize the M4 and shell code, and make use of
    newer Autoconf and Automake constructs to simplify many checks.  Also
    make minor corrections to a number of tests and definitions.
    
    * glom/application.cc: Remove the need for GLOM_ICON_DIR by setting
    the window icon by name instead of loading the image file directly.
    Use PACKAGE_VERSION in place of VERSION.
    * glom/dialog_existing_or_new.cc: Use a subdirectory of GLOM_DOCDIR
    in place of GLOM_EXAMPLES_DIR.  Remove GLOM_EXAMPLES_DIR_ALTERNATIVE.
    
    * glom/utils_ui.cc: Replace DATADIR by GLOM_DATADIR.
    * glom/libglom/connectionpool.cc: Remove GLOM_SAVE_DATADIR hack, which
    is not necessary anymore as DATADIR is not globally defined anymore.
    * glom/libglom/connectionpool_backends/postgres_self.cc: ditto,
    * glom/libglom/spawn_with_feedback.cc: ditto,
    * glom/main.cc: ditto. Also replace LOCALEDIR by GLOM_LOCALEDIR, and
    output PACKAGE_STRING instead of VERSION in response to the --version
    command-line option.  Replace PACKAGE and VERSION by their modern
    Automake equivalents.
    * glom/xsl_utils.cc: Remove GLOM_SAVE_DATADIR hack, and replace
    GLOM_XSLTDIR with a subdirectory of GLOM_PKGDATADIR.
    
    * glom/mode_data/box_data_calendar_related.cc: Replace GLOM_GLADEDIR
    by a combination of GLOM_PKGDATADIR and a subdirectory name.
    * glom/mode_design/print_layouts/print_layout_toolbar_button.cc: Use
    a subdirectory of GLOM_PKGDATADIR in place of GLOM_ICON_DIR.
    * glom/utility_widgets/layouttoolbar.cc: ditto,
    * glom/utility_widgets/layouttoolbarbutton.cc: ditto.
    
    * glom/python_embed/glom_python.cc: Include generated config.h for the
    definition of GLOM_ABI_VERSION_UNDERLINED.
    * glom/python_embed/python_module/py_glom_module.cc: ditto.

 ChangeLog                                          |   57 ++
 Makefile.am                                        |  779 +++++++++++++++++++-
 acinclude.m4                                       |  119 ---
 autogen.sh                                         |   82 +--
 config.h.in                                        |  134 +---
 configure.ac                                       |  482 +++++--------
 docs/Makefile.am                                   |    4 -
 docs/user-guide/Makefile.am                        |    2 +
 examples/Makefile.am                               |    7 -
 glom/Makefile.am                                   |  146 ----
 glom/application.cc                                |   27 +-
 glom/bakery/Makefile.am                            |   10 -
 glom/dialog_existing_or_new.cc                     |   20 +-
 glom/glade_utils.h                                 |    2 +-
 glom/layout_item_dialogs/Makefile.am               |   23 -
 glom/libglom/Makefile.am                           |   95 ---
 glom/libglom/connectionpool.cc                     |   11 +-
 glom/libglom/connectionpool_backends/Makefile.am   |   26 -
 .../connectionpool_backends/postgres_self.cc       |   21 +-
 glom/libglom/data_structure/Makefile.am            |   46 --
 glom/libglom/data_structure/layout/Makefile.am     |   42 --
 .../data_structure/layout/report_parts/Makefile.am |   22 -
 glom/libglom/document/Makefile.am                  |   12 -
 glom/libglom/document/bakery/Makefile.am           |   18 -
 glom/libglom/document/bakery/view/Makefile.am      |   19 -
 glom/libglom/python_embed/Makefile.am              |   12 -
 glom/libglom/spawn_with_feedback.cc                |    5 +-
 glom/main.cc                                       |   20 +-
 glom/mode_data/Makefile.am                         |   30 -
 glom/mode_data/box_data_calendar_related.cc        |    4 +-
 glom/mode_design/Makefile.am                       |   20 -
 glom/mode_design/fields/Makefile.am                |   18 -
 glom/mode_design/print_layouts/Makefile.am         |   20 -
 .../print_layouts/print_layout_toolbar_button.cc   |    5 +-
 glom/mode_design/script_library/Makefile.am        |   12 -
 glom/mode_design/users/Makefile.am                 |   15 -
 glom/mode_find/Makefile.am                         |    6 -
 glom/navigation/Makefile.am                        |    4 -
 glom/python_embed/Makefile.am                      |   12 -
 glom/python_embed/glom_python.cc                   |    1 +
 glom/python_embed/python_module/Makefile.am        |   30 -
 glom/python_embed/python_module/py_glom_module.cc  |    1 +
 glom/relationships_overview/Makefile.am            |   10 -
 glom/reports/Makefile.am                           |   15 -
 glom/translation/Makefile.am                       |   18 -
 glom/utility_widgets/Makefile.am                   |   71 --
 glom/utility_widgets/adddel/Makefile.am            |    9 -
 glom/utility_widgets/canvas/Makefile.am            |   32 -
 glom/utility_widgets/cellrendererlist/Makefile.am  |    6 -
 glom/utility_widgets/db_adddel/Makefile.am         |   12 -
 glom/utility_widgets/egg/Makefile.am               |    1 -
 glom/utility_widgets/egg/toolpalette/Makefile.am   |   18 -
 glom/utility_widgets/egg/util/Makefile.am          |   31 -
 glom/utility_widgets/layouttoolbar.cc              |    7 +-
 glom/utility_widgets/layouttoolbarbutton.cc        |    7 +-
 glom/utils_ui.cc                                   |    4 +-
 glom/xsl_utils.cc                                  |   21 +-
 icons/16x16/Makefile.am                            |   15 -
 icons/22x22/Makefile.am                            |    4 -
 icons/24x24/Makefile.am                            |    4 -
 icons/32x32/Makefile.am                            |    4 -
 icons/48x48/Makefile.am                            |    4 -
 icons/Makefile.am                                  |    1 -
 icons/scalable/Makefile.am                         |    4 -
 icons/win32/Makefile.am                            |    1 -
 macros/Makefile.am                                 |    3 -
 macros/mm-pkg.m4                                   |   40 +
 macros/mm-python.m4                                |   90 +++
 regression_tests/Makefile.am                       |   20 -
 win32/Makefile.am                                  |    2 -
 xslt/Makefile.am                                   |    5 -
 71 files changed, 1211 insertions(+), 1669 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2d95160..e077093 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,60 @@
+2009-07-23  Daniel Elstner  <danielk openismus com>
+
+	Switch to non-recursive build process
+
+	* macros/mm-pkg.m4: New file, defining the MM_PKG_CONFIG_SUBST macro.
+	* macros/mm-python.m4: New file, defining the MM_CHECK_MODULE_PYTHON
+	macro to replace the old and messy AM_CHECK_PYTHON_HEADERS.
+	* acinclude.m4: Remove file which defined AM_CHECK_PYTHON_HEADERS.
+
+	* Makefile.am: Merge the contents of the Makefile.am files from all
+	subdirectories into a single top-level Makefile.am, with the exception
+	of docs/user-guide/Makefile.am.  Add the full subdirectory prefix to
+	all listed files and change the Automake variable names accordingly.
+	Get rid of the intermediate static libraries previously created for
+	each source subdirectory, and list the source files directly in the
+	toplevel target's SOURCES variable.  Overall, refactor and modernize
+	the build rules and organization.
+	* **/Makefile.am: Except for docs/user-guide/Makefile.am, remove the
+	Makefile.am files recursively from all subdirectories.
+
+	* config.h.in: Remove file, and use autoheader to generate it.
+	* autogen.sh: Replace with a modern minimalistic script which lets
+	autoreconf do the bulk of the work.
+	* configure.ac: Massive refactoring.  Adapt to the new non-recursive
+	build organization.  Modernize the M4 and shell code, and make use of
+	newer Autoconf and Automake constructs to simplify many checks.  Also
+	make minor corrections to a number of tests and definitions.
+
+	* glom/application.cc: Remove the need for GLOM_ICON_DIR by setting
+	the window icon by name instead of loading the image file directly.
+	Use PACKAGE_VERSION in place of VERSION.
+	* glom/dialog_existing_or_new.cc: Use a subdirectory of GLOM_DOCDIR
+	in place of GLOM_EXAMPLES_DIR.  Remove GLOM_EXAMPLES_DIR_ALTERNATIVE.
+
+	* glom/utils_ui.cc: Replace DATADIR by GLOM_DATADIR.
+	* glom/libglom/connectionpool.cc: Remove GLOM_SAVE_DATADIR hack, which
+	is not necessary anymore as DATADIR is not globally defined anymore.
+	* glom/libglom/connectionpool_backends/postgres_self.cc: ditto,
+	* glom/libglom/spawn_with_feedback.cc: ditto,
+	* glom/main.cc: ditto. Also replace LOCALEDIR by GLOM_LOCALEDIR, and
+	output PACKAGE_STRING instead of VERSION in response to the --version
+	command-line option.  Replace PACKAGE and VERSION by their modern
+	Automake equivalents.
+	* glom/xsl_utils.cc: Remove GLOM_SAVE_DATADIR hack, and replace
+	GLOM_XSLTDIR with a subdirectory of GLOM_PKGDATADIR.
+
+	* glom/mode_data/box_data_calendar_related.cc: Replace GLOM_GLADEDIR
+	by a combination of GLOM_PKGDATADIR and a subdirectory name.
+	* glom/mode_design/print_layouts/print_layout_toolbar_button.cc: Use
+	a subdirectory of GLOM_PKGDATADIR in place of GLOM_ICON_DIR.
+	* glom/utility_widgets/layouttoolbar.cc: ditto,
+	* glom/utility_widgets/layouttoolbarbutton.cc: ditto.
+
+	* glom/python_embed/glom_python.cc: Include generated config.h for the
+	definition of GLOM_ABI_VERSION_UNDERLINED.
+	* glom/python_embed/python_module/py_glom_module.cc: ditto.
+
 2009-07-22  David King  <davidk openismus com>
 
 	* glom/libglom/glom-1.0.pc.in: Add libxml++ dependency, needed for
diff --git a/Makefile.am b/Makefile.am
index edfc3cb..070bfa4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,57 +1,762 @@
-## top-level Makefile.am
+## Copyright (c) 2009  Daniel Elstner <daniel kitta gmail com>
+##
+## This file is part of Glom.
+##
+## Glom 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, either version 2 of the License,
+## or (at your option) any later version.
+##
+## Glom 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, see <http://www.gnu.org/licenses/>.
 
-#Build in these directories:
-SUBDIRS = po glom macros examples xslt icons win32 regression_tests
+## This project does not use recursive make, but a single toplevel Makefile
+## to build the entire tree (excluding po and docs/user-guide as gettext and
+## gnome-doc-utils come with their own build systems).  Read Peter Miller's
+## excellent paper to learn why recursive make invocations are both slow and
+## error-prone:
+## http://members.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html
+
+AUTOMAKE_OPTIONS = subdir-objects
+ACLOCAL_AMFLAGS  = -I macros ${ACLOCAL_FLAGS}
+DISTCHECK_CONFIGURE_FLAGS = --enable-warnings=fatal \
+--disable-scrollkeeper --disable-update-mime-database
 
 if HAVE_GNOME_DOC_UTILS
-SUBDIRS += docs
+doc_subdirs = docs/user-guide
+else
+doc_subdirs =
+endif
+SUBDIRS = po $(doc_subdirs)
+
+if HOST_WIN32
+win_resfile = glom/glom.res
+else
+win_resfile =
+endif
+SUFFIXES = .rc .res
+
+bin_PROGRAMS = glom/glom
+lib_LTLIBRARIES = glom/libglom/libglom-1.12.la
+pyexec_LTLIBRARIES = glom/python_embed/python_module/glom_1_12.la
+
+noinst_PROGRAMS =						\
+	glom/libglom/test_connectionpool			\
+	glom/libglom/test_document				\
+	glom/libglom/test_sharedptr_layoutitem			\
+	glom/utility_widgets/test_flowtable			\
+	glom/utility_widgets/egg/toolpalette/testtoolpalette	\
+	glom/test_pyembed					\
+	regression_tests/test_parsing_time			\
+	regression_tests/test_signal_reemit
+
+noinst_LIBRARIES =							\
+	glom/utility_widgets/egg/toolpalette/libeggtoolpalette.a	\
+	glom/utility_widgets/egg/util/libeggutil.a
+
+libglom_includedir = $(includedir)/glom-$(GLOM_ABI_VERSION)/libglom
+libglom_include_HEADERS =			\
+	glom/libglom/appstate.h			\
+	glom/libglom/init.h			\
+	glom/libglom/libglom_config.h		\
+	glom/libglom/sharedptr.h		\
+	glom/libglom/standard_table_prefs_fields.h
+
+libglom_data_structure_includedir = $(libglom_includedir)/data_structure
+libglom_data_structure_include_HEADERS =			\
+	glom/libglom/data_structure/field.h			\
+	glom/libglom/data_structure/fieldtypes.h		\
+	glom/libglom/data_structure/foundset.h			\
+	glom/libglom/data_structure/glomconversions.h		\
+	glom/libglom/data_structure/groupinfo.h			\
+	glom/libglom/data_structure/iso_codes.h			\
+	glom/libglom/data_structure/numeric_format.h		\
+	glom/libglom/data_structure/parameternamegenerator.h	\
+	glom/libglom/data_structure/print_layout.h		\
+	glom/libglom/data_structure/privileges.h		\
+	glom/libglom/data_structure/relationship.h		\
+	glom/libglom/data_structure/report.h			\
+	glom/libglom/data_structure/system_prefs.h		\
+	glom/libglom/data_structure/tableinfo.h			\
+	glom/libglom/data_structure/translatable_item.h
+
+libglom_ds_layout_includedir = $(libglom_data_structure_includedir)/layout
+libglom_ds_layout_include_HEADERS =					\
+	glom/libglom/data_structure/layout/custom_title.h		\
+	glom/libglom/data_structure/layout/fieldformatting.h		\
+	glom/libglom/data_structure/layout/layoutgroup.h		\
+	glom/libglom/data_structure/layout/layoutitem.h			\
+	glom/libglom/data_structure/layout/layoutitem_button.h		\
+	glom/libglom/data_structure/layout/layoutitem_calendarportal.h	\
+	glom/libglom/data_structure/layout/layoutitem_field.h		\
+	glom/libglom/data_structure/layout/layoutitem_image.h		\
+	glom/libglom/data_structure/layout/layoutitem_line.h		\
+	glom/libglom/data_structure/layout/layoutitem_notebook.h	\
+	glom/libglom/data_structure/layout/layoutitem_placeholder.h	\
+	glom/libglom/data_structure/layout/layoutitem_portal.h		\
+	glom/libglom/data_structure/layout/layoutitem_text.h		\
+	glom/libglom/data_structure/layout/usesrelationship.h
+
+libglom_ds_l_report_parts_includedir = $(libglom_ds_layout_includedir)/report_parts
+libglom_ds_l_report_parts_include_HEADERS =						\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.h	\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_footer.h		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.h		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_header.h		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_summary.h		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_verticalgroup.h
+
+libglom_document_includedir = $(libglom_includedir)/document
+libglom_document_include_HEADERS =		\
+	glom/libglom/document/document.h	\
+	glom/libglom/document/view.h
+
+libglom_d_bakery_includedir = $(libglom_document_includedir)/bakery
+libglom_d_bakery_include_HEADERS =			\
+	glom/libglom/document/bakery/document.h		\
+	glom/libglom/document/bakery/document_xml.h
+
+libglom_d_b_view_includedir = $(libglom_d_bakery_includedir)/view
+libglom_d_b_view_include_HEADERS =				\
+	glom/libglom/document/bakery/view/view.h		\
+	glom/libglom/document/bakery/view/view_composite.h	\
+	glom/libglom/document/bakery/view/viewbase.h
+
+glom_libglom_libglom_1_12_la_SOURCES =					\
+	glom/libglom/appstate.cc					\
+	glom/libglom/calcinprogress.cc					\
+	glom/libglom/calcinprogress.h					\
+	glom/libglom/connectionpool.cc					\
+	glom/libglom/connectionpool.h					\
+	glom/libglom/gst-package.c					\
+	glom/libglom/gst-package.h					\
+	glom/libglom/init.cc						\
+	glom/libglom/spawn_with_feedback.cc				\
+	glom/libglom/spawn_with_feedback.h				\
+	glom/libglom/utils.cc						\
+	glom/libglom/utils.h						\
+	glom/libglom/connectionpool_backends/backend.cc			\
+	glom/libglom/connectionpool_backends/backend.h			\
+	glom/libglom/data_structure/field.cc				\
+	glom/libglom/data_structure/fieldtypes.cc			\
+	glom/libglom/data_structure/foundset.cc				\
+	glom/libglom/data_structure/glomconversions.cc			\
+	glom/libglom/data_structure/groupinfo.cc			\
+	glom/libglom/data_structure/iso_codes.cc			\
+	glom/libglom/data_structure/numeric_format.cc			\
+	glom/libglom/data_structure/parameternamegenerator.cc		\
+	glom/libglom/data_structure/print_layout.cc			\
+	glom/libglom/data_structure/privileges.cc			\
+	glom/libglom/data_structure/relationship.cc			\
+	glom/libglom/data_structure/report.cc				\
+	glom/libglom/data_structure/system_prefs.cc			\
+	glom/libglom/data_structure/tableinfo.cc			\
+	glom/libglom/data_structure/translatable_item.cc		\
+	glom/libglom/data_structure/layout/custom_title.cc		\
+	glom/libglom/data_structure/layout/fieldformatting.cc		\
+	glom/libglom/data_structure/layout/layoutgroup.cc		\
+	glom/libglom/data_structure/layout/layoutitem.cc		\
+	glom/libglom/data_structure/layout/layoutitem_button.cc		\
+	glom/libglom/data_structure/layout/layoutitem_calendarportal.cc	\
+	glom/libglom/data_structure/layout/layoutitem_field.cc		\
+	glom/libglom/data_structure/layout/layoutitem_image.cc		\
+	glom/libglom/data_structure/layout/layoutitem_line.cc		\
+	glom/libglom/data_structure/layout/layoutitem_notebook.cc	\
+	glom/libglom/data_structure/layout/layoutitem_placeholder.cc	\
+	glom/libglom/data_structure/layout/layoutitem_portal.cc		\
+	glom/libglom/data_structure/layout/layoutitem_text.cc		\
+	glom/libglom/data_structure/layout/usesrelationship.cc		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_fieldsummary.cc	\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_footer.cc		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_groupby.cc		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_header.cc		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_summary.cc		\
+	glom/libglom/data_structure/layout/report_parts/layoutitem_verticalgroup.cc	\
+	glom/libglom/document/document.cc				\
+	glom/libglom/document/bakery/document.cc			\
+	glom/libglom/document/bakery/document_xml.cc			\
+	glom/libglom/document/bakery/view/view.cc			\
+	glom/libglom/document/bakery/view/view_composite.cc		\
+	glom/libglom/document/bakery/view/viewbase.cc			\
+	glom/libglom/python_embed/py_glom_record.cc			\
+	glom/libglom/python_embed/py_glom_record.h			\
+	glom/libglom/python_embed/py_glom_related.cc			\
+	glom/libglom/python_embed/py_glom_related.h			\
+	glom/libglom/python_embed/py_glom_relatedrecord.cc		\
+	glom/libglom/python_embed/py_glom_relatedrecord.h		\
+	glom/libglom/python_embed/pygdavalue_conversions.c		\
+	glom/libglom/python_embed/pygdavalue_conversions.h
+
+if GLOM_ENABLE_POSTGRESQL
+glom_libglom_libglom_1_12_la_SOURCES +=				\
+	glom/libglom/connectionpool_backends/postgres.cc	\
+	glom/libglom/connectionpool_backends/postgres.h		\
+	glom/libglom/connectionpool_backends/postgres_central.cc\
+	glom/libglom/connectionpool_backends/postgres_central.h
+if !GLOM_ENABLE_CLIENT_ONLY
+glom_libglom_libglom_1_12_la_SOURCES +=				\
+	glom/libglom/connectionpool_backends/postgres_self.cc	\
+	glom/libglom/connectionpool_backends/postgres_self.h
+endif
+endif
+if GLOM_ENABLE_SQLITE
+glom_libglom_libglom_1_12_la_SOURCES +=				\
+	glom/libglom/connectionpool_backends/sqlite.cc		\
+	glom/libglom/connectionpool_backends/sqlite.h
+endif
+
+glom_libglom_libglom_1_12_la_LIBADD = $(LIBGLOM_LIBS) $(PYTHON_LIBS)
+
+if GLOM_ENABLE_MAEMO
+glom_libglom_libglom_1_12_la_LDFLAGS = -no-undefined -static
+else
+glom_libglom_libglom_1_12_la_LDFLAGS = -no-undefined
+endif
+
+glom_python_embed_python_module_glom_1_12_la_SOURCES =		\
+	glom/python_embed/python_module/py_glom_module.cc	\
+	glom/python_embed/python_module/py_glom_module.h
+
+glom_python_embed_python_module_glom_1_12_la_LIBADD =	\
+	glom/libglom/libglom-$(GLOM_ABI_VERSION).la	\
+	$(LIBGLOM_LIBS) $(PYTHON_LIBS)
+
+# TODO: Verify that -shrext really does the trick on Windows, or if the
+# install-exec-hook rule needs to be resurrected to rename the .dll file.
+pymod_ldflags = -module -avoid-version -no-undefined -shrext .pyd
+glom_pyexport = -export-symbols-regex '^_*initglom'
+glom_python_embed_python_module_glom_1_12_la_LDFLAGS = $(pymod_ldflags) $(glom_pyexport)
+
+eggutildir = glom/utility_widgets/egg/util
+eggmarshalers_list = $(top_srcdir)/$(eggutildir)/eggmarshalers.list
+
+libegg_includes = -I$(top_builddir)/$(eggutildir) -I$(top_srcdir)/$(eggutildir)
+libegg_cppflags = $(libegg_includes) $(EGG_CFLAGS) -DEGG_COMPILATION
+
+glom_utility_widgets_egg_toolpalette_libeggtoolpalette_a_SOURCES =	\
+	glom/utility_widgets/egg/toolpalette/eggenumaction.c		\
+	glom/utility_widgets/egg/toolpalette/eggenumaction.h		\
+	glom/utility_widgets/egg/toolpalette/eggtoolitemgroup.c		\
+	glom/utility_widgets/egg/toolpalette/eggtoolitemgroup.h		\
+	glom/utility_widgets/egg/toolpalette/eggtoolpalette.c		\
+	glom/utility_widgets/egg/toolpalette/eggtoolpalette.h		\
+	glom/utility_widgets/egg/toolpalette/eggtoolpaletteprivate.h
+
+glom_utility_widgets_egg_toolpalette_libeggtoolpalette_a_CPPFLAGS = $(libegg_cppflags)
+
+glom_utility_widgets_egg_util_libeggutil_a_SOURCES =	\
+	glom/utility_widgets/egg/util/egg-marshal.c	\
+	glom/utility_widgets/egg/util/eggintl.h		\
+	glom/utility_widgets/egg/util/egg-macros.h
+
+EXTRA_glom_utility_widgets_egg_util_libeggutil_a_SOURCES =	\
+	glom/utility_widgets/egg/util/eggmarshalers.c		\
+	glom/utility_widgets/egg/util/eggmarshalers.h
+
+glom_utility_widgets_egg_util_libeggutil_a_CPPFLAGS = $(libegg_cppflags)
+
+glom_glom_SOURCES =							\
+	glom/application.cc						\
+	glom/application.h						\
+	glom/base_db.cc							\
+	glom/base_db.h							\
+	glom/base_db_table.cc						\
+	glom/base_db_table.h						\
+	glom/base_db_table_data.cc					\
+	glom/base_db_table_data.h					\
+	glom/box_db_table.cc						\
+	glom/box_db_table.h						\
+	glom/box_reports.cc						\
+	glom/box_reports.h						\
+	glom/box_withbuttons.cc						\
+	glom/box_withbuttons.h						\
+	glom/combobox_fields.cc						\
+	glom/combobox_fields.h						\
+	glom/combobox_relationship.cc					\
+	glom/combobox_relationship.h					\
+	glom/dialog_connection.cc					\
+	glom/dialog_connection.h					\
+	glom/dialog_existing_or_new.cc					\
+	glom/dialog_existing_or_new.h					\
+	glom/dialog_glom.cc						\
+	glom/dialog_glom.h						\
+	glom/dialog_import_csv.cc					\
+	glom/dialog_import_csv.h					\
+	glom/dialog_import_csv_progress.cc				\
+	glom/dialog_import_csv_progress.h				\
+	glom/dialog_invalid_data.cc					\
+	glom/dialog_invalid_data.h					\
+	glom/dialog_progress_creating.cc				\
+	glom/dialog_progress_creating.h					\
+	glom/filechooser_export.cc					\
+	glom/filechooser_export.h					\
+	glom/frame_glom.cc						\
+	glom/frame_glom.h						\
+	glom/glade_utils.cc						\
+	glom/glade_utils.h						\
+	glom/glom_postgres.cc						\
+	glom/glom_postgres.h						\
+	glom/glom_privs.cc						\
+	glom/glom_privs.h						\
+	glom/main.cc							\
+	glom/notebook_glom.cc						\
+	glom/notebook_glom.h						\
+	glom/signal_reemitter.h						\
+	glom/utils_ui.cc						\
+	glom/utils_ui.h							\
+	glom/variablesmap.cc						\
+	glom/variablesmap.h						\
+	glom/xsl_utils.cc						\
+	glom/xsl_utils.h						\
+	glom/bakery/app.cc						\
+	glom/bakery/app.h						\
+	glom/bakery/app_withdoc.cc					\
+	glom/bakery/app_withdoc.h					\
+	glom/bakery/app_withdoc_gtk.cc					\
+	glom/bakery/app_withdoc_gtk.h					\
+	glom/bakery/busy_cursor.cc					\
+	glom/bakery/busy_cursor.h					\
+	glom/bakery/dialog_offersave.cc					\
+	glom/bakery/dialog_offersave.h					\
+	glom/mode_data/box_data.cc					\
+	glom/mode_data/box_data.h					\
+	glom/mode_data/box_data_calendar_related.cc			\
+	glom/mode_data/box_data_calendar_related.h			\
+	glom/mode_data/box_data_details.cc				\
+	glom/mode_data/box_data_details.h				\
+	glom/mode_data/box_data_list.cc					\
+	glom/mode_data/box_data_list.h					\
+	glom/mode_data/box_data_list_related.cc				\
+	glom/mode_data/box_data_list_related.h				\
+	glom/mode_data/box_data_manyrecords.cc				\
+	glom/mode_data/box_data_manyrecords.h				\
+	glom/mode_data/box_data_portal.cc				\
+	glom/mode_data/box_data_portal.h				\
+	glom/mode_data/dialog_choose_field.cc				\
+	glom/mode_data/dialog_choose_field.h				\
+	glom/mode_data/dialog_choose_relationship.cc			\
+	glom/mode_data/dialog_choose_relationship.h			\
+	glom/mode_data/dialog_layout.cc					\
+	glom/mode_data/dialog_layout.h					\
+	glom/mode_data/dialog_layout_export.cc				\
+	glom/mode_data/dialog_layout_export.h				\
+	glom/mode_data/flowtablewithfields.cc				\
+	glom/mode_data/flowtablewithfields.h				\
+	glom/mode_data/notebook_data.cc					\
+	glom/mode_data/notebook_data.h					\
+	glom/mode_find/box_data_details_find.cc				\
+	glom/mode_find/box_data_details_find.h				\
+	glom/mode_find/box_data_list_find.cc				\
+	glom/mode_find/box_data_list_find.h				\
+	glom/mode_find/notebook_find.cc					\
+	glom/mode_find/notebook_find.h					\
+	glom/navigation/box_tables.cc					\
+	glom/navigation/box_tables.h					\
+	glom/python_embed/glom_python.cc				\
+	glom/python_embed/glom_python.h					\
+	glom/reports/report_builder.cc					\
+	glom/reports/report_builder.h					\
+	glom/utility_widgets/alignment_justified.cc			\
+	glom/utility_widgets/alignment_justified.h			\
+	glom/utility_widgets/buttonglom.cc				\
+	glom/utility_widgets/buttonglom.h				\
+	glom/utility_widgets/checkglom.cc				\
+	glom/utility_widgets/checkglom.h				\
+	glom/utility_widgets/combo_textglade.cc				\
+	glom/utility_widgets/combo_textglade.h				\
+	glom/utility_widgets/comboentry_currency.cc			\
+	glom/utility_widgets/comboentry_currency.h			\
+	glom/utility_widgets/comboentryglom.cc				\
+	glom/utility_widgets/comboentryglom.h				\
+	glom/utility_widgets/comboglom.cc				\
+	glom/utility_widgets/comboglom.h				\
+	glom/utility_widgets/comboglomchoicesbase.cc			\
+	glom/utility_widgets/comboglomchoicesbase.h			\
+	glom/utility_widgets/datawidget.cc				\
+	glom/utility_widgets/datawidget.h				\
+	glom/utility_widgets/dialog_choose_date.cc			\
+	glom/utility_widgets/dialog_choose_date.h			\
+	glom/utility_widgets/dialog_choose_id.cc			\
+	glom/utility_widgets/dialog_choose_id.h				\
+	glom/utility_widgets/dialog_flowtable.cc			\
+	glom/utility_widgets/dialog_flowtable.h				\
+	glom/utility_widgets/dialog_image_progress.cc			\
+	glom/utility_widgets/dialog_image_progress.h			\
+	glom/utility_widgets/dialog_layoutitem_properties.cc		\
+	glom/utility_widgets/dialog_layoutitem_properties.h		\
+	glom/utility_widgets/dialog_properties.cc			\
+	glom/utility_widgets/dialog_properties.h			\
+	glom/utility_widgets/entryglom.cc				\
+	glom/utility_widgets/entryglom.h				\
+	glom/utility_widgets/flowtable.cc				\
+	glom/utility_widgets/flowtable.h				\
+	glom/utility_widgets/imageglom.cc				\
+	glom/utility_widgets/imageglom.h				\
+	glom/utility_widgets/labelglom.cc				\
+	glom/utility_widgets/labelglom.h				\
+	glom/utility_widgets/layoutwidgetbase.cc			\
+	glom/utility_widgets/layoutwidgetbase.h				\
+	glom/utility_widgets/layoutwidgetfield.cc			\
+	glom/utility_widgets/layoutwidgetfield.h			\
+	glom/utility_widgets/layoutwidgetmenu.cc			\
+	glom/utility_widgets/layoutwidgetmenu.h				\
+	glom/utility_widgets/layoutwidgetutils.cc			\
+	glom/utility_widgets/layoutwidgetutils.h			\
+	glom/utility_widgets/notebookglom.cc				\
+	glom/utility_widgets/notebookglom.h				\
+	glom/utility_widgets/placeholder-glom.cc			\
+	glom/utility_widgets/placeholder-glom.h				\
+	glom/utility_widgets/placeholder.cc				\
+	glom/utility_widgets/placeholder.h				\
+	glom/utility_widgets/table_columns.cc				\
+	glom/utility_widgets/table_columns.h				\
+	glom/utility_widgets/textviewglom.cc				\
+	glom/utility_widgets/textviewglom.h				\
+	glom/utility_widgets/adddel/adddel.cc				\
+	glom/utility_widgets/adddel/adddel.h				\
+	glom/utility_widgets/adddel/adddel_withbuttons.cc		\
+	glom/utility_widgets/adddel/adddel_withbuttons.h		\
+	glom/utility_widgets/adddel/treeviewcolumn_glom.cc		\
+	glom/utility_widgets/adddel/treeviewcolumn_glom.h		\
+	glom/utility_widgets/canvas/canvas_editable.cc			\
+	glom/utility_widgets/canvas/canvas_editable.h			\
+	glom/utility_widgets/canvas/canvas_group_grid.cc		\
+	glom/utility_widgets/canvas/canvas_group_grid.h			\
+	glom/utility_widgets/canvas/canvas_group_movable.cc		\
+	glom/utility_widgets/canvas/canvas_group_movable.h		\
+	glom/utility_widgets/canvas/canvas_group_resizable.cc		\
+	glom/utility_widgets/canvas/canvas_group_resizable.h		\
+	glom/utility_widgets/canvas/canvas_image_movable.cc		\
+	glom/utility_widgets/canvas/canvas_image_movable.h		\
+	glom/utility_widgets/canvas/canvas_item_movable.cc		\
+	glom/utility_widgets/canvas/canvas_item_movable.h		\
+	glom/utility_widgets/canvas/canvas_line_movable.cc		\
+	glom/utility_widgets/canvas/canvas_line_movable.h		\
+	glom/utility_widgets/canvas/canvas_rect_movable.cc		\
+	glom/utility_widgets/canvas/canvas_rect_movable.h		\
+	glom/utility_widgets/canvas/canvas_table_movable.cc		\
+	glom/utility_widgets/canvas/canvas_table_movable.h		\
+	glom/utility_widgets/canvas/canvas_text_movable.cc		\
+	glom/utility_widgets/canvas/canvas_text_movable.h		\
+	glom/utility_widgets/cellrendererlist/cellrendererlist.cc	\
+	glom/utility_widgets/cellrendererlist/cellrendererlist.h	\
+	glom/utility_widgets/db_adddel/cellrenderer_buttonimage.cc	\
+	glom/utility_widgets/db_adddel/cellrenderer_buttonimage.h	\
+	glom/utility_widgets/db_adddel/cellrenderer_buttontext.cc	\
+	glom/utility_widgets/db_adddel/cellrenderer_buttontext.h	\
+	glom/utility_widgets/db_adddel/db_adddel.cc			\
+	glom/utility_widgets/db_adddel/db_adddel.h			\
+	glom/utility_widgets/db_adddel/db_adddel_withbuttons.cc		\
+	glom/utility_widgets/db_adddel/db_adddel_withbuttons.h		\
+	glom/utility_widgets/db_adddel/db_treeviewcolumn_glom.cc	\
+	glom/utility_widgets/db_adddel/db_treeviewcolumn_glom.h		\
+	glom/utility_widgets/db_adddel/glom_db_treemodel.cc		\
+	glom/utility_widgets/db_adddel/glom_db_treemodel.h
+
+if !GLOM_ENABLE_CLIENT_ONLY
+glom_glom_SOURCES +=							\
+	glom/dialog_database_preferences.cc				\
+	glom/dialog_database_preferences.h				\
+	glom/dialog_new_self_hosted_connection.cc			\
+	glom/dialog_new_self_hosted_connection.h			\
+	glom/printoperation_printlayout.cc				\
+	glom/printoperation_printlayout.h				\
+	glom/layout_item_dialogs/box_formatting.cc			\
+	glom/layout_item_dialogs/box_formatting.h			\
+	glom/layout_item_dialogs/combo_summarytype.cc			\
+	glom/layout_item_dialogs/combo_summarytype.h			\
+	glom/layout_item_dialogs/comboentry_borderwidth.cc		\
+	glom/layout_item_dialogs/comboentry_borderwidth.h		\
+	glom/layout_item_dialogs/dialog_buttonscript.cc			\
+	glom/layout_item_dialogs/dialog_buttonscript.h			\
+	glom/layout_item_dialogs/dialog_field_layout.cc			\
+	glom/layout_item_dialogs/dialog_field_layout.h			\
+	glom/layout_item_dialogs/dialog_field_summary.cc		\
+	glom/layout_item_dialogs/dialog_field_summary.h			\
+	glom/layout_item_dialogs/dialog_group_by.cc			\
+	glom/layout_item_dialogs/dialog_group_by.h			\
+	glom/layout_item_dialogs/dialog_groupby_secondaryfields.cc	\
+	glom/layout_item_dialogs/dialog_groupby_secondaryfields.h	\
+	glom/layout_item_dialogs/dialog_groupby_sortfields.cc		\
+	glom/layout_item_dialogs/dialog_groupby_sortfields.h		\
+	glom/layout_item_dialogs/dialog_imageobject.cc			\
+	glom/layout_item_dialogs/dialog_imageobject.h			\
+	glom/layout_item_dialogs/dialog_notebook.cc			\
+	glom/layout_item_dialogs/dialog_notebook.h			\
+	glom/layout_item_dialogs/dialog_textobject.cc			\
+	glom/layout_item_dialogs/dialog_textobject.h			\
+	glom/mode_data/dialog_layout_calendar_related.cc		\
+	glom/mode_data/dialog_layout_calendar_related.h			\
+	glom/mode_data/dialog_layout_details.cc				\
+	glom/mode_data/dialog_layout_details.h				\
+	glom/mode_data/dialog_layout_list.cc				\
+	glom/mode_data/dialog_layout_list.h				\
+	glom/mode_data/dialog_layout_list_related.cc			\
+	glom/mode_data/dialog_layout_list_related.h			\
+	glom/mode_data/treestore_layout.cc				\
+	glom/mode_data/treestore_layout.h				\
+	glom/mode_design/box_db_table_relationships.cc			\
+	glom/mode_design/box_db_table_relationships.h			\
+	glom/mode_design/dialog_add_related_table.cc			\
+	glom/mode_design/dialog_add_related_table.h			\
+	glom/mode_design/dialog_design.cc				\
+	glom/mode_design/dialog_design.h				\
+	glom/mode_design/dialog_fields.cc				\
+	glom/mode_design/dialog_fields.h				\
+	glom/mode_design/dialog_relationships.cc			\
+	glom/mode_design/dialog_relationships.h				\
+	glom/mode_design/fields/box_db_table_definition.cc		\
+	glom/mode_design/fields/box_db_table_definition.h		\
+	glom/mode_design/fields/combo_fieldtype.cc			\
+	glom/mode_design/fields/combo_fieldtype.h			\
+	glom/mode_design/fields/dialog_fieldcalculation.cc		\
+	glom/mode_design/fields/dialog_fieldcalculation.h		\
+	glom/mode_design/fields/dialog_fielddefinition.cc		\
+	glom/mode_design/fields/dialog_fielddefinition.h		\
+	glom/mode_design/print_layouts/box_print_layouts.cc		\
+	glom/mode_design/print_layouts/box_print_layouts.h		\
+	glom/mode_design/print_layouts/canvas_layout_item.cc		\
+	glom/mode_design/print_layouts/canvas_layout_item.h		\
+	glom/mode_design/print_layouts/canvas_print_layout.cc		\
+	glom/mode_design/print_layouts/canvas_print_layout.h		\
+	glom/mode_design/print_layouts/dialog_text_formatting.cc	\
+	glom/mode_design/print_layouts/dialog_text_formatting.h		\
+	glom/mode_design/print_layouts/print_layout_toolbar.cc		\
+	glom/mode_design/print_layouts/print_layout_toolbar.h		\
+	glom/mode_design/print_layouts/print_layout_toolbar_button.cc	\
+	glom/mode_design/print_layouts/print_layout_toolbar_button.h	\
+	glom/mode_design/print_layouts/window_print_layout_edit.cc	\
+	glom/mode_design/print_layouts/window_print_layout_edit.h	\
+	glom/mode_design/script_library/dialog_new_script.cc		\
+	glom/mode_design/script_library/dialog_new_script.h		\
+	glom/mode_design/script_library/dialog_script_library.cc	\
+	glom/mode_design/script_library/dialog_script_library.h		\
+	glom/mode_design/users/dialog_choose_user.cc			\
+	glom/mode_design/users/dialog_choose_user.h			\
+	glom/mode_design/users/dialog_groups_list.cc			\
+	glom/mode_design/users/dialog_groups_list.h			\
+	glom/mode_design/users/dialog_new_group.cc			\
+	glom/mode_design/users/dialog_new_group.h			\
+	glom/mode_design/users/dialog_user.cc				\
+	glom/mode_design/users/dialog_user.h				\
+	glom/mode_design/users/dialog_users_list.cc			\
+	glom/mode_design/users/dialog_users_list.h			\
+	glom/relationships_overview/canvas_group_dbtable.cc		\
+	glom/relationships_overview/canvas_group_dbtable.h		\
+	glom/relationships_overview/dialog_relationships_overview.cc	\
+	glom/relationships_overview/dialog_relationships_overview.h	\
+	glom/relationships_overview/printoperation_relationshipsoverview.cc	\
+	glom/relationships_overview/printoperation_relationshipsoverview.h	\
+	glom/reports/dialog_layout_report.cc				\
+	glom/reports/dialog_layout_report.h				\
+	glom/reports/treestore_report_layout.cc				\
+	glom/reports/treestore_report_layout.h				\
+	glom/translation/combobox_locale.cc				\
+	glom/translation/combobox_locale.h				\
+	glom/translation/dialog_change_language.cc			\
+	glom/translation/dialog_change_language.h			\
+	glom/translation/dialog_copy_translation.cc			\
+	glom/translation/dialog_copy_translation.h			\
+	glom/translation/dialog_identify_original.cc			\
+	glom/translation/dialog_identify_original.h			\
+	glom/translation/window_translations.cc				\
+	glom/translation/window_translations.h				\
+	glom/utility_widgets/filechooserdialog_saveextras.cc		\
+	glom/utility_widgets/filechooserdialog_saveextras.h		\
+	glom/utility_widgets/flowtable_dnd.cc				\
+	glom/utility_widgets/flowtable_dnd.h				\
+	glom/utility_widgets/layouttoolbar.cc				\
+	glom/utility_widgets/layouttoolbar.h				\
+	glom/utility_widgets/layouttoolbarbutton.cc			\
+	glom/utility_widgets/layouttoolbarbutton.h			\
+	glom/utility_widgets/notebooklabelglom.cc			\
+	glom/utility_widgets/notebooklabelglom.h			\
+	glom/utility_widgets/sidebar.cc					\
+	glom/utility_widgets/sidebar.h
 endif
 
-# For running autoreconf
-# (The documentation for this macro says that it is only useful in this top-level Makefile.am)
-ACLOCAL_AMFLAGS = -I macros
+glom_glom_LDADD = $(win_resfile) \
+	glom/utility_widgets/egg/toolpalette/libeggtoolpalette.a \
+	glom/utility_widgets/egg/util/libeggutil.a \
+	glom/libglom/libglom-$(GLOM_ABI_VERSION).la \
+	$(GLOM_LIBS) $(PYTHON_LIBS) $(INTLLIBS) -lgettextpo
 
+if HOST_WIN32
+# Suppress console window
+glom_glom_LDFLAGS = -mwindows
+else
+glom_glom_LDFLAGS =
+endif
+
+tests_ldadd = glom/libglom/libglom-$(GLOM_ABI_VERSION).la $(LIBGLOM_LIBS)
+
+glom_libglom_test_connectionpool_SOURCES = glom/libglom/test_connectionpool.cc
+glom_libglom_test_connectionpool_LDADD = $(tests_ldadd)
+
+glom_libglom_test_document_SOURCES = glom/libglom/test_document.cc
+glom_libglom_test_document_LDADD = $(tests_ldadd)
+
+glom_libglom_test_sharedptr_layoutitem_SOURCES = glom/libglom/test_sharedptr_layoutitem.cc
+glom_libglom_test_sharedptr_layoutitem_LDADD = $(tests_ldadd)
+
+glom_utility_widgets_test_flowtable_SOURCES =	\
+	glom/utility_widgets/flowtable.cc	\
+	glom/utility_widgets/flowtable.h	\
+	glom/utility_widgets/test_flowtable.cc
+
+glom_utility_widgets_test_flowtable_LDADD = $(GLOM_LIBS)
+
+glom_utility_widgets_egg_toolpalette_testtoolpalette_SOURCES =	\
+	glom/utility_widgets/egg/toolpalette/testtoolpalette.c
+
+glom_utility_widgets_egg_toolpalette_testtoolpalette_LDADD =	\
+	glom/utility_widgets/egg/toolpalette/libeggtoolpalette.a\
+	glom/utility_widgets/egg/util/libeggutil.a		\
+	$(EGG_LIBS)
+
+glom_test_pyembed_SOURCES = glom/test_pyembed.cc
+glom_test_pyembed_LDADD = $(LIBGLOM_LIBS) $(PYTHON_LIBS)
+
+regression_tests_test_parsing_time_SOURCES = regression_tests/test_parsing_time.cc
+regression_tests_test_parsing_time_LDADD = $(tests_ldadd)
+
+regression_tests_test_signal_reemit_SOURCES = regression_tests/test_signal_reemit.cc
+regression_tests_test_signal_reemit_LDADD = $(LIBGLOM_LIBS)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = glom/libglom/glom-1.0.pc
+
+dist_pkgdata_DATA = glom/glom_document.dtd
+
+gladedir = $(pkgdatadir)/glade
+dist_glade_DATA = glom/glom.glade glom/glom_developer.glade
+
+xsltdir = $(pkgdatadir)/xslt
+dist_xslt_DATA = xslt/print_details_to_html.xsl xslt/print_report_to_html.xsl
+
+# Note: this used to be $(pkgdatadir)/doc/examples
+exampledir = $(docdir)/examples
+dist_example_DATA =				\
+	examples/README				\
+	examples/example_film_manager.glom	\
+	examples/example_lesson_planner.glom	\
+	examples/example_music_collection.glom	\
+	examples/example_project_manager.glom	\
+	examples/example_smallbusiness.glom
+
+iconthemedir = $(datadir)/icons/hicolor
+appicon16dir = $(iconthemedir)/16x16/apps
+appicon22dir = $(iconthemedir)/22x22/apps
+appicon24dir = $(iconthemedir)/24x24/apps
+appicon32dir = $(iconthemedir)/32x32/apps
+appicon48dir = $(iconthemedir)/48x48/apps
+appiconscdir = $(iconthemedir)/scalable/apps
+
+dist_appicon16_DATA = icons/16x16/glom.png
+dist_appicon22_DATA = icons/22x22/glom.png
+dist_appicon24_DATA = icons/24x24/glom.png
+dist_appicon32_DATA = icons/32x32/glom.png
+dist_appicon48_DATA = icons/48x48/glom.png
+dist_appiconsc_DATA = icons/scalable/glom.svg
+
+# TODO: What are the uninstalled SVGs for?
+noinst_icons = icons/16x16/glom.svg icons/22x22/glom.svg icons/32x32/glom.svg icons/win32/glom.ico
+
+pixmapdir = $(pkgdatadir)/pixmaps
+dist_pixmap_DATA =				\
+	icons/16x16/glom-button.png		\
+	icons/16x16/glom-field.png		\
+	icons/16x16/glom-group.png		\
+	icons/16x16/glom-image.png		\
+	icons/16x16/glom-line-horizontal.png	\
+	icons/16x16/glom-line-vertical.png	\
+	icons/16x16/glom-notebook.png		\
+	icons/16x16/glom-related-records.png	\
+	icons/16x16/glom-text.png
 
-#Copied from gnome-terminal's Makefile.am:
 desktopdir = $(datadir)/applications
-desktop_in_files = glom.desktop.in.in
-desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
- INTLTOOL_DESKTOP_RULE@
+desktop_DATA = glom.desktop
+
+mimedir = $(datadir)/mime
+mimepackagesdir = $(mimedir)/packages
+dist_mimepackages_DATA = glom.xml
+
+dist_template = glom/glom.rc glom/utility_widgets/egg/util/eggmarshalers.list
+dist_docutils = gnome-doc-utils.make omf.make xmldocs.make
+dist_intltool = intltool-extract.in intltool-merge.in intltool-update.in
+dist_docfiles = docs/overview.txt docs/developer_documentation.txt \
+		docs/postgres_test.c docs/postgres_gda_test.c win32/README
+
+dist_noinst_DATA = $(dist_template) $(noinst_icons) $(dist_docutils) \
+		   $(dist_intltool) $(dist_docfiles)
+dist_noinst_SCRIPTS = autogen.sh win32/build-installer
+
+CLEANFILES = $(desktop_DATA) $(win_resfile)
+DISTCLEANFILES = intltool-extract intltool-merge intltool-update
+MAINTAINERCLEANFILES = $(dist_docutils) $(dist_intltool)
 
+# The location of the gettext catalogs as defined by intltool.
+glom_localedir = $(prefix)/$(DATADIRNAME)/locale
 
-# This is the old MIME-type system.
-# GNOME 2.6 seems to require that we register with both the old and the new MIME-type systems.
-# TODO: Try removing this?
-mimeinfodir = $(datadir)/mime-info
-mimeinfo_DATA = glom.keys glom.mime
+glom_includes = -I$(top_builddir)/glom -I$(top_srcdir)/glom -I$(top_builddir) -I$(top_srcdir)
+glom_defines = \
+-DGLOM_DATADIR=\""$(datadir)"\" \
+-DGLOM_DOCDIR=\""$(docdir)"\" \
+-DGLOM_LOCALEDIR=\""$(glom_localedir)"\" \
+-DGLOM_PKGDATADIR=\""$(pkgdatadir)"\"
 
-# Install the glom.xml MIME-type registration file, so that the files can be recognised as the 
-# correct MIME-type:
-MimeDatabasedir = $(datadir)/mime/packages
-MimeDatabase_DATA = glom.xml
+AM_CPPFLAGS = $(glom_includes) $(GLOM_CFLAGS) $(PYTHON_CPPFLAGS) $(glom_defines)
+AM_CFLAGS   = $(GLOM_WFLAGS)
+AM_CXXFLAGS = $(GLOM_WXXFLAGS)
 
-# Install the application registration, so that the system knows that this application can open files of this MIME-type:
-# Removed because that was the old way. murrayc:
-# appregdir = $(datadir)/application-registry
-# appreg_DATA = glom.applications
+update_mime_database = update-mime-database
+update_icon_cache = gtk-update-icon-cache --ignore-theme-index --force
 
 if UPDATE_MIME_DATABASE
-install-data-hook: 
-	-update-mime-database "$(DESTDIR)${datadir}/mime"
+install-data-hook: install-update-icon-cache install-update-mime-database
+uninstall-hook: uninstall-update-icon-cache uninstall-update-mime-database
+else
+install-data-hook: install-update-icon-cache
+uninstall-hook: uninstall-update-icon-cache
 endif
 
-EXTRA_DIST = $(desktop_in_files) $(MimeDatabase_DATA) $(appreg_DATA) $(mimeinfo_DATA) \
-             autogen.sh \
-             gnome-doc-utils.make \
-             intltool-extract.in intltool-merge.in intltool-update.in xmldocs.make omf.make
+install-update-icon-cache:
+	@$(POST_INSTALL)
+	test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
 
-#gnome-doc-utils stuff:
-DISTCLEANFILES = gnome-doc-utils.make $(desktop_DATA) intltool-extract intltool-merge intltool-update
+uninstall-update-icon-cache:
+	@$(POST_UNINSTALL)
+	test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
 
-# (See http://cvs.gnome.org/lxr/source/intltool/README about these intltool files)
+install-update-mime-database:
+	@$(POST_INSTALL)
+	test -n "$(DESTDIR)" || $(update_mime_database) "$(mimedir)"
+
+uninstall-update-mime-database:
+	@$(POST_UNINSTALL)
+	test -n "$(DESTDIR)" || $(update_mime_database) "$(mimedir)"
+
+$(eggutildir)/egg-marshal.c: $(eggutildir)/eggmarshalers.c $(eggutildir)/eggmarshalers.h
+
+$(eggutildir)/eggmarshalers.h: $(eggmarshalers_list)
+	$(GLIB_GENMARSHAL) --prefix=_egg_marshal --header "$(eggmarshalers_list)" >'$@'
+
+$(eggutildir)/eggmarshalers.c: $(eggmarshalers_list)
+	$(GLIB_GENMARSHAL) --prefix=_egg_marshal --body "$(eggmarshalers_list)" >'$@'
+
+if HOST_WIN32
+.rc.res:
+	$(WINDRES) -i '$<' --input-format=rc -o '$@' -O coff
+endif
+
+ INTLTOOL_DESKTOP_RULE@
 
-# ignore the scrollkeeper and mime stuff. I'm sure this shouldn't be necessary. murrayc.
-scrollkeeper_rubbish = find . -type f -print | grep -v '^\./var/scrollkeeper'
-mime_rubbish = find . -type f -print | grep -v '^\./share/mime'
-distuninstallcheck_listfiles = intltool-extract intltool-merge intltool-update $(scrollkeeper_rubbish) $(mime_rubbish)
+.PHONY: install-update-icon-cache uninstall-update-icon-cache \
+	install-update-mime-database uninstall-update-mime-database
 
+.DELETE_ON_ERROR:
diff --git a/autogen.sh b/autogen.sh
index 4104ab4..f711c19 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,73 +1,9 @@
-#! /bin/sh
-
-# $Id$
-#
-# Copyright (c) 2002  Daniel Elstner  <daniel elstner gmx net>,
-#               2003  Murray Cumming  <murrayc usa net>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License VERSION 2 as
-# published by the Free Software Foundation.  You are not allowed to
-# use any other version of the license; unless you got the explicit
-# permission from the author to do so.
-#
-# 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
-
-
-# This is meant to be a well-documented, good example of an autogen.sh script
-# Please email gnome-devel-list gnome org if you think it isn't.
-
-
-dir=`echo "$0" | sed 's,[^/]*$,,'`
-test "x${dir}" = "x" && dir='.'
-
-if test "x`cd "${dir}" 2>/dev/null && pwd`" != "x`pwd`"
-then
-    echo "This script must be executed directly from the source directory."
-    exit 1
-fi
-
-# This might not be necessary with newer autotools:
-rm -f config.cache
-
-enable_warnings=
-
-srcdir=`dirname $0`
-
-case "$*" in
-    *--enable-warnings*|*--disable-warnings*)
-        ;;
-    *)  # enable -Werror by default when building with gcc3
-        ${CXX:-"g++"} --version 2>/dev/null | grep '(GCC) 3\.[0-9]\+\.[0-9]' >/dev/null 2>&1 \
-            && enable_warnings='--enable-warnings=hardcore'
-        ;;
-esac
-
-# We use glib-gettextize, which apparently does not add the intl directory 
-# (containing a local copy of libintl code), and therefore has a slightly different Makefile.
-echo "- glib-gettextize."	&& \
-  glib-gettextize --copy --force 	&& \
-echo "- intltoolize."		&& \
-  intltoolize --copy --force	&& \
-echo "- libtoolize."		&& \
-  libtoolize --copy --force --automake 	&& \
-echo "- gnome-doc-prepare."	&& \
-  gnome-doc-prepare --force --copy	&& \
-echo "- aclocal-1.9"		&& \
-  aclocal-1.9 -I "$srcdir/macros" $ACLOCAL_FLAGS && \
-echo "- autoconf"		&& \
-  autoconf			&& \
-echo "- automake-1.9."		&& \
-  automake-1.9 --add-missing --gnu	&& \
-echo "- configure --enable-maintainer-mode" $enable_warnings "$@"	&& \
-  ./configure --enable-maintainer-mode $enable_warnings "$@"		&& exit 0
-
-exit 1
-
+#! /bin/sh -e
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+(
+  cd "$srcdir" &&
+  gnome-doc-prepare --copy --force &&
+  AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install
+) || exit
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/config.h.in b/config.h.in
index 887b71a..c04b374 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,117 +1,31 @@
-
-/* Include libglom_config.h so we also get the prefixed definitions */
-#include "glom/libglom/libglom_config.h"
-
-/* Whether to enable support for PostgreSQL databases. */
-#undef GLOM_ENABLE_POSTGRESQL
-
-/* Whether to enable support for SQLite databases. */
-#undef GLOM_ENABLE_SQLITE
-
-/* Whether to disable support for self-hosting and developer mode */
-#undef GLOM_ENABLE_CLIENT_ONLY
-
-/* Whether to enable support for the maemo platform */
-#undef GLOM_ENABLE_MAEMO
+/* config.h.in.  Generated from configure.ac by autoheader.  */
 
 /* always defined to indicate that i18n is enabled */
 #undef ENABLE_NLS
 
-/* The domain name to use with gettext. */
-#undef GETTEXT_PACKAGE
-
-/* Define to 1 if you have the `bind_textdomain_codeset' function. */
-#undef HAVE_BIND_TEXTDOMAIN_CODESET
-
-/* Define to 1 if you have the `dcgettext' function. */
-#undef HAVE_DCGETTEXT
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define if the GNU gettext() function is already present or preinstalled. */
-#undef HAVE_GETTEXT
-
-/* Defined when libgettextpo has the new po_xerror_handler error handling
-   struct. */
-#undef HAVE_GETTEXTPO_XERROR
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define if your <locale.h> file defines LC_MESSAGES. */
-#undef HAVE_LC_MESSAGES
-
-/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
+/* Define to the file extension of executables on the target. */
+#undef EXEEXT
 
-/* Define to 1 if you have the `strptime' function. */
-#undef HAVE_STRPTIME
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* ISO codes prefix */
-#undef ISO_CODES_PREFIX
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
-#undef LT_OBJDIR
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
+/* Define to the gettext package name. */
+#undef GETTEXT_PACKAGE
 
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
+/* Define to the Glom ABI version string. */
+#undef GLOM_ABI_VERSION
 
-/* Path to the postgres utilities, such as postgres, pg_ctl, etc. */
-#undef POSTGRES_UTILS_PATH
+/* Define to the Glom ABI version with '.' replaced by '_'. */
+#undef GLOM_ABI_VERSION_UNDERLINED
 
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
+/* Define to disable support for self-hosting and developer mode. */
+#undef GLOM_ENABLE_CLIENT_ONLY
 
-/* Version number of package */
-#undef VERSION
-/* config.h.in.  Generated from configure.ac by autoheader.  */
+/* Define to enable support for the Maemo platform. */
+#undef GLOM_ENABLE_MAEMO
 
-/* always defined to indicate that i18n is enabled */
-#undef ENABLE_NLS
+/* Whether to enable support for PostgreSQL databases. */
+#undef GLOM_ENABLE_POSTGRESQL
 
-/* The domain name to use with gettext. */
-#undef GETTEXT_PACKAGE
+/* Whether to enable support for SQLite databases. */
+#undef GLOM_ENABLE_SQLITE
 
 /* Define to 1 if you have the `bind_textdomain_codeset' function. */
 #undef HAVE_BIND_TEXTDOMAIN_CODESET
@@ -125,8 +39,7 @@
 /* Define if the GNU gettext() function is already present or preinstalled. */
 #undef HAVE_GETTEXT
 
-/* Defined when libgettextpo has the new po_xerror_handler error handling
-   struct. */
+/* Define if libgettextpo provides the new po_xerror_handler struct. */
 #undef HAVE_GETTEXTPO_XERROR
 
 /* Define to 1 if you have the <inttypes.h> header file. */
@@ -165,15 +78,15 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* ISO codes prefix */
+/* Define to the installation prefix of the iso-codes module. */
 #undef ISO_CODES_PREFIX
 
 /* Define to the sub-directory in which libtool stores uninstalled libraries.
    */
 #undef LT_OBJDIR
 
-/* Name of package */
-#undef PACKAGE
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
 
 /* Define to the address where bug reports for this package should be sent. */
 #undef PACKAGE_BUGREPORT
@@ -190,11 +103,8 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* Path to the postgres utilities, such as postgres, pg_ctl, etc. */
+/* Define to the location of the PostgreSQL utilities. */
 #undef POSTGRES_UTILS_PATH
 
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
diff --git a/configure.ac b/configure.ac
index d400a68..71213dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,322 +1,220 @@
-# Initialization macros:
-AC_INIT
-AC_CONFIG_SRCDIR([glom/main.cc])
+## Copyright (c) 2009  Daniel Elstner <daniel kitta gmail com>
+##
+## This file is part of Glom.
+##
+## Glom 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, either version 2 of the License,
+## or (at your option) any later version.
+##
+## Glom 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, see <http://www.gnu.org/licenses/>.
+
+AC_INIT([Glom], [1.11.0], [http://bugzilla.gnome.org/enter_bug.cgi?product=Glom], [glom])
+AC_PREREQ([2.60])
 
+AC_CONFIG_SRCDIR([glom/main.cc])
+AC_CONFIG_MACRO_DIR([macros])
 AC_CONFIG_HEADERS([config.h glom/libglom/libglom_config.h])
 
-# Package name and version number:
-AM_INIT_AUTOMAKE(glom, 1.11.0)
-
-AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE([1.10 check-news no-define nostdinc])
+AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>])
 
-# Checks for programs:
 AC_PROG_CC
+AM_PROG_CC_C_O
 AC_PROG_CXX
-AC_LIBTOOL_WIN32_DLL
-AM_PROG_LIBTOOL
-AM_SANITY_CHECK
-
-# Used for the install directories for headers.
-# The same number is used in the library name, which must be kept in sync,
-# but variables can't be used with that.
-GLOM_ABI_VERSION=1.12
-AC_SUBST([GLOM_ABI_VERSION])
-
-#Python modules can't be called glom-1.x, so we use underlines.
-#There might be a better way to do this, but I can't find any example of it. murrayc.
-GLOM_ABI_VERSION_UNDERLINED=1_12
-AC_SUBST([GLOM_ABI_VERSION_UNDERLINED])
-
-# libgettext-po changed its API, changing the error handler struct from po_error_handler to po_xerror_handler:
-AC_CHECK_MEMBER([struct po_xerror_handler.xerror], [have_gettext_po_xerror="yes"], [have_gettext_po_xerror="no"], [#include <gettext-po.h>])
-if test "$have_gettext_po_xerror" = "yes"; then
-{
-  AC_DEFINE([HAVE_GETTEXTPO_XERROR],[1], [Defined when libgettextpo has the new po_xerror_handler error handling struct.])
-}
-fi
-
-#Internationalisation:
-GETTEXT_PACKAGE=glom
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"],
-		   [The domain name to use with gettext.])
 
+LT_PREREQ([2.2.0])
+LT_INIT([disable-static win32-dll])
+
+# Used for the install directories for headers.  The same number is used in
+# the library name, which must be kept in sync, but variables can't be used
+# with that.
+AC_SUBST([GLOM_ABI_VERSION], [1.12])
+AC_DEFINE_UNQUOTED([GLOM_ABI_VERSION], ["$GLOM_ABI_VERSION"],
+		   [Define to the Glom ABI version string.])
+# Python modules can't be called glom-1.x, so we use underlines.
+AC_DEFINE_UNQUOTED([GLOM_ABI_VERSION_UNDERLINED], ["AS_TR_SH([$GLOM_ABI_VERSION])"],
+                   [Define to the Glom ABI version with '.' replaced by '_'.])
+
+# libgettext-po changed its API, changing the error handler struct
+# from po_error_handler to po_xerror_handler:
+AC_CACHE_CHECK([for po_xerror_handler], [glom_cv_has_po_xerror_handler],
+               [AC_CHECK_MEMBER([struct po_xerror_handler.xerror],
+                                [glom_cv_has_po_xerror_handler=yes],
+                                [glom_cv_has_po_xerror_handler=no],
+                                [#include <gettext-po.h>])])
+
+AS_IF([test "x$glom_cv_has_po_xerror_handler" = xyes],
+      [AC_DEFINE([HAVE_GETTEXTPO_XERROR], [1],
+                 [Define if libgettextpo provides the new po_xerror_handler struct.])])
+
+IT_PROG_INTLTOOL([0.35])
+AC_SUBST([GETTEXT_PACKAGE], [glom])
+AM_GNU_GETTEXT_VERSION([0.11])
 AM_GLIB_GNU_GETTEXT
-IT_PROG_INTLTOOL([0.35.0])
-
-AC_ARG_ENABLE([scrollkeeper],
-[AS_HELP_STRING([--disable-scrollkeeper],[do not make updates to the scrollkeeper database])],,
-   enable_scrollkeeper=yes)
-AM_CONDITIONAL(ENABLE_SK, test "x$enable_scrollkeeper" = "xyes")
-
-#AC_CONFIG_AUX_DIR(macros)
-AC_SUBST([ACLOCAL_AMFLAGS], ['-I macros ${ACLOCAL_FLAGS}'])
-
-# Copied from gobby:
-AC_MSG_CHECKING([whether to enable WIN32 specific flags])
-case "$host_os" in
-*mingw*)
-        win32=true
-        AC_MSG_RESULT([yes])
-        AC_CHECK_TOOL(WINDRES, windres)
-        ;;
-*)
-        win32=false
-        AC_MSG_RESULT([no])
-        ;;
-esac
-AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
+AC_DEFINE([GETTEXT_PACKAGE], [PACKAGE_TARNAME], [Define to the gettext package name.])
 
-AC_LANG([C++])
+AC_MSG_CHECKING([whether to enable Windows specific options])
+AS_CASE([$host_os], [mingw*], [glom_host_win32=yes], [glom_host_win32=no])
+AC_MSG_RESULT([$glom_host_win32])
 
-AC_ARG_ENABLE([client-only],
-	AS_HELP_STRING([--enable-client-only],[build without developer mode and self-hosting]),
-	[enable_client_only=$enableval],
-	[enable_client_only=no])
+AS_IF([test "x$glom_host_win32" = xyes],
+      [AC_CHECK_TOOL([WINDRES], [windres])])
 
-AC_ARG_ENABLE([maemo],
-	AS_HELP_STRING([--enable-maemo],[build with support for the maemo platform (implies --enable-client-only)]),
-	[enable_maemo=$enableval],
-	[enable_maemo=no])
+AM_CONDITIONAL([HOST_WIN32], [test "x$glom_host_win32" = xyes])
 
-AM_CONDITIONAL(GLOM_ENABLE_MAEMO, test "$enable_maemo" = "yes")
-if test "$enable_maemo" = "yes"; then
-	AC_DEFINE([GLOM_ENABLE_MAEMO], 1, [Whether to enable support for the maemo platform])
-	# Implies clientonly
-	enable_client_only="yes"
-fi
+AC_ARG_ENABLE([maemo],
+              [AS_HELP_STRING([--enable-maemo],
+                              [build with support for the Maemo platform
+                               (implies --enable-client-only)])],
+              [glom_enable_maemo=$enableval],
+              [glom_enable_maemo=no])
 
+AC_ARG_ENABLE([client-only],
+              [AS_HELP_STRING([--enable-client-only],
+                              [build without developer mode and self-hosting])],
+              [glom_enable_client_only=$enableval],
+              [glom_enable_client_only=$glom_enable_maemo])
 
-AM_CONDITIONAL(GLOM_ENABLE_CLIENT_ONLY, test "$enable_client_only" = "yes")
+# Bail out if --enable-maemo and --disable-client-only are used together.
+AS_IF([test "x$glom_enable_maemo" = xyes && test "x$glom_enable_client_only" != xyes],
+      [AC_MSG_ERROR([[Building with --enable-maemo also requires --enable-client-only.]])])
 
-if test "$enable_client_only" = "yes"; then
-	AC_DEFINE([GLOM_ENABLE_CLIENT_ONLY], 1, [Whether to disable support for self-hosting and developer mode])
-fi
+AM_CONDITIONAL([GLOM_ENABLE_MAEMO], [test "x$glom_enable_maemo" = xyes])
+AM_CONDITIONAL([GLOM_ENABLE_CLIENT_ONLY], [test "x$glom_enable_client_only" = xyes])
 
+AS_IF([test "x$glom_enable_maemo" = xyes],
+      [AC_DEFINE([GLOM_ENABLE_MAEMO], [1],
+                 [Define to enable support for the Maemo platform.])])
+AS_IF([test "x$glom_enable_client_only" = xyes],
+      [AC_DEFINE([GLOM_ENABLE_CLIENT_ONLY], [1],
+                 [Define to disable support for self-hosting and developer mode.])])
 
 AC_ARG_ENABLE([sqlite],
-	AS_HELP_STRING([--enable-sqlite],[Allow creation of SQLite databases and opening of documents using SQLite databases. This disables some functionality and is intended only for embedded use. [default=no]]),
-	[enable_sqlite=$enableval],
-	[enable_sqlite=no])
+              [AS_HELP_STRING([--enable-sqlite],
+                              [Allow creation of SQLite databases and opening
+                               of documents using SQLite databases. This
+                               disables some functionality and is intended
+                               only for embedded use.])],
+              [glom_enable_sqlite=$enableval],
+              [glom_enable_sqlite=no])
 
-AM_CONDITIONAL(GLOM_ENABLE_SQLITE, test "$enable_sqlite" = "yes")
-if test "$enable_sqlite" = "yes"; then
-	AC_DEFINE([GLOM_ENABLE_SQLITE], 1, [Whether to enable support for SQLite databases.])
-fi
+AM_CONDITIONAL([GLOM_ENABLE_SQLITE], [test "x$glom_enable_sqlite" = xyes])
 
+AS_IF([test "x$glom_enable_sqlite" = xyes],
+      [AC_DEFINE([GLOM_ENABLE_SQLITE], [1],
+                 [Whether to enable support for SQLite databases.])])
 
 AC_ARG_ENABLE([postgresql],
-	AS_HELP_STRING([--enable-postgresql],[Allow creation of PostgreSQL databases and opening of documents using PostgreSQL databases. [default=yes]]),
-	[enable_postgresql=$enableval],
-	[enable_postgresql=yes])
-
-AM_CONDITIONAL(GLOM_ENABLE_POSTGRESQL, test "$enable_postgresql" = "yes")
-if test "$enable_postgresql" = "yes"; then
-	AC_DEFINE([GLOM_ENABLE_POSTGRESQL], 1, [Whether to enable support for PostgreSQL databases.])
-fi
-
-# Libraries used by libglom:
-REQUIRED_LIBGLOM_LIBS="giomm-2.4 gthread-2.0 libxml++-2.6 pygda-4.0 >= 2.25.3 pygobject-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.14 libgda-4.0 >= 4.0.0 libgda-postgres-4.0"
+              [AS_HELP_STRING([--disable-postgresql],
+                              [do not build with support for PostgreSQL databases])],
+              [glom_enable_postgresql=$enableval],
+              [glom_enable_postgresql=yes])
 
-if test "$enable_maemo" = "yes"; then
-	REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS libepc-1.0 >= 0.3.1 avahi-ui";
-elif test "$win32" = "true"; then
-	REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS";
-else
-	REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS iso-codes libepc-1.0 >= 0.3.1 avahi-ui";
-fi
+AM_CONDITIONAL([GLOM_ENABLE_POSTGRESQL], [test "x$glom_enable_postgresql" = xyes])
 
+AS_IF([test "x$glom_enable_postgresql" = xyes],
+      [AC_DEFINE([GLOM_ENABLE_POSTGRESQL], [1],
+                 [Whether to enable support for PostgreSQL databases.])])
 
-# Libraries used by Glom:
-REQUIRED_GLOM_LIBS="gtkmm-2.4 >= 2.14 gthread-2.0 gconfmm-2.6 libxml++-2.6 libxslt >= 1.1.10 goocanvasmm-1.0 >= 0.14.0"
-
-REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS $REQUIRED_LIBGLOM_LIBS"
-	
-# Do not require, goocanvas and gtksourceviewmm in client only mode
-if test $enable_client_only != yes; then
-	REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS gtksourceviewmm-2.0"
-fi
-
-
-if test "$enable_maemo" = "yes"; then
-	REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS hildonmm";
-elif test "$win32" = "true"; then
-	REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS gtkmm-2.4 >= 2.14";
-else
-	REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS";
-fi
-
-if test "$enable_sqlite" = "yes"; then
-	REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS libgda-sqlite-4.0"
-fi
-
-# Checks for libraries.
-PKG_CHECK_MODULES(GLOM, $REQUIRED_GLOM_LIBS)
-GLOM_LIBS="$GLOM_LIBS --no-undefined"
-AC_SUBST(GLOM_CFLAGS)
-AC_SUBST(GLOM_LIBS)
-
-PKG_CHECK_MODULES(LIBGLOM, $REQUIRED_LIBGLOM_LIBS)
-LIBGLOM_LIBS="$GLOM_LIBS --no-undefined"
-AC_SUBST(LIBGLOM_CFLAGS)
-AC_SUBST(LIBGLOM_LIBS)
-
-
-
-# Temporary egg CFLAGS
-PKG_CHECK_MODULES(EGG, gtk+-2.0 >= 2.5.0)
-GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
-AC_SUBST(GLIB_GENMARSHAL)
-
-#Get the location of the ISO-Codes (currencies, languages) files:
-AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
-
-# Get the CFLAGS and LIBS for python's embedding API:
-AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
-
-# We don't have this on mingw, for example
-AC_CHECK_FUNCS(strptime)
-
-# Install path for DTD (e.g. /usr/local/share/glom):
-
-#I would like to use this line, but it doesn't fully evaluate.
-#It appears in config.h as "${prefix}/share/glom"
-#So I hard-code "share" instead.
-#GLOM_DTD_INSTALL_DIR="\"${datadir}/${PACKAGE}\""
-
-GLOM_DTD_INSTALL_DIR="\"${prefix}/share/${PACKAGE}\""
-AC_DEFINE_UNQUOTED(GLOM_DTD_INSTALL_DIR, $GLOM_DTD_INSTALL_DIR, "definition of GLOM_DTD_INSTALL_DIR")
-
-# Evaluate the --enable-warnings=level option.
-DK_ARG_ENABLE_WARNINGS([GLOM_WARNING_FLAGS],
-                       [-Wall -w1],
-                       [-Wall -Wextra -w1],
-                       [GLIBMM GTKMM])
-
-AC_ARG_ENABLE(update-mime-database,
-        AS_HELP_STRING([--disable-update-mime-database],[do not run the update-mime-database utility (mostly useful for package maintainers) ]))
-AM_CONDITIONAL(UPDATE_MIME_DATABASE, test "$enable_update_mime_database" != "no")
-
-# Option not needed on Windows
-if test $win32 != true; then
-	# Ask user for path to the directory containing the postgresql utilities, such as the postmaster executable, so we can self-host postgresql databases:
-	# We default to the path used by Ubuntu (Dapper and Edgy) so that the build works at least somewhere by default.
-	AC_ARG_WITH(postgres-utils,
-	    [ --with-postgres-utils=<path> path to the postmaster executable. e.g. /usr/lib/postgresql/8.3/bin (ignored on Windows)],
-	    [POSTGRES_UTILS_PATH=$with_postgres_utils],
-	    [POSTGRES_UTILS_PATH=/usr/lib/postgresql/8.3/bin]
-	)
-
-	AC_SUBST(POSTGRES_UTILS_PATH)
-	AC_DEFINE_UNQUOTED([POSTGRES_UTILS_PATH], ["${POSTGRES_UTILS_PATH}"], [Path to the postgres utilities, such as postgres, pg_ctl, etc.])
-
-	if test $enable_client_only != yes; then
-		# Check that the supplied (or default) path really contains the postgres utilities:
-                # We check for pg_ctl rather than postgres, because postgres seem too general a name.
-		AC_CHECK_PROG(HAVE_POSTGRES, pg_ctl, yes, no, ${POSTGRES_UTILS_PATH})
-		if test "x$HAVE_POSTGRES" = "xno"; then
-		AC_MSG_ERROR([The postgres utilities could not be found in the path: ${POSTGRES_UTILS_PATH}. They are needed for self-hosting of Glom databases. Please make sure that Postgres is installed, and provide the correct path with the --with-postgres-utils option.])
-		fi
-	fi
-fi
-
-
-# Allow use of gnome-doc-utils to be disabled for platforms (For instance, Maemo) that don't have it:
-AC_ARG_ENABLE([doc-utils],
-	AS_HELP_STRING([--enable-doc-utils],[Whether the documentation should be built.]),
-	[enable_doc=$enableval],
-	[enable_doc=yes])
-
-
-AM_CONDITIONAL(HAVE_GNOME_DOC_UTILS, test "$enable_doc" = "yes")
-
-# For gnome-doc-utils:
-if test $enable_doc = yes; then
-  GNOME_DOC_INIT([0.9.0])
-fi
-
-# Add an --enable-maemo-launcher option.
 AC_ARG_ENABLE([maemo-launcher],
               [AS_HELP_STRING([--enable-maemo-launcher],
                               [build with maemo-launcher support])],
-                              [case "${enableval}" in
-                               yes) maemo_launcher=true ;;
-                               no)  maemo_launcher=false ;;
-                               *) AC_MSG_ERROR([bad value ${enableval} for --enable-maemo-launcher]) ;;
-                               esac], [maemo_launcher=false])
-
-if test x$maemo_launcher = xtrue
-then
-	PKG_CHECK_MODULES(MAEMO_LAUNCHER, [maemo-launcher-app])
-	AC_SUBST(MAEMO_LAUNCHER_CFLAGS)
-	AC_SUBST(MAEMO_LAUNCHER_LIBS)
-fi
-
-# HACK:  Assign a dummy in order to prevent execution of autoheader by the
-# maintainer-mode rules.  That would fail since we aren't using autoheader.
-AUTOHEADER=':'
-
-# Generate Makefiles, configuration files and scripts:
-AC_CONFIG_FILES([Makefile \
-  glom/Makefile \
-    docs/Makefile \
-      docs/user-guide/Makefile \
-  icons/Makefile \
-    icons/16x16/Makefile \
-    icons/22x22/Makefile \
-    icons/24x24/Makefile \
-    icons/32x32/Makefile \
-    icons/48x48/Makefile \
-    icons/scalable/Makefile \
-    icons/win32/Makefile \
-  xslt/Makefile \
-  po/Makefile.in \
-  macros/Makefile \
-  examples/Makefile \
-  regression_tests/Makefile \
-  glom.desktop.in \
-  win32/Makefile \
-  win32/glom.iss
-])
-
-AC_CONFIG_FILES([
-    glom/libglom/glom-1.0.pc \
-    glom/libglom/Makefile \
-      glom/libglom/data_structure/Makefile \
-        glom/libglom/data_structure/layout/Makefile \
-          glom/libglom/data_structure/layout/report_parts/Makefile \
-      glom/libglom/document/Makefile \
-        glom/libglom/document/bakery/Makefile \
-          glom/libglom/document/bakery/view/Makefile \
-      glom/libglom/connectionpool_backends/Makefile \
-      glom/libglom/python_embed/Makefile \
-])
-
-AC_CONFIG_FILES([
-    glom/bakery/Makefile \
-    glom/layout_item_dialogs/Makefile \
-    glom/mode_data/Makefile \
-    glom/mode_design/Makefile \
-      glom/mode_design/fields/Makefile \
-      glom/mode_design/print_layouts/Makefile \
-      glom/mode_design/users/Makefile \
-      glom/mode_design/script_library/Makefile \
-    glom/mode_find/Makefile \
-    glom/navigation/Makefile \
-    glom/utility_widgets/Makefile \
-      glom/utility_widgets/cellrendererlist/Makefile \
-      glom/utility_widgets/adddel/Makefile \
-      glom/utility_widgets/canvas/Makefile \
-      glom/utility_widgets/db_adddel/Makefile \
-      glom/utility_widgets/egg/Makefile
-        glom/utility_widgets/egg/toolpalette/Makefile \
-        glom/utility_widgets/egg/util/Makefile \
-      glom/python_embed/Makefile \
-        glom/python_embed/python_module/Makefile \
-    glom/relationships_overview/Makefile \
-    glom/reports/Makefile \
-    glom/translation/Makefile \
-])
-AC_OUTPUT
+              [glom_maemo_launcher=$enableval],
+              [glom_maemo_launcher=no])
 
+# Libraries used by libglom:
+REQUIRED_LIBGLOM_LIBS='gthread-2.0 giomm-2.4 libxml++-2.6 pygda-4.0 >= 2.25.3 pygobject-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.14 libgda-4.0 >= 4.0.0 libgda-postgres-4.0'
+
+AS_IF([test "x$glom_enable_maemo" != xyes && test "x$glom_host_win32" != xyes],
+      [REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS iso-codes"])
+AS_IF([test "x$glom_host_win32" != xyes],
+      [REQUIRED_LIBGLOM_LIBS="$REQUIRED_LIBGLOM_LIBS libepc-1.0 >= 0.3.1 avahi-ui"])
 
+# Libraries used by Glom:
+REQUIRED_GLOM_LIBS="$REQUIRED_LIBGLOM_LIBS gtkmm-2.4 >= 2.14 gthread-2.0 gconfmm-2.6 libxml++-2.6 libxslt >= 1.1.10 goocanvasmm-1.0 >= 0.14.0"
+
+# Do not require gtksourceviewmm in client only mode
+AS_IF([test "x$glom_enable_client_only" != xyes],
+      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS gtksourceviewmm-2.0"])
+AS_IF([test "x$glom_enable_sqlite" = xyes],
+      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS libgda-sqlite-4.0"])
+AS_IF([test "x$glom_enable_maemo" = xyes],
+      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS hildonmm"])
+AS_IF([test "x$glom_maemo_launcher" = xyes],
+      [REQUIRED_GLOM_LIBS="$REQUIRED_GLOM_LIBS maemo-launcher-app"])
+
+PKG_CHECK_MODULES([LIBGLOM], [$REQUIRED_LIBGLOM_LIBS])
+PKG_CHECK_MODULES([GLOM], [$REQUIRED_GLOM_LIBS])
+
+# Flags for building the included libegg
+PKG_CHECK_MODULES([EGG], [gthread-2.0 gtk+-2.0])
+
+MM_PKG_CONFIG_SUBST([GLIB_GENMARSHAL], [--variable=glib_genmarshal glib-2.0])
+
+# Get the location of the ISO-Codes (currencies, languages) files:
+MM_PKG_CONFIG_SUBST([ISO_CODES_PREFIX], [--variable=prefix iso-codes])
+AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX], ["$ISO_CODES_PREFIX"],
+                   [Define to the installation prefix of the iso-codes module.])
+
+AC_LANG_ASSERT([C])
+DK_ARG_ENABLE_WARNINGS([GLOM_WFLAGS],
+                       [-Wall], [-Wall -Wextra],
+                       [G GDK GDK_PIXBUF GTK])
+AC_LANG([C++])
+DK_ARG_ENABLE_WARNINGS([GLOM_WXXFLAGS],
+                       [-Wall], [-Wall -Wextra],
+                       [G GDK GDK_PIXBUF GTK GLIBMM GTKMM])
+AC_CHECK_FUNCS([strptime])
+# Get the compiler and linker flags for embedding Python
+MM_CHECK_MODULE_PYTHON
+
+AC_ARG_ENABLE([update-mime-database],
+              [AS_HELP_STRING([--disable-update-mime-database],
+                              [do not run the update-mime-database utility
+                               (mainly useful to package maintainers)])],
+              [glom_update_mime_database=$enableval],
+              [glom_update_mime_database=yes])
+
+AM_CONDITIONAL([UPDATE_MIME_DATABASE], [test "x$glom_update_mime_database" != xno])
+
+# Locate the directory containing the postgresql utilities, such as the
+# postmaster executable, so we can self-host postgresql databases.
+AC_ARG_WITH([postgres-utils],
+            [AS_HELP_STRING([--with-postgres-utils=DIR],
+                            [path to PostgreSQL utilities (overriding pg_config)])],
+            [POSTGRES_UTILS_PATH=$withval])
+
+# Path not needed on Windows
+AS_IF([test "x$glom_host_win32" != xyes && test "x$glom_enable_client_only" != xyes],
+      [AS_CASE([$POSTGRES_UTILS_PATH], [""|no|yes],
+[
+  POSTGRES_UTILS_PATH=`pg_config --bindir 2>&AS_MESSAGE_LOG_FD`
+  AS_IF(["$POSTGRES_UTILS_PATH/pg_ctl" --version >/dev/null 2>&AS_MESSAGE_LOG_FD],,
+        [AC_MSG_ERROR([[
+The Postgres utilities could not be found. They are needed for
+self-hosting of Glom databases. Please make sure that Postgres
+is installed, and if necessary specify the correct directory
+explicitly with the --with-postgres-utils option.
+]])])])])
+AC_DEFINE_UNQUOTED([POSTGRES_UTILS_PATH], ["$POSTGRES_UTILS_PATH"],
+                   [Define to the location of the PostgreSQL utilities.])
+AC_DEFINE_UNQUOTED([EXEEXT], ["$EXEEXT"],
+                   [Define to the file extension of executables on the target.])
+
+GNOME_DOC_INIT([0.9.0],,
+  [AC_MSG_WARN([[gnome-doc-utils not found: documentation will not be built.]])])
+
+AC_CONFIG_FILES([Makefile
+                 docs/user-guide/Makefile
+                 po/Makefile.in
+                 glom.desktop.in
+                 glom/libglom/glom-1.0.pc
+                 win32/glom.iss])
+AC_OUTPUT
diff --git a/docs/user-guide/Makefile.am b/docs/user-guide/Makefile.am
index 4a898a6..da2593d 100644
--- a/docs/user-guide/Makefile.am
+++ b/docs/user-guide/Makefile.am
@@ -1,3 +1,5 @@
+AUTOMAKE_OPTIONS = -Wno-portability
+
 include $(top_srcdir)/gnome-doc-utils.make
 dist-hook: doc-dist-hook
 
diff --git a/glom/application.cc b/glom/application.cc
index 0bf8e51..0b99269 100644
--- a/glom/application.cc
+++ b/glom/application.cc
@@ -107,29 +107,8 @@ App_Glom::App_Glom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& bu
 #endif // !GLOM_ENABLE_CLIENT_ONLY
   m_show_sql_debug(false)
 {
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  try
-#else
-  std::auto_ptr<Glib::Error> error;
-#endif
-  {
-    //Show the icon in the window manager's window title bar and in the list of running applications:
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-    set_icon_from_file(GLOM_ICON_DIR "/glom.png");
-#else
-    set_icon_from_file(GLOM_ICON_DIR "/glom.png", error);
-#endif
-  }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  catch(const Glib::Error& ex)
-  {
-#else
-  if(error.get() != NULL)
-  {
-    const Glib::Error& ex = *error.get();
-#endif
-    std::cerr << "App_Glom::App_Glom(): Could not set icon: " << ex.what() << std::endl;
-  } 
+  // TODO: Wrap missing method in gtkmm
+  gtk_window_set_icon_name(gobj(), "glom");
 
   //Load widgets from glade file:
   builder->get_widget("bakery_vbox", m_pBoxTop);
@@ -206,7 +185,7 @@ bool App_Glom::init(const Glib::ustring& document_uri)
 {
   type_vec_strings vecAuthors;
   vecAuthors.push_back("Murray Cumming <murrayc murrayc com>");
-  set_about_information(VERSION, vecAuthors, _("(C) 2000-2005 Murray Cumming"), _("A Database GUI"));
+  set_about_information(PACKAGE_VERSION, vecAuthors, _("(C) 2000-2005 Murray Cumming"), _("A Database GUI"));
 
   type_base::init(); //calls init_menus() and init_toolbars()
 
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index bf771fc..079c854 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -155,25 +155,19 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 
 #ifdef G_OS_WIN32
-  gchar* dir = g_win32_get_package_installation_directory_of_module(NULL);
-  std::string path = Glib::build_filename(dir, "share/glom/doc/examples");
+  gchar* dir = g_win32_get_package_installation_directory_of_module(0);
+  std::string path = Glib::build_filename(dir, "share" G_DIR_SEPARATOR_S "doc"
+                                                       G_DIR_SEPARATOR_S "glom"
+                                                       G_DIR_SEPARATOR_S "examples");
   g_free(dir);
 
   if(!Glib::file_test(path, Glib::FILE_TEST_EXISTS))
-    path = GLOM_EXAMPLES_DIR;
+    path = GLOM_DOCDIR G_DIR_SEPARATOR_S "examples";
 #else
-  const char* path = GLOM_EXAMPLES_DIR;
+  const char *const path = GLOM_DOCDIR G_DIR_SEPARATOR_S "examples";
 #endif //G_OS_WIN32
 
-  if(!list_examples_at_path(path))
-  {
-    // If that directory did not exist, then try this one instead:
-    // (An Ubuntu package puts the example files here for some reason.
-    // TODO: Find out what Makefile.am variable to use to just use this automatically instead.
-    #ifndef G_OS_WIN32
-    list_examples_at_path(GLOM_EXAMPLES_DIR_ALTERNATIVE);
-    #endif //G_OS_WIN32
-  }
+  list_examples_at_path(path);
 
 #endif //!GLOM_ENABLE_CLIENT_ONLY
 
diff --git a/glom/glade_utils.h b/glom/glade_utils.h
index 1593096..84afbe6 100644
--- a/glom/glade_utils.h
+++ b/glom/glade_utils.h
@@ -39,7 +39,7 @@ inline std::string get_glade_file_path(const std::string& filename)
   g_free(directory);
   return result;
 #else
-  return GLOM_GLADEDIR + filename;
+  return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "glade", filename);
 #endif
 }
 
diff --git a/glom/libglom/connectionpool.cc b/glom/libglom/connectionpool.cc
index 550ec1e..b85008f 100644
--- a/glom/libglom/connectionpool.cc
+++ b/glom/libglom/connectionpool.cc
@@ -26,16 +26,11 @@
 //#include <libgdamm/connectionevent.h>
 #include <glibmm/i18n.h>
 
-#ifndef G_OS_WIN32
+#ifdef G_OS_WIN32
+# include <windows.h>
+#else
 # include <libepc/shell.h> //For epc_shell_set_progress_hooks().
 # include <libepc/publisher.h>
-#else
-// objidl.h, included by windows.h, defines a type called DATADIR, so we need
-// to undef it temporarily.
-# define GLOM_SAVE_DATADIR DATADIR
-# undef DATADIR
-# include <windows.h>
-# define DATADIR GLOM_SAVE_DATADIR
 #endif
 
 #include <signal.h> //To catch segfaults
diff --git a/glom/libglom/connectionpool_backends/postgres_self.cc b/glom/libglom/connectionpool_backends/postgres_self.cc
index 55b7007..472b27d 100644
--- a/glom/libglom/connectionpool_backends/postgres_self.cc
+++ b/glom/libglom/connectionpool_backends/postgres_self.cc
@@ -30,21 +30,14 @@
 
 #include <libglom/gst-package.h>
 
-#ifndef G_OS_WIN32
-#include <sys/types.h>
-#include <sys/socket.h> 
-#include <errno.h>
-
-#include <netinet/in.h> //For sockaddr_in
+#ifdef G_OS_WIN32
+# include <windows.h>
+# include <winsock2.h>
 #else
-
-// This includes objidl.h which has a structure called DATADIR. This fails to
-// compile with the DATADIR define, so undef it for the inclusion.
-#define GLOM_SAVE_DATADIR DATADIR
-#undef DATADIR
-#include <windows.h>
-#include <winsock2.h>
-#define DATADIR GLOM_SAVE_DATADIR
+# include <sys/types.h>
+# include <sys/socket.h> 
+# include <errno.h>
+# include <netinet/in.h> //For sockaddr_in
 #endif
 
 #include <signal.h> //To catch segfaults
diff --git a/glom/libglom/spawn_with_feedback.cc b/glom/libglom/spawn_with_feedback.cc
index e396dc5..eac7ea3 100644
--- a/glom/libglom/spawn_with_feedback.cc
+++ b/glom/libglom/spawn_with_feedback.cc
@@ -31,10 +31,7 @@
 #include <iostream>
 
 #ifdef G_OS_WIN32
-#define SAVE_DATADIR DATADIR
-#undef DATADIR
-#include <windows.h>
-#define DATADIR SAVE_DATADIR
+# include <windows.h>
 #endif
 
 // Uncomment to see debug messages
diff --git a/glom/main.cc b/glom/main.cc
index 2a81f09..384a965 100644
--- a/glom/main.cc
+++ b/glom/main.cc
@@ -18,7 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#include <config.h> //For VERSION.
+#include <config.h>
 
 //We use Python for calculated fields.
 #include <Python.h> //Include it before anything else to avoid "_POSIX_C_SOURCE redefined".
@@ -56,13 +56,10 @@
 #include <glom/glade_utils.h>
 #include <glom/utils_ui.h>
 
-#ifndef G_OS_WIN32
-#include <fontconfig/fontconfig.h> //For cleanup.
-#else
-#define SAVE_DATADIR DATADIR
-#undef DATADIR
+#ifdef G_OS_WIN32
 #include <winsock2.h>
-#define DATADIR SAVE_DATADIR
+#else
+#include <fontconfig/fontconfig.h> //For cleanup.
 #endif
 
 namespace Glom
@@ -305,10 +302,11 @@ main(int argc, char* argv[])
 
 #ifdef G_OS_WIN32
   // Load translations relative to glom.exe on Windows
-  bindtextdomain(GETTEXT_PACKAGE, Glib::build_filename(installation_dir, "share/locale").c_str());
+  bindtextdomain(GETTEXT_PACKAGE,
+      Glib::build_filename(installation_dir, "share" G_DIR_SEPARATOR_S "locale").c_str());
 #else
   //Make this application use the current locale for _() translation:
-  bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);  //LOCALEDIR is defined in the Makefile.am
+  bindtextdomain(GETTEXT_PACKAGE, GLOM_LOCALEDIR);
 #endif
   bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
   textdomain(GETTEXT_PACKAGE);
@@ -370,7 +368,7 @@ main(int argc, char* argv[])
 
   if(group.m_arg_version)
   {
-    std::cout << VERSION << std::endl;
+    std::cout << PACKAGE_STRING << std::endl;
     return 0;
   }
 
@@ -380,7 +378,7 @@ main(int argc, char* argv[])
   {
 #ifndef GLOM_ENABLE_CLIENT_ONLY
     gtksourceview::init();
-    Goocanvas::init(PACKAGE, VERSION, argc, argv ) ;
+    Goocanvas::init(PACKAGE_NAME, PACKAGE_VERSION, argc, argv);
 #endif //!GLOM_ENABLE_CLIENT_ONLY
 
     //Get command-line parameters, if any:
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index a57f8e3..c5e795f 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -344,7 +344,9 @@ void Box_Data_Calendar_Related::on_dialog_layout_hide()
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 Dialog_Layout* Box_Data_Calendar_Related::create_layout_dialog() const
 {
-  Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(GLOM_GLADEDIR "glom_developer.glade", "window_data_layout");
+  Glib::RefPtr<Gtk::Builder> refXml = Gtk::Builder::create_from_file(
+      GLOM_PKGDATADIR G_DIR_SEPARATOR_S "glade" G_DIR_SEPARATOR_S "glom_developer.glade",
+      "window_data_layout");
   if(refXml)
   {
     Dialog_Layout_Calendar_Related* dialog = 0;
diff --git a/glom/mode_design/print_layouts/print_layout_toolbar_button.cc b/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
index 96f9456..8618920 100644
--- a/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
+++ b/glom/mode_design/print_layouts/print_layout_toolbar_button.cc
@@ -29,11 +29,12 @@ std::string get_icon_path(const std::string& filename)
 {
 #ifdef G_OS_WIN32
   gchar* basepath = g_win32_get_package_installation_directory_of_module(NULL);
-  const std::string result = Glib::build_filename(basepath, Glib::build_filename("share/glom/pixmaps", filename));
+  const std::string result = Glib::build_filename(basepath,
+      "share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "pixmaps", filename);
   g_free(basepath);
   return result;
 #else
-  return Glib::build_filename(GLOM_ICON_DIR, filename);
+  return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "pixmaps", filename);
 #endif
 }
 
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index 0276729..da65de9 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -18,6 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <config.h>
 //We need to include this before anything else, to avoid redefinitions:
 #include <libglom/python_embed/py_glom_record.h>
 #include <libglom/python_embed/pygdavalue_conversions.h>
diff --git a/glom/python_embed/python_module/py_glom_module.cc b/glom/python_embed/python_module/py_glom_module.cc
index df944e9..1b97623 100644
--- a/glom/python_embed/python_module/py_glom_module.cc
+++ b/glom/python_embed/python_module/py_glom_module.cc
@@ -18,6 +18,7 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#include <config.h>
 //We need to include this before anything else, to avoid redefinitions:
 #include <Python.h>
 #include <compile.h> /* for the PyCodeObject */
diff --git a/glom/utility_widgets/layouttoolbar.cc b/glom/utility_widgets/layouttoolbar.cc
index 286e3e6..4dffc41 100644
--- a/glom/utility_widgets/layouttoolbar.cc
+++ b/glom/utility_widgets/layouttoolbar.cc
@@ -33,12 +33,13 @@ namespace
 Glib::ustring get_icon_path(const Glib::ustring& filename)
 {
 #ifdef G_OS_WIN32
-  gchar* basepath = g_win32_get_package_installation_directory_of_module(NULL);
-  Glib::ustring result = Glib::build_filename(basepath, Glib::build_filename("share/glom/pixmaps", filename));
+  gchar* basepath = g_win32_get_package_installation_directory_of_module(0);
+  Glib::ustring result = Glib::build_filename(basepath,
+      "share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "pixmaps", filename);
   g_free(basepath);
   return result;
 #else
-  return Glib::build_filename(GLOM_ICON_DIR, filename);
+  return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "pixmaps", filename);
 #endif
 }
 
diff --git a/glom/utility_widgets/layouttoolbarbutton.cc b/glom/utility_widgets/layouttoolbarbutton.cc
index 7968eb9..d7ea4dc 100644
--- a/glom/utility_widgets/layouttoolbarbutton.cc
+++ b/glom/utility_widgets/layouttoolbarbutton.cc
@@ -26,12 +26,13 @@ namespace
 std::string get_icon_path(const std::string& filename)
 {
 #ifdef G_OS_WIN32
-  gchar* basepath = g_win32_get_package_installation_directory_of_module(NULL);
-  const std::string result = Glib::build_filename(basepath, Glib::build_filename("share/glom/pixmaps", filename));
+  gchar* basepath = g_win32_get_package_installation_directory_of_module(0);
+  const std:string result = Glib::build_filename(basepath,
+      "share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "pixmaps", filename);
   g_free(basepath);
   return result;
 #else
-  return Glib::build_filename(GLOM_ICON_DIR, filename);
+  return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "pixmaps", filename);
 #endif
 }
 
diff --git a/glom/utils_ui.cc b/glom/utils_ui.cc
index ad9bca6..00e03af 100644
--- a/glom/utils_ui.cc
+++ b/glom/utils_ui.cc
@@ -130,7 +130,9 @@ void Utils::show_help(const Glib::ustring& id)
 
   try
   {
-    const char* path = DATADIR "/gnome/help/glom";
+    const char *const path = GLOM_DATADIR G_DIR_SEPARATOR_S "gnome"
+                                          G_DIR_SEPARATOR_S "help"
+                                          G_DIR_SEPARATOR_S "glom";
     std::string help_file = locate_help_file(path, "glom.xml");
     if(help_file.empty())
     {
diff --git a/glom/xsl_utils.cc b/glom/xsl_utils.cc
index fddcc2f..c577349 100644
--- a/glom/xsl_utils.cc
+++ b/glom/xsl_utils.cc
@@ -44,26 +44,23 @@
 
 // For ShellExecute:
 #ifdef G_OS_WIN32
-# define GLOM_SAVE_DATADIR DATADIR
-# undef DATADIR
 # include <windows.h>
-# define DATADIR GLOM_SAVE_DATADIR
 #endif
 
 namespace
 {
-	Glib::ustring get_xslt_file(const Glib::ustring& xsl_file)
-	{
+  Glib::ustring get_xslt_file(const Glib::ustring& xsl_file)
+  {
 #ifdef G_OS_WIN32
-		gchar* directory;
-		directory = g_win32_get_package_installation_directory_of_module(NULL);
-		Glib::ustring xsltdir = Glib::build_filename(directory, "share/glom/xslt/" + xsl_file);
-		g_free(directory);
-		return xsltdir;
+    gchar* directory = g_win32_get_package_installation_directory_of_module(0);
+    Glib::ustring xsltdir = Glib::build_filename(directory,
+        "share" G_DIR_SEPARATOR_S "glom" G_DIR_SEPARATOR_S "xslt", xsl_file);
+    g_free(directory);
+    return xsltdir;
 #else
-		return GLOM_XSLTDIR + xsl_file;
+    return Glib::build_filename(GLOM_PKGDATADIR G_DIR_SEPARATOR_S "xslt", xsl_file);
 #endif
-	}
+  }
 }
 
 namespace Glom
diff --git a/macros/mm-pkg.m4 b/macros/mm-pkg.m4
new file mode 100644
index 0000000..fab545b
--- /dev/null
+++ b/macros/mm-pkg.m4
@@ -0,0 +1,40 @@
+## Copyright (c) 2009  Daniel Elstner <daniel kitta gmail com>
+##
+## This file is part of mm-autofu.
+##
+## mm-autofu 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, either version 2 of the License,
+## or (at your option) any later version.
+##
+## mm-autofu 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 mm-autofu.  If not, see <http://www.gnu.org/licenses/>.
+
+#serial 20090710
+
+## MM_PKG_CONFIG_SUBST(variable, arguments, [action-if-found], [action-if-not-found])
+##
+## Run the pkg-config utility with the specified command-line <arguments>
+## and capture its standard output in the named shell <variable>.  If the
+## command exited successfully, execute <action-if-found> in the shell if
+## specified.  If the command failed, run <action-if-not-found> if given,
+## otherwise ignore the error.
+##
+AC_DEFUN([MM_PKG_CONFIG_SUBST],
+[dnl
+m4_assert([$# >= 2])[]dnl
+AC_REQUIRE([PKG_PROG_PKG_CONFIG])[]dnl
+AC_MSG_CHECKING([for $1])
+
+AS_IF([test -z "${$1+set}"],
+      [$1=`$PKG_CONFIG $2 2>&AS_MESSAGE_LOG_FD`
+       AS_IF([test "[$]?" -eq 0], [$3], [$4])])
+
+AC_MSG_RESULT([[$]$1])
+AC_SUBST([$1])[]dnl
+])
diff --git a/macros/mm-python.m4 b/macros/mm-python.m4
new file mode 100644
index 0000000..1b5400e
--- /dev/null
+++ b/macros/mm-python.m4
@@ -0,0 +1,90 @@
+## Copyright (c) 2009  Daniel Elstner <daniel kitta gmail com>
+##
+## This file is part of mm-autofu.
+##
+## mm-autofu 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, either version 2 of the License,
+## or (at your option) any later version.
+##
+## mm-autofu 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 mm-autofu.  If not, see <http://www.gnu.org/licenses/>.
+
+#serial 20090721
+
+## _MM_PYTHON_SYSCONFIG(expression, [action-if-succeeded], [action-if-failed])
+##
+m4_define([_MM_PYTHON_SYSCONFIG],
+[dnl
+mm_val=`$PYTHON -c "dnl
+[import sys; from distutils import sysconfig; sys.stdout.write]dnl
+([sysconfig.]$1)" 2>&AS_MESSAGE_LOG_FD`
+AS_IF([test "[$]?" -eq 0 && test "x$mm_val" != x], [$2], [$3])[]dnl
+])
+
+## MM_CHECK_MODULE_PYTHON
+##
+## Check whether Python is installed, and determine the include path
+## and libraries needed for linking an C or C++ program with Python.
+## The resulting configuration is stored in the PYTHON_CPPFLAGS and
+## PYTHON_LIBS substitution variables.
+##
+AC_DEFUN([MM_CHECK_MODULE_PYTHON],
+[dnl
+AC_REQUIRE([AM_PATH_PYTHON])[]dnl
+dnl
+AC_ARG_VAR([PYTHON_CPPFLAGS], [compiler include flags for Python])[]dnl
+AC_ARG_VAR([PYTHON_LIBS], [linker flags for Python])[]dnl
+dnl
+AC_MSG_CHECKING([for Python headers])
+AS_IF([test "x$PYTHON_CPPFLAGS" = x],
+[
+  _MM_PYTHON_SYSCONFIG([[get_python_inc()]], [PYTHON_CPPFLAGS="-I$mm_val"])
+  _MM_PYTHON_SYSCONFIG([[get_python_inc(True)]],
+  [test "x$PYTHON_CPPFLAGS" = "x-I$mm_val" || PYTHON_CPPFLAGS="$PYTHON_CPPFLAGS -I$mm_val"])
+])
+AC_MSG_RESULT([$PYTHON_CPPFLAGS])
+
+AC_MSG_CHECKING([for Python libraries])
+AS_IF([test "x$PYTHON_LIBS" = x],
+[
+  _MM_PYTHON_SYSCONFIG([[get_config_var('LIBS')]], [PYTHON_LIBS=$mm_val])
+  set X
+  _MM_PYTHON_SYSCONFIG([[EXEC_PREFIX]], [set "[$]@" "$mm_val/lib" "$mm_val/lib64"])
+  _MM_PYTHON_SYSCONFIG([[PREFIX]],      [set "[$]@" "$mm_val/lib" "$mm_val/lib64"])
+  _MM_PYTHON_SYSCONFIG([[get_python_lib(True, True)]],  [set "[$]@" "$mm_val/config" "$mm_val"])
+  _MM_PYTHON_SYSCONFIG([[get_python_lib(False, True)]], [set "[$]@" "$mm_val/config" "$mm_val"])
+  shift
+  mm_pylib=python$PYTHON_VERSION
+  mm_pylib_win=`echo "$mm_pylib" | sed 's/\.//g'`
+
+  for mm_dir
+  do
+    AS_IF([test -f "$mm_dir/lib$mm_pylib.so" || \
+           test -f "$mm_dir/lib$mm_pylib.a"],
+          [AS_CASE([$mm_dir], [/usr/lib|/usr/local/lib],
+                   [PYTHON_LIBS="$PYTHON_LIBS -l$mm_pylib"; break],
+                   [PYTHON_LIBS="$PYTHON_LIBS -L$mm_dir -l$mm_pylib"; break])],
+          [test -f "$mm_dir/lib$mm_pylib_win.dll.a" || \
+           test -f "$mm_dir/lib$mm_pylib_win.a" || \
+           test -f "$mm_dir/$mm_pylib_win.lib"],
+          [PYTHON_LIBS="$PYTHON_LIBS -L$mm_dir -l$mm_pylib_win"; break])
+  done
+])
+AC_MSG_RESULT([$PYTHON_LIBS])
+
+mm_save_CPPFLAGS=$CPPFLAGS
+mm_save_LIBS=$LIBS
+CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
+LIBS="$LIBS $PYTHON_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]],
+                                [[(void) PyImport_ImportModule((char*)"sys");]])],,
+               [AC_MSG_FAILURE([[Failed to compile test program for Python embedding.]])])
+CPPFLAGS=$mm_save_CPPFLAGS
+LIBS=$mm_save_LIBS[]dnl
+])



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