From deadbeefcafe0000deadbeefcafe0000deadbeef Mon Sep 17 00:00:00 2001
From: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Mon, 16 Jun 2008 09:57:54 +0200
Subject: [PATCH] Port buildsystem cleanups to nted-0.25.0

---
 Makefile.am               |   61 ++---
 commands/Makefile.am      |    5 
 configure.in              |  516 ++++++++++++++--------------------------------
 datafiles/Makefile.am     |    2 
 dialogs/Makefile.am       |    5 
 doc/de/Makefile.am        |   55 ----
 doc/docimages/Makefile.am |   26 --
 doc/en/Makefile.am        |   26 --
 doc/it/Makefile.am        |   34 ---
 doc/templates/Makefile.am |   13 -
 doc/translated-manual.mk  |   60 +++++
 doc/um.sed                |    2 
 icons/Makefile.am         |    4 
 mainwindow.cpp            |    7 
 man/Makefile.am           |    8 
 po/ChangeLog              |   12 +
 po/Makefile.am            |   89 -------
 po/Makevars               |   47 ++++
 po/POTFILES.in            |   20 +
 resource.cpp              |    4 
 resource.h                |    2 
 22 files changed, 380 insertions(+), 618 deletions(-)


diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index e69de29..0000000
diff --git a/Makefile.am b/Makefile.am
index 20dd58a..6f2175e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,19 +19,21 @@
 #											#
 #########################################################################################
 
-if MAKE_DOCS
-    DOCSDIR = doc
-endif
+SUBDIRS = commands dialogs icons po datafiles doc man
 
-FREETYPE_INCLUDE = @FREETYPE_INCLUDE@
+dist_doc_DATA =
+dist_doc_DATA += AUTHORS
+dist_doc_DATA += ABOUT_THE_EXAMPLES.TXT
+dist_doc_DATA += FAQ
 
-SUBDIRS = commands dialogs icons po datafiles $(DOCSDIR)  man
-AM_CPPFLAGS = -DVERSION=\"$(VERSION)\" -DDATADIR=\"$(datadir)\" -DLOCALEDIR=\"$(localedir)\" $(FREETYPE_INCLUDE) -I./dialogs -I./commands `pkg-config --cflags cairo gtk+-2.0`
-AM_LDFLAGS =`pkg-config --libs cairo pango gtk+-2.0` -lasound
+AM_CPPFLAGS =
+AM_CPPFLAGS += -DNTED_DOCDIR=\"${docdir}\"
+AM_CPPFLAGS += -DNTED_DATADIR=\"${datarootdir}/${PACKAGE_TARNAME}\"
+AM_CPPFLAGS += -DLOCALEDIR=\"${localedir}\"
+AM_CPPFLAGS += -I$(top_srcdir)/dialogs -I$(top_srcdir)/commands
+AM_CPPFLAGS += $(FT2_CFLAGS) $(CAIRO_CFLAGS) $(GTK_CFLAGS)
 
-if EXTRA_ENV
-MAKE = @MAKE_WITH_ENV@
-endif
+AM_LDFLAGS = $(CAIRO_LIBS) $(PANGO_LIBS) $(GTK_LIBS) -lasound
 
 bin_PROGRAMS = nted
 nted_SOURCES = mainwindow.cpp resource.cpp page.cpp system.cpp staff.cpp \
@@ -41,28 +43,29 @@ nted_SOURCES = mainwindow.cpp resource.cpp page.cpp system.cpp staff.cpp \
 	slur.cpp linepoint.cpp line.cpp crescendo.cpp octavation.cpp \
 	line3.cpp acceleration.cpp freetext.cpp freesign.cpp midiimporter.cpp \
 	instrumenttable.cpp importer.cpp
+nted_SOURCES += acceleration.h beam.h beaming.h chordorrest.h clipboard.h crescendo.h freereplaceable.h freesign.h freetext.h importer.h instrumenttable.h line3.h line.h linepoint.h localization.h mainwindow.h measure.h midiexport.h midiimporter.h musicxmlimport.h note.h octavation.h page.h resource.h slur.h slurpoint.h staff.h system.h temposign.h tuplet.h voice.h volumesign.h
 
-nted_LDADD = commands/libcommands.a dialogs/libdialogs.a 
+nted_LDADD = commands/libcommands.a dialogs/libdialogs.a
 
-distclean: clean
-	rm -f Makefile commands/Makefile datafiles/Makefile dialogs/Makefile icons/Makefile
-	rm -f man/Makefile po/Makefile config.status config.log
-	rm -f doc/Makefile doc/templates/Makefile
-	rm -f doc/docimages/Makefile doc/en/Makefile
-	rm -f doc/de/Makefile
-	rm -f config.sub config.guess
-	rm -f doc/Makefile doc/templates/Makefile 
-	rm -f doc/de/Makefile doc/it/Makefile doc/fr/Makefile
-	rm -f config.h
+cleanup: maintainer-clean cleanup-local
+
+# Clean up all generated files. You can re-create them with autoreconf.
+cleanup-local:
+	find . -name Makefile | xargs rm -f
+	find $(srcdir) -name Makefile.in | xargs rm -f
+	rm -f ./config.status ./config.log
+	cd $(srcdir) && rm -f config.sub config.guess config.rpath
+	cd $(srcdir) && rm -f aclocal.m4 configure config.h.in
+	cd $(srcdir) && rm -f depcomp install-sh missing mkinstalldirs
+	rm -f ./config.h
 	find . -type d -name .deps -exec rm -fr {} \; -prune
 	rm -f stamp-h1
+	rm -rf $(srcdir)/autom4te.cache
+	cd $(srcdir) && rm -rf m4
+	cd $(srcdir)/po && rm -f boldquot.sed en@boldquot.header en@quot.header insert-header.sin quot.sed remove-potcdate.sin Rules-quot
+	cd $(srcdir)/po && rm -f Makefile.in.in Makevars.template
+	cd $(srcdir) && rm -f ABOUT-NLS
 
-cleanup: distclean
-	rm -rf ./autom4te.cache
-	rm -f 1 configure Makefile.in commands/Makefile.in dialogs/Makefile.in icons/Makefile.in
-	rm -f doc/Makefile.in doc/Makefile
-	rm -f doc/templates/Makefile.in doc/docimages/Makefile.in
-	rm -f doc/en/Makefile.in doc/de/Makefile.in doc/it/Makefile.in doc/fr/Makefile.in
-	rm -f doc/de/Makefile.in doc/en/Makefile.in
-	rm -f po/Makefile.in
+ACLOCAL_AMFLAGS = -I m4
 
+EXTRA_DIST = config.rpath INSTALL README
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 4cd84c5..0000000
diff --git a/NEWS b/NEWS
deleted file mode 100644
index e69de29..0000000
diff --git a/aclocal.m4 b/aclocal.m4
deleted file mode 100644
index eb3b99a..0000000
diff --git a/commands/Makefile.am b/commands/Makefile.am
index 2f2fd5c..48823dc 100755
--- a/commands/Makefile.am
+++ b/commands/Makefile.am
@@ -19,9 +19,7 @@
 #											#
 #########################################################################################
 
