From eb8d2f5b9ebbe64ef974ba567cb252c926766ce1 Mon Sep 17 00:00:00 2001
From: Thomas Kuehne <thomas@kuehne.cn>
Date: Dec 12 2021 08:48:22 +0000
Subject: [PATCH 1/4] cleanup configure.ac


Signed-off-by: Thomas Kuehne <thomas@kuehne.cn>

---

diff --git a/configure.ac b/configure.ac
index a9c66a8..b24dac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,11 @@
-AC_INIT([newt_pr.h])
+AC_INIT
+AC_CONFIG_SRCDIR([newt_pr.h])
 
 PACKAGE=newt
 VERSION=0.52.21
 SONAME=0.52
 
-AC_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
 
 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Package Name])
 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [NEWT Version String])

From fb856fc54ee105fd472b2b3930d3578d33e96cff Mon Sep 17 00:00:00 2001
From: Thomas Kuehne <thomas@kuehne.cn>
Date: Dec 12 2021 09:06:03 +0000
Subject: [PATCH 2/4] add missing AC_PROG_[...] to configure.ac


fixes:
configure.ac: warning: missing AC_PROG_CPP wanted by: Makefile.in:5
configure.ac: warning: missing AC_PROG_INSTALL wanted by: Makefile.in:138
configure.ac: warning: missing AC_PROG_MAKE_SET wanted by: Makefile.in:144

Signed-off-by: Thomas Kuehne <thomas@kuehne.cn>

---

diff --git a/configure.ac b/configure.ac
index b24dac8..2e85cd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,9 @@ AC_SUBST([SONAME])
 AC_PROG_CC
 AC_PROG_LN_S
 AC_PROG_GREP
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
 AC_SYS_LARGEFILE
 
 AC_CHECK_SIZEOF([long])

From 161b789c1f0dd4ce4ce4d42d852b54ffc89fdc3e Mon Sep 17 00:00:00 2001
From: Thomas Kuehne <thomas@kuehne.cn>
Date: Dec 12 2021 09:19:57 +0000
Subject: [PATCH 3/4] Swap order of LDFLAGS and P*FLAGS


apply gentoo fix newt-0.52.21-makefile-LDFLAGS-ordering.patch :

From 22d44d2cbfcbec216d0028ebdf274247139a8045 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 14 Jul 2021 05:12:32 +0100
Subject: [PATCH] Swap order of LDFLAGS and P*FLAGS

Needed to respect as-needed.

Bug: https://bugs.gentoo.org/798945

---

diff --git a/Makefile.in b/Makefile.in
index 3502a4c..366776f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -97,8 +97,8 @@ _snack.$(SOEXT):   snack.c $(LIBNEWTSH)
 		PLFLAGS=`$$pyconfig --libs`; \
 		echo $(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
 		$(CC) $(SHCFLAGS) $(CFLAGS) $(CPPFLAGS) $$PIFLAGS $$PCFLAGS -c -o $$ver/snack.o snack.c; \
-		echo $(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L.  -lnewt $(LIBS); \
-		$(CC) --shared $$PLDFLAGS $$PLFLAGS $(LDFLAGS) -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L.  -lnewt $(LIBS); \
+		echo $(CC) --shared $(LDFLAGS) $$PLDFLAGS $$PLFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L.  -lnewt $(LIBS); \
+		$(CC) --shared $(LDFLAGS) $$PLDFLAGS $$PLFLAGS -o $$ver/_snack.$(SOEXT) $$ver/snack.o -L.  -lnewt $(LIBS); \
 	done || :
 	touch $@
 

From 3f524c76fa717e1cda1a9a463431a05ce356e4c5 Mon Sep 17 00:00:00 2001
From: Thomas Kuehne <thomas@kuehne.cn>
Date: Dec 12 2021 09:31:44 +0000
Subject: [PATCH 4/4] cleanup command substitution in configure.ac


replace backquoted command substitution `cmd` with clean $(cmd)

Signed-off-by: Thomas Kuehne <thomas@kuehne.cn>

---

diff --git a/configure.ac b/configure.ac
index 2e85cd2..6f1c97a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,9 +25,9 @@ AC_CHECK_SIZEOF([void *])
 
 # Are we using GNU ld?
 AC_MSG_CHECKING([for GNU ld])
-LD=`$CC -print-prog-name=ld 2>&5`
+LD=$($CC -print-prog-name=ld 2>&5)
 
-if test `$LD -v 2>&1 | $ac_cv_path_GREP -c "GNU ld"` = 0; then
+if test $($LD -v 2>&1 | $ac_cv_path_GREP -c "GNU ld") = 0; then
   # Not
   GNU_LD=""
   AC_MSG_RESULT([no])
@@ -86,20 +86,20 @@ else
 
   # check in a few common install locations
   if test x"${ac_cv_c_tclconfig}" = x ; then
-    for i in `ls -d ${libdir} 2>/dev/null` \
-      `ls -d /usr/lib 2>/dev/null` \
-      `ls -d /usr/lib64 2>/dev/null` \
-      `ls -d /usr/local/lib 2>/dev/null` \
-      `ls -d /usr/contrib/lib 2>/dev/null` \
-      `ls -d /usr/pkg/lib 2>/dev/null` \
-      `ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
-      `ls -d /usr/local/lib/tcl8.4 2>/dev/null` \
-      `ls -d /usr/lib/tcl8.5 2>/dev/null` \
-      `ls -d /usr/lib/tcl8.4 2>/dev/null` \
-      `ls -d /opt/local/lib 2>/dev/null` \
+    for i in $(ls -d ${libdir} 2>/dev/null) \
+      $(ls -d /usr/lib 2>/dev/null) \
+      $(ls -d /usr/lib64 2>/dev/null) \
+      $(ls -d /usr/local/lib 2>/dev/null) \
+      $(ls -d /usr/contrib/lib 2>/dev/null) \
+      $(ls -d /usr/pkg/lib 2>/dev/null) \
+      $(ls -d /usr/local/lib/tcl8.5 2>/dev/null) \
+      $(ls -d /usr/local/lib/tcl8.4 2>/dev/null) \
+      $(ls -d /usr/lib/tcl8.5 2>/dev/null) \
+      $(ls -d /usr/lib/tcl8.4 2>/dev/null) \
+      $(ls -d /opt/local/lib 2>/dev/null) \
       ; do
       if test -f "$i/tclConfig.sh" ; then
-        ac_cv_c_tclconfig=`(cd $i; pwd)`
+        ac_cv_c_tclconfig=$( (cd $i; pwd) )
         break
       fi
     done

