From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 4 Nov 1999 21:46:40 +0000 (+0000)
Subject: Improve getopt and readline support, from Peter Eisentraut.
X-Git-Tag: REL7_0~1211
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7791e8c0010aa5f9cc028ec876e24b047637c494;p=postgresql

Improve getopt and readline support, from Peter Eisentraut.
---

diff --git a/src/configure.in b/src/configure.in
index 404c9c3f07..8826a8ec2f 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -583,9 +583,10 @@ for curses in ncurses curses ; do
 		[LIBS="-l${curses} $LIBS"; break])
 done
 AC_CHECK_LIB(termcap,  main)
-AC_CHECK_LIB(history,  main)
 AC_CHECK_LIB(readline, main)
-AC_CHECK_LIB(readline, write_history, AC_DEFINE(HAVE_HISTORY))
+AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
+    AC_CHECK_LIB(history,  main) )
+
 if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
 then
 	AC_CHECK_LIB(bsd,      main)
@@ -791,6 +792,11 @@ AC_CHECK_FUNC(rint,
 	      AC_DEFINE(HAVE_RINT),
 	      AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
 
+
+dnl Check for GNU style long options support (getopt_long)
+AC_CHECK_FUNCS(getopt_long)
+
+
 AC_MSG_CHECKING(for finite() macro or function)
 AC_TRY_LINK([#include <math.h>],
 	[int dummy=finite(1.0);],
diff --git a/src/include/config.h.in b/src/include/config.h.in
index 698526e7da..ef25d6ddcb 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -285,7 +285,7 @@
 #undef HAVE_STRICMP
 
 /* Set to 1 if you have libreadline and it includes history functions */
-#undef HAVE_HISTORY
+#undef HAVE_HISTORY_IN_READLINE
 
 /*
  * Block of parameters for the ODBC code.
@@ -431,6 +431,10 @@ extern void srandom(unsigned int seed);
 /* Set to 1 if you have libhistory.a */
 #undef HAVE_LIBHISTORY
 
+/* Set to 1 if you have getopt_long() (GNU long options) */
+#undef HAVE_GETOPT_LONG
+
+
 /*
  * On architectures for which we have not implemented spinlocks (or
  * cannot do so), we use System V semaphores.  We also use them for