-FREETYPE_INCLUDE = @FREETYPE_INCLUDE@
-
-AM_CPPFLAGS = $(FREETYPE_INCLUDE) -I.. `pkg-config --cflags cairo gtk+-2.0`
+AM_CPPFLAGS = $(FT2_CFLAGS) -I$(top_srcdir) $(CAIRO_CFLAGS) $(GTK_CFLAGS)
 
 noinst_LIBRARIES = libcommands.a
 libcommands_a_SOURCES = commandhistory.cpp commandlist.cpp notemovecommand.cpp \
@@ -40,3 +38,4 @@ libcommands_a_SOURCES = commandhistory.cpp commandlist.cpp notemovecommand.cpp \
 	changechordorreststatus.cpp changeupbeatcommand.cpp insertfreeplaceablecommand.cpp fixmovedfreeplaceablecommand.cpp \
 	removefreeplaceablecommand.cpp
 
+libcommands_a_SOURCES += addnoteatcommand.h appendnewpagecommand.h appendstaffcommand.h appendsystemcommand.h changechordorrestlength.h changechordorreststatus.h changemeasuretimsigcommand.h changemeasuretypecommand.h changenotehead.h changenotestatus.h changetimsigcommand.h changeupbeatcommand.h changexpositioncommand.h command.h commandhistory.h commandlist.h deletechordcommand.h deletechordorrestgroupcommand.h deletelyricscommand.h deletestaffcommand.h deletesystemcommand.h ereasechordorrestcommand.h ereasenotecommand.h fixmovedfreeplaceablecommand.h getsystemfromnextpagecmmand.h insertchordorrestcommand.h insertchordorrestgroupcommand.h insertfreeplaceablecommand.h insertnewpagecommand.h insertstaffelemcommand.h inserttiedelementcommand.h movechordsandrestscommand.h movechordsandrestsreversecommand.h movespecmeasurecommand.h movesystemcommand.h newlyricscommand.h notemovecommand.h notemoverelativecommand.h paperconfigcommand.h removefreeplaceablecommand.h removelastpagecommand.h removepagecommand.h removestaffelemcommand.h setstaffcontext.h settotupletcommand.h shiftstaffcommand.h tienotescommand.h untieforwardcommand.h
diff --git a/commands/Makefile.in b/commands/Makefile.in
deleted file mode 100644
index 925ff1c..0000000
diff --git a/config.h.in b/config.h.in
deleted file mode 100644
index 8acbf31..0000000
diff --git a/configure b/configure
deleted file mode 100755
index eb57eac..0000000
diff --git a/configure.in b/configure.in
old mode 100755
new mode 100644
index fc98a48..facdd07
--- a/configure.in
+++ b/configure.in
@@ -1,380 +1,192 @@
-AC_INIT(beaming.h)
-AM_INIT_AUTOMAKE(nted, 0.25.0, ja@informatik.tu-chemnitz.de)
-
-stdlibdirs="/usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib /usr/X11/lib /usr/X11R6/lib"
-stdincdirs="/usr/include /usr/local/include  /usr/X11/include /usr/X11R6/lib"
-
-dnl
-dnl FIND_PACKAGE(<name>, <libname>, <includename>,<libdirs>,<incldirs>)
-dnl
-
-AC_DEFUN([FIND_PACKAGE], [
-	echo -n "checking $1... "
-
-	for dir in $4
-	do
-		if test -f $dir/lib$2.so || test -f $dir/lib$2.a
-		then
-			lib_$1=$dir
-			break
-		fi
-	done
-
-	for dir in $5
-	do
-		echo "\n teste $dir/$3"
-		if test -f $dir/$3
-		then
-			inc_$1=$dir
-			break
-		fi
-	done
-	echo "libs in $lib_$1; includes in $inc_$1"
-])
-
-dnl
-dnl AC_NEW_ARG(<arg-name>)
-dnl
-
-AC_DEFUN([AC_NEW_ARG],[
-	AC_ARG_WITH($1-include,[  --with-$1-include=DIR   	$1 headers in DIR])
-	AC_ARG_WITH($1-libs,[  --with-$1-libs=DIR    	$1 libraries in DIR])
-])
-
-dnl
-dnl FIND_CONFIG_FILE(<config_filename>, <dirs>)
-dnl
-
-AC_DEFUN([FIND_CONFIG_FILE],[
-	echo -n "checking $1... "
-
-	for dir in $2
-	do
-		if test -f $dir/$1
-		then
-			conf_dir=$dir
-			break;
-		fi
-	done
-	echo "$dir/$1"
-])
-
-AC_ARG_ENABLE(debug, [  --enable-debug              compile with debugging information], CXXFLAGS="$CXXFLAGS -g")
-AC_ARG_WITH(doc, [  --without-doc              compile without immediate help ])
-
-CXXFLAGS="-Wall -Wwrite-strings $CXXFLAGS"
+dnl To create the build system from this file, run
+dnl   $ autoreconf
+dnl   $ autoreconf -v
+dnl   $ autoreconf -vi
+dnl   $ autoreconf -vis
+dnl   $ autoreconf -vis -Wall
+dnl or something similar.
+dnl To remove the created files again, run
+dnl   $ make cleanup     # if you have a Makefile
+dnl   $ make -f Makefile.am cleanup-local srcdir=. # if there is no local Makefile
+AC_PREREQ(2.61)
+AC_INIT([nted], [0.25.0], [ja@informatik.tu-chemnitz.de], [nted])
+AC_CONFIG_SRCDIR([beaming.h])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([-Wall -Werror 1.10 foreign])
 
 AC_PROG_CXX
 
 AC_PROG_RANLIB
+AS_IF([test "x$RANLIB" = "x:"],
+      [AC_MSG_ERROR([ranlib command not found])])
 
-if test "X$RANLIB" = "X"
-then
-	echo ""
-	echo "no \"ranlib\" command found! Please install!"
-	echo ""
-	exit
-fi
-
-
-
-extra_config_path=0
-gtkcompilecommand="$CXX $CXXFLAGS \`pkg-config --cflags cairo gtk+-2.0\` \`pkg-config --libs cairo gtk+-2.0\` gtktest.c -o gtktest $LDFLAGS"
-dnl if test "X$with_gtk2conf" != "X" -o  \( ! -f /usr/lib/pkgconfig/gtk+-2.0.pc \)
-dnl then
-dnl 	if test "X$with_gtk2conf" = "X"
-dnl 	then 
-dnl 		with_gtk2conf=$stdconfdirs
-dnl 	fi
-dnl 	FIND_CONFIG_FILE(gtk+-2.0.pc, $with_gtk2conf)
-dnl 	
-dnl 	if test "X$conf_dir" = "X"
-dnl 	then
-dnl 		echo ""
-dnl 		echo "gtk-2.x configuration file \"gtk+-2.0.pc\""
-dnl 		echo "not found. Please check whether gtk-2.x is installed."
-dnl 		echo "If you installed \"gtk+-2.0.pc\" in an"
-dnl 		echo "usual directory, please use \"--with-gtk2conf=DIR\""
-dnl 		echo "configure option to point to the directory to \"gtk+-2.0.pc\""
-dnl 		echo ""
-dnl 		exit
-dnl 	fi
-dnl 	extra_config_path=1
-dnl 	gtkcompilecommand="export PKG_CONFIG_PATH=$conf_dir;$CXX $CXXFLAGS\`pkg-config --cflags gtk+-2.0\` \`pkg-config --libs gtk+-2.0\` gtktest.c -o gtktest $LDFLAGS"
-dnl 	MAKE_WITH_ENV="export PKG_CONFIG_PATH=$conf_dir; make"
-dnl fi
+# FIXME: Check that compiler works with these flags
+AC_ARG_ENABLE([debug],
+              [AS_HELP_STRING([--enable-debug],
+                              [compile with debugging information])],
+              [CXXFLAGS="$CXXFLAGS -g"])
 
