From: Ole Streicher <debian@liska.ath.cx>
Date: Tue, 5 Jul 2016 15:13:46 +0200
Subject: Use standard automake

Do not depend on the starlink's automake, but use their macro file
together with the standard automake
---
 Makefile.am  | 11 ++++++++---
 acinclude.m4 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 configure.ac |  7 +++++--
 3 files changed, 69 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a07c84e..70fc1b3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -651,9 +651,13 @@ lib_LTLIBRARIES = \
     libstarlink_ast_pgplot.la \
     libstarlink_ast_pgplot3d.la
 
-stardocs_DATA = @STAR_LATEX_DOCUMENTATION@
-dist_starnews_DATA = ast.news
-dist_pkgdata_DATA = COPYING COPYING.LESSER COPYING.LIB
+doc:  @STARDOCS@.pdf @STARDOCS@/index.html
+.tex.pdf:
+	pdflatex $^ && pdflatex $^
+
+@STARDOCS@/index.html: @STARDOCS@.tex
+	latex2html -noaddress $^
+	rm -f @STARDOCS@/@STARDOCS@.html @STARDOCS@/WARNINGS
 
 if !NOYAML
 yaml = -DYAML
@@ -849,6 +853,7 @@ endif
 #  Use target install-exec-hook rather than install-exec-local so that the
 #  soft links and files are created *after* the main library has been
 #  installed.
+MANIFEST=/bin/true
 install-exec-hook: libstarlink_ast.la
 	$(mkdir_p) $(DESTDIR)$(libdir)
 	cd $(DESTDIR)$(libdir); \
diff --git a/acinclude.m4 b/acinclude.m4
index 96fb878..661c2ea 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1 +1,56 @@
-m4_define([OVERRIDE_PREFIX],[/usr/local])
+m4_define([OVERRIDE_PREFIX],[/usr/])
+
+AC_DEFUN([STAR_DEFAULTS],[
+
+# Create a PACKAGE_VERSION_INTEGER variable, which contains the
+# package's version number as an integer major*1e6+minor*1e3+release.
+eval [`echo $VERSION | sed -e 's/\([0-9]*\)[^0-9]*\([0-9]*\)[^0-9]*\([0-9]*\).*/PACKAGE_VERSION_MAJOR=\1; PACKAGE_VERSION_MINOR=\2; PACKAGE_VERSION_RELEASE=\3;/'`]
+test -n "$PACKAGE_VERSION_MAJOR"   || PACKAGE_VERSION_MAJOR=0
+test -n "$PACKAGE_VERSION_MINOR"   || PACKAGE_VERSION_MINOR=0
+test -n "$PACKAGE_VERSION_RELEASE" || PACKAGE_VERSION_RELEASE=0
+PACKAGE_VERSION_INTEGER=`expr $PACKAGE_VERSION_MAJOR \* 1000000 + $PACKAGE_VERSION_MINOR \* 1000 + $PACKAGE_VERSION_RELEASE`
+AC_SUBST(PACKAGE_VERSION_MAJOR)
+AC_SUBST(PACKAGE_VERSION_MINOR)
+AC_SUBST(PACKAGE_VERSION_RELEASE)
+AC_SUBST(PACKAGE_VERSION_INTEGER)
+])
+
+# Dummy declaration of starlink intedependencies
+AC_DEFUN([STAR_DECLARE_DEPENDENCIES], [])
+
+#  Perform the check that configures f77.h.in for the return type of REAL
+#  Fortran functions. On 64-bit g77 with f2c compatibility this is double
+#  not float.
+AC_DEFUN([STAR_CNF_F2C_COMPATIBLE], [
+    AC_SUBST([REAL_FUNCTION_TYPE], double)
+])
+
+# Determine the type of Fortran character string lengths.
+AC_DEFUN([STAR_CNF_TRAIL_TYPE], [
+    AC_SUBST([TRAIL_TYPE], int)
+])
+
+#   Declare the message file.
+AC_DEFUN([STAR_MESSGEN], [])
+
+#   Declare the documentation.
+# For Debian, this must be explicitely set in the patched Makefile.am
+# since we don't use Starlink's automake here.
+AC_DEFUN([STAR_LATEX_DOCUMENTATION], [
+    AC_SUBST([STARDOCS], [$1])
+])
+
+
+AC_DEFUN([STAR_PREDIST_SOURCES], [])
+
+AC_DEFUN([STAR_PLATFORM_SOURCES], [
+for _t in $1; do
+    (cd ${srcdir}; rm -f ${_t}; cp -p ${_t}default ${_t})
+done
+])
+
+# We ignor]e any starlinks programs here since we don' install the whole
+# Starlink bootstrap chain.
+AC_DEFUN([STAR_CHECK_PROGS], [])
+
+
diff --git a/configure.ac b/configure.ac
index b73a82c..8e5e560 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,10 @@ AC_SUBST([version_info])
 dnl   Require autoconf-2.50 at least
 AC_PREREQ([2.69])
 dnl   Require Starlink automake
-AM_INIT_AUTOMAKE([1.8.2-starlink subdir-objects])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+# Comment out predistribution sources in Makefile.am
+PREDIST='#'  # safe default
+AC_SUBST(PREDIST)
 
 dnl   Sanity-check: name a file in the source directory
 AC_CONFIG_SRCDIR([ast_link.in])
@@ -288,7 +291,7 @@ int main() {
 #   satisfy these targets, so give a non-null value
 #   for the second argument, to suppress automatic generation of
 #   rules.
-STAR_LATEX_DOCUMENTATION([sun210 sun211], [sun210.pdf sun210.tex sun211.pdf sun211.tex sun210.htx_tar sun211.htx_tar])
+STAR_LATEX_DOCUMENTATION([sun211])
 STAR_PREDIST_SOURCES(sun_master.tex)
 STAR_CHECK_PROGS(star2html)
 STAR_CHECK_PROGS(prolat, sst)   # prolat is part of SST
