From 4a1fce7cc9ea1951d6142eebb8f933afbd792cab Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Wed, 28 Nov 2018 13:30:26 +0000
Subject: [PATCH] Bring argparse to autotools

---
 Makefile.am          |  2 +-
 argparse/Makefile.am | 28 ++++++++++++++++++++++++++++
 configure.ac         |  2 +-
 3 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 argparse/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index b98b855f99..77c9b8e229 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
 ACLOCAL_AMFLAGS = -I m4
 
 # Show the way...
-SUBDIRS = src examples doc tests tools
+SUBDIRS = src argparse examples doc tests tools
 
 # Non-standard files that should be part of the distribution.
 EXTRA_DIST = INSTALL.swift .clang-format format.sh
diff --git a/argparse/Makefile.am b/argparse/Makefile.am
new file mode 100644
index 0000000000..2fa6fb9e9e
--- /dev/null
+++ b/argparse/Makefile.am
@@ -0,0 +1,28 @@
+# This file is part of SWIFT.
+# Copyright (c) 2018 Peter W. Draper (p.w.draper@durham.ac.uk)
+#
+# 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 3 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.  If not, see <http://www.gnu.org/licenses/>.
+
+lib_LTLIBRARIES = libargparse.la
+
+include_HEADERS = argparse.h
+
+AM_SOURCES = argparse.c
+
+# Sources and flags for regular library
+libargparse_la_SOURCES = $(AM_SOURCES)
+libargparse_la_CFLAGS = $(AM_CFLAGS)
+libargparse_la_LDFLAGS = $(AM_LDFLAGS)
+
+EXTRA_DIST = LICENSE README.md
diff --git a/configure.ac b/configure.ac
index 5c46efc1a1..e5afd8e5ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1579,7 +1579,7 @@ AM_CONDITIONAL([HAVE_DOXYGEN], [test "$ac_cv_path_ac_pt_DX_DOXYGEN" != ""])
 
 # Handle .in files.
 AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile doc/Makefile doc/Doxyfile tests/Makefile])
-AC_CONFIG_FILES([tools/Makefile])
+AC_CONFIG_FILES([argparse/Makefile tools/Makefile])
 AC_CONFIG_FILES([tests/testReading.sh], [chmod +x tests/testReading.sh])
 AC_CONFIG_FILES([tests/testActivePair.sh], [chmod +x tests/testActivePair.sh])
 AC_CONFIG_FILES([tests/test27cells.sh], [chmod +x tests/test27cells.sh])
-- 
GitLab