-AM_CONDITIONAL(EXTRA_ENV, test $extra_config_path -ne 0)
+# FIXME: Check that compiler works with these flags
+CXXFLAGS="-Wall -Wwrite-strings $CXXFLAGS"
 
-rm -f gtktest.c gtktest.o
-cat >gtktest.c << EOF
+# Gettext checks
+ALL_LINGUAS="de es fr hu it nl sv"
+AM_GNU_GETTEXT_VERSION([0.17])
+AM_GNU_GETTEXT([external])
+
+dnl Make sure configure is created only if this macro is available
+m4_pattern_forbid([PKG_CHECK_MODULES])
+
+# Check for libraries
+PKG_CHECK_MODULES([ALSA], [alsa >= 1.0], [], [AC_MSG_ERROR([Make sure the libasound (ALSA) devel package is installed])])
+PKG_CHECK_MODULES([PANGO],      [pango], [], [AC_MSG_ERROR([Make sure the pango devel package is installed])])
+PKG_CHECK_MODULES([CAIRO],      [cairo], [], [AC_MSG_ERROR([Make sure the cairo devel package is installed])])
+PKG_CHECK_MODULES([GTK],     [gtk+-2.0], [], [AC_MSG_ERROR([Make sure the gtk+-2.0 devel package is installed])])
+PKG_CHECK_MODULES([FT2],    [freetype2], [], [AC_MSG_ERROR([Make sure the freetype(2) devel package is installed])])
+
+# Check for gdk-pixbuf-csource program
+AC_ARG_VAR([IMAGE2HEADER], [gdk-pixbuf-csource program])
+AC_PATH_PROG([IMAGE2HEADER], [gdk-pixbuf-csource], [:])
+AS_IF([test "x$IMAGE2HEADER" = "x:"],
+      [AC_MSG_ERROR([
+No gdk-pixbuf-csource command found! It should be part
+of the gtk installation. Please check correct gtk
+installation or change PATH environment variable!
+])])
+
+# Package is written in C++, so do compile tests in C++ as well.
+AC_LANG([C++])
+
+# Define "clean" flags for compilation tests
+empty_LIBS="$LIBS"
+empty_CPPFLAGS="$CPPFLAGS"
+
+# gtk+ compile&link test
+AC_MSG_CHECKING([gtk+ compile and link])
+CPPFLAGS="$empty_CPPFLAGS $GTK_CFLAGS"
+LIBS="$empty_LIBS $GTK_LIBS"
+AC_LINK_IFELSE([AC_LANG_SOURCE([
 #include <gtk/gtk.h>
-
 int main(int argc, char **argv)
 {
 	gtk_init (&argc, &argv);
 	gtk_main ();
 	return 0;
 }
-EOF
-
-echo -n "testing a Gtk program ..."
-eval $gtkcompilecommand  2>&1 >/dev/null
-
-if test $? -ne 0
-then
-	echo ""
-	echo "Cannot compile a simple gtk example!"
-	echo "Please check, why \"gtktest.c\" doesn't compile"
-	echo "unsing the following command:"
-	echo "$gtkcompilecommand"
-	echo ""
-	exit
-fi
-
-echo " ok"
-
-rm -f gtktest gtktest.o gtktest.c core
-#echo "COMPILE: $gtkcompilecommand \`pkg-config --cflags gtk+-2.0\` \`pkg-config --libs gtk+-2.0\` gtktest.c -o gtktest"
-
-IMAGE2HEADER="gdk-pixbuf-csource"
-dnl AC_CHECK_PROGS(IMAGE2HEADER, gdk-pixbuf-csource) 
-
-if test "X$conf_dir" = "X"
-then
-	cairocompilecommand="$CXX $CXXFLAGS \`pkg-config --cflags gtk+-2.0\` \`pkg-config --libs gtk+-2.0\` cairotest.c -o cairotest $LDFLAGS"
-else
-	cairocompilecommand="export PKG_CONFIG_PATH=$conf_dir;$CXX $CXXFLAGS \`pkg-config --cflags gtk+-2.0\` \`pkg-config --libs gtk+-2.0\` cairotest.c -o cairotest $LDFLAGS"
-fi
+])], [AC_MSG_RESULT([ok])], [
+AC_MSG_FAILURE([cannot compile and link gtk example])
+])
 
-rm -f cairotest.c cairotest.o
-cat >cairotest.c << EOF
+# gtk+ and cairo compile&link test
+AC_MSG_CHECKING([gtk+ and cairo compile and link])
+CPPFLAGS="$empty_CPPFLAGS $CAIRO_CFLAGS $GTK_CFLAGS"
+LIBS="$empty_LIBS $CAIRO_LIBS $GTK_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
 #include <gtk/gtk.h>
 #include <cairo.h>
-
-int main(int argc, char **argv)
-{
-	GtkWidget *m_drawing_area;
+],[
+	GtkWidget *m_drawing_area = NULL;
 	cairo_t *cr;
 	cr = gdk_cairo_create (m_drawing_area->window);
-	return 0;
-}
-EOF
-echo -n "testing a Cairo program ..."
-eval $cairocompilecommand  2>&1 >/dev/null
-
-if test $? -ne 0
-then
-	echo ""
-	echo "Cannot compile a simple cairo example!"
-	echo "Please check, why \"cairotest.c\" doesn't compile"
-	echo "unsing the following command:"
-	echo "$cairocompilecommand"
-	echo ""
-	exit
-fi
-
-echo " ok"
-
-rm -f cairotest cairotest.o cairotest.c core
-
-
-AC_CHECK_HEADER([alsa/asoundlib.h], [alsa_head="yes"], [alsa_head="no"])
-
-if test "X$alsa_head" = "Xno"
-then
-	echo ""
-	echo "No \"alsa/asoundlib.h\" found! Please install"
-	echo "the alsa-devel package!"
-	echo ""
-	exit
-fi
-
-alsacompilecommand="$CXX $CXXFLAGS alsatest.c -o alsatest $LDFLAGS -lasound"
+])], [AC_MSG_RESULT([ok])], [
+AC_MSG_FAILURE([Cannot compile and link a simple cairo example!])
+])
 
-rm -f alsatest.c alsatest.o
-cat >alsatest.c << EOF
+# ALSA (libasound) compile&link test
+AC_MSG_CHECKING([asound compile and link])
+CPPFLAGS="$empty_CPPFLAGS $ALSA_CFLAGS"
+LIBS="$empty_LIBS $ALSA_LIBS"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
 #include <alsa/asoundlib.h>
-
-int main(int argc, char **argv)
-{
+],[
 	snd_seq_t *sequ;
 	snd_seq_open(&sequ, "default", SND_SEQ_OPEN_OUTPUT, 0);
 	return 0;
-}
-EOF
-echo -n "testing an ALSA program ..."
-eval $alsacompilecommand  2>&1 >/dev/null
-
-if test $? -ne 0
-then
-	echo ""
-	echo "Cannot compile a simple ALSA example!"
-	echo "Please check, why \"alsatest.c\" doesn't compile"
-	echo "unsing the following command:"
-	echo "$alsacompilecommand"
-	echo ""
-	exit
-fi
-
-echo " ok"
-
-rm -f alsatest alsatest.o alsatest.c core
-
-
-if test "X$IMAGE2HEADER" = "X"
-then
-	echo ""
-	echo "No \"gdk-pixbuf-csource\" command found! It should be part"
-	echo "of the gtk installation. Please check correct gtk"
-	echo "installation or change PATH environment variable!"
-	echo ""
-	exit
-fi
-
-make_docs="yes"
-
-if test "X$with_doc" = "Xno"
-then
-	make_docs="no"
-fi
-
-FIND_PACKAGE([freetype], [freetype], [freetype/freetype.h], [$stdlibdirs], [$stdincdirs /usr/include/freetype2 ])
-
-if test "X$lib_freetype" = "X"
-then
-	echo ""
-	echo "No \"libfreetype\" found. Pleas install!"
-	echo ""
-	exit
-fi
-
-if test "X$inc_freetype" = "X"
-then
-	echo ""
-	echo "No \"freetype\" headers found. Pleas install!"
-	echo "(\"freetype-devel\" on most Linuxes)"
-	echo ""
-	exit
-fi
-
-FREETYPE_INCLUDE="-I$inc_freetype"
-
-AC_PATH_PROGS([YELP],[yelp])
-
-if test "X$YELP" = "X"
-then
-	echo ""
-	echo "No yelp command found! Than means"
-	echo "no online help is available"
-	echo ""
-	make_docs="no"
-fi
-
-AC_PATH_PROGS([XGETTEXT],[xgettext])
-
-if test "X$XGETTEXT" = "X"
-then
-	echo ""
-	echo "No xgettext command found! This can"
-	echo "cause difficulties for extendimng the"
-	echo "internationalization."
-	make_docs="no"
-	echo ""
-fi
-
-AC_PATH_PROGS([PKGCONFIG],[pkg-config])
-if test "X$PKGCONFIG" = "X"
-then
-	echo ""
-	echo "No pkg-config command found!" 
-	echo "Please install!"
-	echo ""
-	exit
-fi
-
-AC_PATH_PROGS([MSGMERGE],[msgmerge])
-
-if test "X$MSGMERGE" = "X"
-then
-	echo ""
-	echo "No msgmerge command found! This can"
-	echo "cause difficulties for extending the"
-	echo "internationalization."
-	make_docs="no"
-	echo ""
-fi
-
-AC_PATH_PROGS([MSGFMT],[msgfmt])
-
-if test "X$MSGFMT" = "X"
-then
-	echo ""
-	echo "No msgfmt command found! This can"
-	echo "cause difficulties for extending the"
-	echo "internationalization."
-	make_docs="no"
-	echo ""
-fi
-
-AC_PATH_PROGS([XML2POT],[xml2pot])
-
-if test "X$XML2POT" = "X"
-then
-	echo ""
-	echo "No xml2pot command found! This can"
-	echo "cause difficulties for extending the"
-	echo "internationalization."
-	make_docs="no"
-	echo ""
-fi
-
-AC_PATH_PROGS([PO2XML],[po2xml])
-
-if test "X$PO2XML" = "X"
-then
-	echo ""
-	echo "No po2xml command found! This can"
-	echo "cause difficulties for extending the"
-	echo "internationalization."
-	make_docs="no"
-	echo ""
-fi
-
-AC_PATH_PROGS([XMLTO],[xmlto])
+])], [AC_MSG_RESULT([ok])],
+[AC_MSG_FAILURE([Cannot compile and link a simple ALSA example!])
+])
 
-if test "X$XMLTO" = "X"
-then
-	echo ""
-	echo "No xmlto command found! This can"
-	echo "cause difficulties for extending the"
-	echo "internationalization."
-	make_docs="no"
-	echo ""
-fi
+# Restore flags after compile&link tests
+CPPFLAGS="$empty_CPPFLAGS"
+LIBS="$empty_LIBS"
+
+
+# ===================================================================
+# Documentation generation checks
+# ===================================================================
+
+AC_ARG_WITH([doc],
+            [AS_HELP_STRING([--without-doc],
+                            [compile without immediate help])])
+
+AS_IF([test "x$with_doc" = "xno"], [make_docs="no"], [make_docs="yes"])
+
+AC_ARG_VAR([YELP], [yelp program])
+AC_PATH_PROG([YELP], [yelp], [:])
+AS_IF([test "x$YELP" = "x:"], [
+make_docs="no"
+AC_MSG_WARN([
+No yelp command found! Than means
+no online help is available
+])])
+
+AC_ARG_VAR([XML2POT], [xml2pot program])
+AC_PATH_PROG([XML2POT], [xml2pot], [:])
+AS_IF([test "x$XML2POT" = "x:"], [
+make_docs="no"
+AC_MSG_WARN([
+No xml2pot command found! This can
+cause difficulties for extending the
+internationalization.
+])])
+
+AC_ARG_VAR([PO2XML], [po2xml program])
+AC_PATH_PROG([PO2XML], [po2xml], [:])
+AS_IF([test "x$PO2XML" = "x:"], [
+make_docs="no"
+AC_MSG_WARN([
+No po2xml command found! This can
+cause difficulties for extending the
+internationalization.
+])])
+
+AC_ARG_VAR([XMLTO], [xmlto program])
+AC_PATH_PROG([XMLTO], [xmlto], [:])
+AS_IF([test "x$XMLTO" = "x:"], [
+make_docs="no"
+AC_MSG_WARN([
+No xmlto command found! This can
+cause difficulties for extending the
+internationalization.
+])])
+
+AC_MSG_CHECKING([whether to make the HTML manuals])
+AC_MSG_RESULT([$make_docs])
 
 AM_CONDITIONAL([MAKE_DOCS], [test "$make_docs" = "yes"])
 
-if test "$make_docs" != "yes"
-then
-	echo ""
-	echo "Note! Because of some missing packages"
-	echo "the documentations are neither produced"
-	echo "nor installed"
-	echo ""
-else
-	AC_DEFINE_UNQUOTED([YELP_PATH], ["$YELP"], [Path to yelp program])
-fi
-
-AC_DEFINE_UNQUOTED([VERSIONSTRING], ["$VERSION"], [The version string])
-
-
-
-AC_SUBST(YELP)
-AC_SUBST(DEBUGFLAG)
-AC_SUBST(IMAGE2HEADER)
-AC_SUBST(FREETYPE_INCLUDE)
-AC_SUBST(MAKE_WITH_ENV)
-AC_CONFIG_HEADERS([config.h])
-AC_OUTPUT([Makefile commands/Makefile dialogs/Makefile icons/Makefile po/Makefile datafiles/Makefile man/Makefile doc/Makefile doc/templates/Makefile 
-	doc/de/Makefile doc/it/Makefile doc/docimages/Makefile doc/en/Makefile])
+AS_IF([test "$make_docs" = "yes"],
+      [AC_DEFINE_UNQUOTED([YELP_PATH], ["$YELP"], [Path to yelp program])],
+      [AC_MSG_WARN([
+Note! Because of some missing packages
+the documentations are neither produced
+nor installed
+])])
+
+
+AC_CONFIG_FILES([
+Makefile
+commands/Makefile
+dialogs/Makefile
+icons/Makefile
+po/Makefile.in
+datafiles/Makefile
+man/Makefile
+doc/Makefile
+doc/templates/Makefile
+doc/de/Makefile
+doc/it/Makefile
+doc/docimages/Makefile
+doc/en/Makefile
+])
+AC_OUTPUT
diff --git a/datafiles/Makefile.am b/datafiles/Makefile.am
index 3a6866c..78c2221 100755
--- a/datafiles/Makefile.am
+++ b/datafiles/Makefile.am
@@ -24,5 +24,5 @@ EXAMPLES = nted/examples/example1.ntd nted/examples/example2.ntd  nted/examples/
 	nted/examples/example7.ntd nted/examples/example8.ntd nted/examples/example9.ntd \
 	nted/examples/example10.ntd nted/examples/example11.ntd
 
-nobase_data_DATA = nted/ntedfont.pfa $(EXAMPLES) applications/nted.desktop
+nobase_dist_data_DATA = nted/ntedfont.pfa $(EXAMPLES) applications/nted.desktop
 
diff --git a/datafiles/Makefile.in b/datafiles/Makefile.in
deleted file mode 100644
index c0de499..0000000
diff --git a/depcomp b/depcomp
deleted file mode 100755
index ca5ea4e..0000000
diff --git a/dialogs/Makefile.am b/dialogs/Makefile.am
index facb995..f7cbf5c 100755
--- a/dialogs/Makefile.am
+++ b/dialogs/Makefile.am
@@ -19,9 +19,7 @@
 #											#
 #########################################################################################
 
-FREETYPE_INCLUDE = @FREETYPE_INCLUDE@
-
-AM_CPPFLAGS = $(FREETYPE_INCLUDE) -I.. `pkg-config --cflags cairo gtk+-2.0`
+AM_CPPFLAGS = $(FT2_CFLAGS) -I$(top_srcdir) $(CAIRO_CFLAGS) $(GTK_CFLAGS)
 
 noinst_LIBRARIES = libdialogs.a
 libdialogs_a_SOURCES = staffcontextdialog.cpp  portchoosedialog.cpp paperconfigdialog.cpp \
@@ -29,3 +27,4 @@ libdialogs_a_SOURCES = staffcontextdialog.cpp  portchoosedialog.cpp paperconfigd
 		keysigdialog.cpp scoreinfodialog.cpp clefconfigdialog.cpp volumedialog.cpp \
 		tempodialog.cpp mutedialog.cpp linesdialog.cpp signsdialog.cpp textdialog.cpp \
 		midiimportdialog.cpp
+libdialogs_a_SOURCES += clefconfigdialog.h insertblockdialog.h keysigdialog.h linesdialog.h measureconfigdialog.h midiimportdialog.h mutedialog.h paperconfigdialog.h portchoosedialog.h printconfigdialog.h scoreinfodialog.h signsdialog.h staffcontextdialog.h tempodialog.h textdialog.h tupletdialog.h volumedialog.h
diff --git a/dialogs/Makefile.in b/dialogs/Makefile.in
deleted file mode 100644
index 9309f5e..0000000
diff --git a/doc/Makefile.in b/doc/Makefile.in
deleted file mode 100644
index 8d8afe2..0000000
diff --git a/doc/de/Makefile.am b/doc/de/Makefile.am
old mode 100755
new mode 100644
index ec50b2e..a8fcf57
--- a/doc/de/Makefile.am
+++ b/doc/de/Makefile.am
@@ -1,55 +1,2 @@
-#########################################################################################
-#											#
-# This program is free software; you can redistribute it and#or modify it under the	#
-# terms of the GNU General Public License as published by the Free Software		#
-# Foundation; either version 2 of the License, or (at your option) any later version.	#
-#											#
-# 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; (See "COPYING"). If not, If not, see <http://www.gnu.org/licenses/>.         #
-#											#
-#---------------------------------------------------------------------------------------#
-#											#
-# Copyright	Joerg Anders, TU Chemnitz, Fakultaet fuer Informatik, GERMANY		#
-#		ja@informatik.tu-chemnitz.de						#
-#											#
-#											#
-#########################################################################################
-
-MSGMERGE = @MSGMERGE@
-MEINPROC = @MEINPROC@
-XMLTO = @XMLTO@
-MKINSTALLDIRS = ../../mkinstalldirs
-
 LANGUAGE = de
-
-all: index.docbook index.html
-
-index.docbook: ../en/index.docbook $(LANGUAGE).po
-	rm -f index.docbook
-	$(PO2XML) ../en/index.docbook $(LANGUAGE).po >index.docbook
-
-index.html: index.docbook
-	$(XMLTO) html index.docbook
-
-$(LANGUAGE).po: ../templates/nted.pot ../en/index.docbook
-	rm -f xx.po
-	$(MSGMERGE) $(LANGUAGE).po ../templates/nted.pot > xx.po
-	mv xx.po $(LANGUAGE).po
-
-install: index.docbook index.html
-#	$(MKINSTALLDIRS) $(datadir)/doc/nted/HTML/$(LANGUAGE)
-	$(INSTALL) -D -m "u=rw,og=r" index.docbook $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/index.docbook
-	@-for i in *.html; \
-	do \
-		$(INSTALL) -D -m "u=rw,og=r" $$i $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/$$i; \
-	done
-
-uninstall:
-	rm -f $(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/*
-
-clean:
-	rm -f *.html index.docbook
+include $(srcdir)/../translated-manual.mk
diff --git a/doc/de/Makefile.in b/doc/de/Makefile.in
deleted file mode 100644
index 33f2cc3..0000000
diff --git a/doc/de/de.po b/doc/de/de.po
index 4fba5f7..7740a8c 100644
diff --git a/doc/docimages/Makefile.am b/doc/docimages/Makefile.am
index 29240c4..3bbe5bb 100755
--- a/doc/docimages/Makefile.am
+++ b/doc/docimages/Makefile.am
@@ -19,23 +19,17 @@
 #											#
 #########################################################################################
 
-MSGMERGE = @MSGMERGE@
-MEINPROC = @MEINPROC@
-XMLTO = @XMLTO@
-MKINSTALLDIRS = ../../mkinstalldirs
+dist-hook::
+	cp -p $(srcdir)/*.png $(distdir)/
 
-LANGUAGE = en
+if MAKE_DOCS
 
-all:
+install-data-local:
+	$(INSTALL) -d -m 0755 $(DESTDIR)/$(docdir)/HTML/docimages; \
+	$(INSTALL) -m 0644 $(srcdir)/*.png $(DESTDIR)/$(docdir)/HTML/docimages/
 
-install: 
-#	$(MKINSTALLDIRS) $(datadir)/doc/nted/HTML/docimages
-	@-for i in *.png; \
-	do \
-		$(INSTALL) -D -m "u=rw,og=r" $$i $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/docimages/$$i; \
-	done
+uninstall-local:
+	rm -f $(DESTDIR)/$(docdir)/HTML/docimages/*
+	rmdir $(DESTDIR)/$(docdir)/HTML/docimages
 
-uninstall:
-	rm -f $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/docimages/*
-
-clean:
+endif
diff --git a/doc/docimages/Makefile.in b/doc/docimages/Makefile.in
deleted file mode 100644
index cb9089c..0000000
diff --git a/doc/en/Makefile.am b/doc/en/Makefile.am
index 78ef405..14cdb2a 100755
--- a/doc/en/Makefile.am
+++ b/doc/en/Makefile.am
@@ -19,28 +19,24 @@
 #											#
 #########################################################################################
 
-MSGMERGE = @MSGMERGE@
-MEINPROC = @MEINPROC@
-XMLTO = @XMLTO@
-MKINSTALLDIRS = ../../mkinstalldirs
-
 LANGUAGE = en
 
-all: index.html
+all-local: index.html
+
+EXTRA_DIST = index.docbook
 
-index.html:
-	$(XMLTO) html index.docbook
+index.html: index.docbook
+	$(XMLTO) html $(srcdir)/index.docbook
 
-install: index.docbook index.html
-#	$(MKINSTALLDIRS) $(datadir)/doc/nted/HTML/$(LANGUAGE)
-	$(INSTALL) -D -m "u=rw,og=r" index.docbook $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/index.docbook
+install-data-local: index.docbook index.html
+	$(INSTALL) -D -m "u=rw,og=r" $(srcdir)/index.docbook $(DESTDIR)$(docdir)/HTML/$(LANGUAGE)/index.docbook
 	@-for i in *.html; \
 	do \
-		$(INSTALL) -D -m "u=rw,og=r" $$i $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/$$i; \
+		$(INSTALL) -D -m "u=rw,og=r" $$i $(DESTDIR)$(docdir)/HTML/$(LANGUAGE)/$$i; \
 	done
 
-uninstall:
-	rm -f $(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/*
+uninstall-local:
+	rm -f $(DESTDIR)$(docdir)/HTML/$(LANGUAGE)/*
 
-clean:
+clean-local:
 	rm -f *.html
diff --git a/doc/en/Makefile.in b/doc/en/Makefile.in
deleted file mode 100644
index ff312e7..0000000
diff --git a/doc/it/Makefile.am b/doc/it/Makefile.am
index d849ff8..9c4278f 100755
--- a/doc/it/Makefile.am
+++ b/doc/it/Makefile.am
@@ -19,37 +19,5 @@
 #											#
 #########################################################################################
 
-MSGMERGE = @MSGMERGE@
-MEINPROC = @MEINPROC@
-XMLTO = @XMLTO@
-MKINSTALLDIRS = ../../mkinstalldirs
-
 LANGUAGE = it
-
-all: index.docbook index.html
-
-index.docbook: ../en/index.docbook $(LANGUAGE).po
-	rm -f index.docbook
-	$(PO2XML) ../en/index.docbook $(LANGUAGE).po >index.docbook
-
-index.html: index.docbook
-	$(XMLTO) html index.docbook
-
-$(LANGUAGE).po: ../templates/nted.pot ../en/index.docbook
-	rm -f xx.po
-	$(MSGMERGE) $(LANGUAGE).po ../templates/nted.pot > xx.po
-	mv xx.po $(LANGUAGE).po
-
-install: index.docbook index.html
-#	$(MKINSTALLDIRS) $(datadir)/doc/nted/HTML/$(LANGUAGE)
-	$(INSTALL) -D -m "u=rw,og=r" index.docbook $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/index.docbook
-	@-for i in *.html; \
-	do \
-		$(INSTALL) -D -m "u=rw,og=r" $$i $(DESTDIR)/$(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/$$i; \
-	done
-
-uninstall:
-	rm -f $(datadir)/doc/nted-$(VERSION)/$(LANGUAGE)/*
-
-clean:
-	rm -f *.html index.docbook
+include $(srcdir)/../translated-manual.mk
diff --git a/doc/it/Makefile.in b/doc/it/Makefile.in
deleted file mode 100644
index c525160..0000000
diff --git a/doc/it/it.po b/doc/it/it.po
index eaf643c..e5cfdce 100644
diff --git a/doc/templates/Makefile.am b/doc/templates/Makefile.am
index e893531..6aa6b7e 100755
--- a/doc/templates/Makefile.am
+++ b/doc/templates/Makefile.am
@@ -19,13 +19,14 @@
 #											#
 #########################################################################################
 
-XML2POT = @XML2POT@
+CLEANFILES = nted.pot
 
-all: nted.pot
+if MAKE_DOCS
 
-nted.pot:
-	rm -f nted.pot
-	$(XML2POT) ../en/index.docbook >nted.pot
+noinst_DATA = nted.pot
 
-clean:
+nted.pot: ../en/index.docbook
 	rm -f nted.pot
+	$(XML2POT) $(srcdir)/../en/index.docbook > nted.pot
+
+endif
diff --git a/doc/templates/Makefile.in b/doc/templates/Makefile.in
deleted file mode 100644
index 712a486..0000000
diff --git a/doc/translated-manual.mk b/doc/translated-manual.mk
new file mode 100755
index 0000000..e14394a
--- /dev/null
+++ b/doc/translated-manual.mk
@@ -0,0 +1,60 @@
+#########################################################################################
+#											#
+# This program is free software; you can redistribute it and#or modify it under the	#
+# terms of the GNU General Public License as published by the Free Software		#
+# Foundation; either version 2 of the License, or (at your option) any later version.	#
+#											#
+# 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; (See "COPYING"). If not, If not, see <http://www.gnu.org/licenses/>.         #
+#											#
+#---------------------------------------------------------------------------------------#
+#											#
+# Copyright	Joerg Anders, TU Chemnitz, Fakultaet fuer Informatik, GERMANY		#
+#		ja@informatik.tu-chemnitz.de						#
+#											#
+#											#
+#########################################################################################
+
+EXTRA_DIST = $(LANGUAGE).po
+
+if MAKE_DOCS
+
+all-local: index.docbook index.html
+
+index.docbook: ../en/index.docbook $(LANGUAGE).po
+	$(PO2XML) $(srcdir)/../en/index.docbook $(srcdir)/$(LANGUAGE).po >index.docbook
+
+index.html: index.docbook
+	$(XMLTO) html index.docbook
+
+../templates/nted.pot:
+	cd ../templates && $(MAKE) nted.pot
+
+$(srcdir)/$(LANGUAGE).po: ../templates/nted.pot ../en/index.docbook
+	$(MSGMERGE) $(srcdir)/$(LANGUAGE).po ../templates/nted.pot > xx.po
+	@if cmp xx.po $(srcdir)/$(LANGUAGE).po > /dev/null; then \
+		rm -f $(srcdir)/$(LANGUAGE).po; \
+		echo mv -f xx.po $(srcdir)/$(LANGUAGE).po; \
+		mv -f xx.po $(srcdir)/$(LANGUAGE).po; \
+	else \
+		rm -f xx.po; \
+	fi
+
+install-data-local: index.docbook index.html
+	$(INSTALL) -D -m "u=rw,og=r" index.docbook $(DESTDIR)$(docdir)/HTML/$(LANGUAGE)/index.docbook
+	@-for i in *.html; \
+	do \
+		$(INSTALL) -D -m "u=rw,og=r" $$i $(DESTDIR)$(docdir)/HTML/$(LANGUAGE)/$$i; \
+	done
+
+uninstall-local:
+	rm -f $(DESTDIR)$(docdir)/HTML/$(LANGUAGE)/*
+
+endif
+
+clean-local:
+	rm -f *.html index.docbook
diff --git a/doc/um.sed b/doc/um.sed
deleted file mode 100644
index b6aa22d..0000000
--- a/doc/um.sed
+++ /dev/null
@@ -1,2 +0,0 @@
-s/<div class="bannerBottomLeft">.*/<\/body><\/html>/
-/Send feedback to the <a href="mailto:kde-docs@kdemail.net"/d
diff --git a/gettext.h b/gettext.h
new file mode 100644
index 0000000..209921e
diff --git a/icons/Makefile.am b/icons/Makefile.am
index 55edab0..6cc477d 100755
--- a/icons/Makefile.am
+++ b/icons/Makefile.am
@@ -36,11 +36,11 @@ PNGS = n32ndnote_icon.png  n64thnote_icon.png  eightnote_icon.png  fullnote_icon
 	trill_icon.png prall_icon.png open_icon.png mordent_icon.png staccatissimo_icon.png \
 	lines.png signs.png fermata_icon.png arpeggio_icon.png nted.png key_icon.png \
 	nted.png
-
+EXTRA_DIST = $(PNGS)
 
 
 icondir = $(datadir)/pixmaps
-icon_DATA = nted.png
+dist_icon_DATA = nted.png
 
 IMAGE2HEADER = @IMAGE2HEADER@
 PIXMAPHEADERS = $(PNGS:.png=.h)
diff --git a/icons/Makefile.in b/icons/Makefile.in
deleted file mode 100644
index 67d8fad..0000000
diff --git a/install-sh b/install-sh
deleted file mode 100755
index 4fbbae7..0000000
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 6c039b6..280d45e 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -3831,7 +3831,7 @@ void NedMainWindow::show_about(GtkWidget *widget, void *data) {
 		GTK_BUTTONS_OK,
 		_("NtEd version %s by Joerg Anders\nSend bug reports to ja@informatik.tu-chemnitz.de\n"
 		"Infos at http://vsr.informatik.tu-chemnitz.de/staff/jan/nted/nted.xhtml\n"
-		"Translation: <no translation>"), VERSIONSTRING);
+		"Translation: <no translation>"), PACKAGE_VERSION);
 	gtk_dialog_run (GTK_DIALOG (about_dialog));
 	gtk_widget_destroy (about_dialog);	
 }
@@ -3849,6 +3849,7 @@ void NedMainWindow::show_docu(GtkWidget *widget, void *data) {
 	switch (fork()) {
 		case 0: 
 			sprintf(arg, "ghelp:%s", main_window->m_docu);
+			fprintf(stderr, "YELP_PATH: %s\narg: %s\n", YELP_PATH, arg);
 			if (execl(YELP_PATH, YELP_PATH, arg, NULL) < 0) {
 				perror("execl");
 				NedResource::Info(_("Excuse! Cannot exec"));
@@ -7491,14 +7492,14 @@ int main (int argc, char **argv)
 #ifdef YELP_PATH
 	langnames = g_get_language_names ();
 	for (cptr = langnames; *cptr != NULL; cptr++) {
-		sprintf(Str, "%s/doc/nted-%s/%s/index.docbook", DATADIR, VERSION, *cptr);
+		sprintf(Str, "%s/HTML/%s/index.docbook", NTED_DOCDIR, *cptr);
 		if (!access(Str, R_OK)) {
 			yelparg = strdup(Str);
 			break;
 		}
 	}
 	if (yelparg == NULL) {
-		sprintf(Str, "%s/doc/nted-%s/en/index.docbook", DATADIR, VERSION);
+		sprintf(Str, "%s/HTML/en/index.docbook", NTED_DOCDIR);
 		if (!access(Str, R_OK)) {
 			yelparg = strdup(Str);
 		}
diff --git a/man/Makefile.am b/man/Makefile.am
index da90da3..3ed0d3b 100755
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -19,10 +19,4 @@
 #											#
 #########################################################################################
 
-man1_MANS = nted.1
-
-clean:
-
-distclean:
-
-cleanup:
+dist_man1_MANS = nted.1
diff --git a/man/Makefile.in b/man/Makefile.in
deleted file mode 100644
index 5056237..0000000
diff --git a/missing b/missing
deleted file mode 100755
index 1c8ff70..0000000
diff --git a/mkinstalldirs b/mkinstalldirs
deleted file mode 100755
index 63bac63..0000000
diff --git a/po/ChangeLog b/po/ChangeLog
new file mode 100644
index 0000000..a048fca
--- /dev/null
+++ b/po/ChangeLog
@@ -0,0 +1,12 @@
+2008-06-10  gettextize  <bug-gnu-gettext@gnu.org>
+
+	* Makefile.in.in: New file, from gettext-0.17.
+	* boldquot.sed: New file, from gettext-0.17.
+	* en@boldquot.header: New file, from gettext-0.17.
+	* en@quot.header: New file, from gettext-0.17.
+	* insert-header.sin: New file, from gettext-0.17.
+	* quot.sed: New file, from gettext-0.17.
+	* remove-potcdate.sin: New file, from gettext-0.17.
+	* Rules-quot: New file, from gettext-0.17.
+	* POTFILES.in: New file.
+
diff --git a/po/Makefile.am b/po/Makefile.am
deleted file mode 100755
index 7f2728e..0000000
--- a/po/Makefile.am
+++ /dev/null
@@ -1,89 +0,0 @@
-#########################################################################################
-#											#
-# This program is free software; you can redistribute it and#or modify it under the	#
-# terms of the GNU General Public License as published by the Free Software		#
-# Foundation; either version 2 of the License, or (at your option) any later version.	#
-#											#
-# 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; (See "COPYING"). If not, If not, see <http://www.gnu.org/licenses/>.         #
-#											#
-#---------------------------------------------------------------------------------------#
-#											#
-# Copyright	Joerg Anders, TU Chemnitz, Fakultaet fuer Informatik, GERMANY		#
-#		ja@informatik.tu-chemnitz.de						#
-#											#
-#											#
-#########################################################################################
-
-XGETTEXT = @XGETTEXT@
-MSGMERGE = @MSGMERGE@
-MSGFMT = @MSGFMT@
-
-P_TEMPLATE = nted.pot
-
-GETTEXT_OPTS =  --default-domain="nted" --keyword=_ \
-		--flag=_:1:pass-c-format --keyword=N_ \
-		--flag=N_:1:pass-c-format
-
-MKINSTALLDIRS = ../mkinstalldirs
-
-LINGUAS = de es nl it sv hu fr
-STRINGSOURCES = ../mainwindow.cpp ../resource.cpp ../dialogs/paperconfigdialog.cpp  ../dialogs/portchoosedialog.cpp \
-		../dialogs/printconfigdialog.cpp  ../dialogs/staffcontextdialog.cpp ../dialogs/tupletdialog.cpp \
-		../dialogs/insertblockdialog.cpp ../dialogs/measureconfigdialog.cpp ../dialogs/keysigdialog.cpp \
-		../dialogs/scoreinfodialog.cpp ../dialogs/clefconfigdialog.cpp ../dialogs/volumedialog.cpp \
-		../dialogs/tempodialog.cpp ../dialogs/mutedialog.cpp ../dialogs/linesdialog.cpp ../dialogs/textdialog.cpp \
-		../dialogs/signsdialog.cpp ../dialogs/midiimportdialog.cpp
-
-POTFILES = $(LINGUAS:=.po)
-GMOFILES = $(LINGUAS:=.gmo)
-
-SUFFIXES: .po .gmo
-
-.po.gmo:
-	$(MSGFMT) $< -o $@
-
-all:  $(GMOFILES)
-
-merge: $(POTFILES) nted.pot
-	@for i in $(LINGUAS); \
-	do \
-		if test -f $$i.po; \
-		then \
-			$(MSGMERGE) $$i.po $(P_TEMPLATE) > $$i.po.new; \
-			mv $$i.po.new $$i.po; \
-		else \
-			cp $(P_TEMPLATE) $$i.po; \
-		fi; \
-	done
-
-gmo: $(GMOFILES) $(POFILES)
-	
-
-nted.pot: $(STRINGSOURCES)
-	$(XGETTEXT) $(GETTEXT_OPTS) -o nted.pot $(STRINGSOURCES)
-
-
-install: $(GMOFILES)
-	@-for i in $(LINGUAS); \
-	do \
-		$(MKINSTALLDIRS) $(localedir)/$$i/LC_MESSAGES; \
-		$(INSTALL) -D -m "u=rw,og=r" $$i.gmo $(DESTDIR)/$(localedir)/$$i/LC_MESSAGES/nted.mo; \
-	done
-
-uninstall:
-	@-for i in $(LINGUAS); \
-	do \
-		rm $(DESTDIR)/$(localedir)/$$i/LC_MESSAGES/nted.mo; \
-	done
-
-clean:
-	rm -f $(GMOFILES)
-
-distclean:
-
-cleanup:
diff --git a/po/Makefile.in b/po/Makefile.in
deleted file mode 100644
index 1fa6895..0000000
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..d7e7ca6
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,47 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# The old NtEd Makefile.am had these params to gettext:
+#   --default-domain="nted"  --keyword=_ \
+#   --flag=_:1:pass-c-format --keyword=N_ \
+#   --flag=N_:1:pass-c-format
+# TBD: Do we need to port any of these?
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
+# package.  (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.)  Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright.  The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Joerg Anders
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+#   in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+#   understood.
+# - Strings which make invalid assumptions about notation of date, time or
+#   money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = ja@informatik.tu-chemnitz.de
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used.  It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..baba2a7
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,20 @@
+# List of source files which contain translatable strings.
+mainwindow.cpp
+resource.cpp
+dialogs/paperconfigdialog.cpp
+dialogs/portchoosedialog.cpp
+dialogs/printconfigdialog.cpp
+dialogs/staffcontextdialog.cpp
+dialogs/tupletdialog.cpp
+dialogs/insertblockdialog.cpp
+dialogs/measureconfigdialog.cpp
+dialogs/keysigdialog.cpp
+dialogs/scoreinfodialog.cpp
+dialogs/clefconfigdialog.cpp
+dialogs/volumedialog.cpp
+dialogs/tempodialog.cpp
+dialogs/mutedialog.cpp
+dialogs/linesdialog.cpp
+dialogs/textdialog.cpp
+dialogs/signsdialog.cpp
+dialogs/midiimportdialog.cpp
diff --git a/po/de.gmo b/po/de.gmo
deleted file mode 100644
index 1a11c17..0000000
Binary files a/po/de.gmo and /dev/null differ
diff --git a/po/de.po b/po/de.po
index b8ea670..903b55e 100644
diff --git a/po/es.gmo b/po/es.gmo
deleted file mode 100644
index 5e9bf21..0000000
Binary files a/po/es.gmo and /dev/null differ
diff --git a/po/es.po b/po/es.po
index 279da35..e414be6 100644
diff --git a/po/fr.gmo b/po/fr.gmo
deleted file mode 100644
index 7d74044..0000000
Binary files a/po/fr.gmo and /dev/null differ
diff --git a/po/fr.po b/po/fr.po
index cbb88c8..abd3013 100644
diff --git a/po/hu.gmo b/po/hu.gmo
deleted file mode 100644
index 501a441..0000000
Binary files a/po/hu.gmo and /dev/null differ
diff --git a/po/hu.po b/po/hu.po
index 292d7a0..ccb13b7 100644
diff --git a/po/it.gmo b/po/it.gmo
deleted file mode 100644
index 9a7e80a..0000000
Binary files a/po/it.gmo and /dev/null differ
diff --git a/po/it.po b/po/it.po
index 08d5167..43bd643 100644
diff --git a/po/nl.gmo b/po/nl.gmo
deleted file mode 100644
index 6846560..0000000
Binary files a/po/nl.gmo and /dev/null differ
diff --git a/po/nl.po b/po/nl.po
index c9e6a2d..92bca6c 100644
diff --git a/po/nted.pot b/po/nted.pot
deleted file mode 100644
index 251835d..0000000
diff --git a/po/sv.gmo b/po/sv.gmo
deleted file mode 100644
index 363a86b..0000000
Binary files a/po/sv.gmo and /dev/null differ
diff --git a/po/sv.po b/po/sv.po
index 94331ac..9bd18c9 100644
diff --git a/resource.cpp b/resource.cpp
index f2a6b1c..f88e206 100644
--- a/resource.cpp
+++ b/resource.cpp
@@ -240,7 +240,7 @@ unsigned long long NedResource::m_accel_midi_end;
 double NedResource::m_accel_start_tempoinverse;
 double NedResource::m_accel_end_tempoinverse;
 
-const char *NedResource::m_last_folder = DATADIR "/nted/examples";
+const char *NedResource::m_last_folder = NTED_DATADIR "/examples";
 char *NedResource::m_last_xml_dir = NULL;
 char *NedResource::m_last_midi_dir = NULL;
 
@@ -354,7 +354,7 @@ void NedResource::initialize() {
 	
 	fontdir = getenv("NTED_FONT_DIR");
 	if (fontdir == NULL) {
-		fontdir = DATADIR;
+		fontdir = NTED_DATADIR;
 	}
 	if ((m_font_file_name = (char *) malloc(strlen(fontdir) + strlen(FONTFILE) + 10)) == NULL) {
 		Abort("malloc error");
diff --git a/resource.h b/resource.h
index 382aed0..22d28e7 100644
--- a/resource.h
+++ b/resource.h
@@ -28,7 +28,7 @@
 #include <cairo.h>
 #include <alsa/asoundlib.h>
 
-#define FONTFILE "nted/ntedfont.pfa"
+#define FONTFILE "ntedfont.pfa"
 
 #define WIDTH 1023
 #define HEIGHT 767
