[ntp:bk-ntp-dev-send] BitKeeper diffs

Harlan Stenn stenn at whimsy.udel.edu
Mon Oct 15 09:00:19 UTC 2007


#### ChangeSet ####
2007-10-15 04:52:10-04:00, stenn at whimsy.udel.edu 
  ChangeLog:
    [Bug 931] Require -lreadline to be asked for explicitly.
    [Bug 764] When looking for -lreadline support, also try using -lncurses.
    Use new line edit library autoconf macro.
  configure.ac:
    Use the NTP_LINEEDITLIBS macro now.
  Makefile.am, ntpdc.c, ntpq.c:
    Use new line editing library detection code
  ntp_lineeditlibs.m4:
    BitKeeper file /deacon/backroom/ntp-dev-hms/m4/ntp_lineeditlibs.m4

==== ChangeLog ====
2007-10-15 04:50:14-04:00, stenn at whimsy.udel.edu +2 -0
  [Bug 931] Require -lreadline to be asked for explicitly.
  [Bug 764] When looking for -lreadline support, also try using -lncurses.
  Use new line edit library autoconf macro.

--- 1.125/ChangeLog	2007-10-14 03:35:02 -04:00
+++ 1.126/ChangeLog	2007-10-15 04:50:14 -04:00
@@ -1,3 +1,5 @@
+* [Bug 931] Require -lreadline to be asked for explicitly.
+* [Bug 764] When looking for -lreadline support, also try using -lncurses.
 * [Bug 909] Fix int32_t errors for ntohl().
 * [Bug 376/214] Enhancements to support multiple if names and IP addresses.
 * [Bug 929] int32_t is undefined on Windows.  Casting wrong.

==== configure.ac ====
2007-10-15 04:43:03-04:00, stenn at whimsy.udel.edu +2 -26
  Use the NTP_LINEEDITLIBS macro now.

--- 1.407/configure.ac	2007-06-22 12:52:20 -04:00
+++ 1.408/configure.ac	2007-10-15 04:43:03 -04:00
@@ -341,32 +341,8 @@ AC_CHECK_FUNC(openlog, , 
 AC_CHECK_LIB(md5, MD5Init, , 
   AC_CHECK_LIB(md, MD5Init))
 AC_CHECK_FUNCS(MD5Init)
-dnl HMS: What a hack...
-AC_CHECK_HEADERS(readline/history.h readline/readline.h)
-case "$ac_cv_header_readline_history_h$ac_cv_header_readline_readline_h" in
- *no*) ;;
- *) save_LIBS=$LIBS
-    LIBS=
-    # Ralf Wildenhues: either unset ... or cache READLINE_LIBS
-    unset ac_cv_lib_readline_readline
-    AC_CHECK_LIB(readline, readline, ,
-     AC_MSG_NOTICE([Trying again with -lcurses])
-     unset ac_cv_lib_readline_readline
-     AC_CHECK_LIB(readline, readline,
-      LIBS="-lreadline -lcurses $LIBS"
-      AC_DEFINE(HAVE_LIBREADLINE)
-      AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?]),
-      AC_CHECK_LIB(edit, readline,
-       LIBS="-ledit -lcurses"
-       AC_DEFINE(HAVE_LIBEDIT, , [Do we have the edit library?])
-       AC_DEFINE(HAVE_LIBCURSES, , [Do we have the curses library?])
-       , , -lcurses)
-      , -lcurses))
-    READLINE_LIBS=$LIBS
-    AC_SUBST(READLINE_LIBS)
-    LIBS=$save_LIBS
-    ;;
-esac
+
+NTP_LINEEDITLIBS
 
 dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt
 dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt,

==== m4/ntp_lineeditlibs.m4 ====
2007-10-15 04:41:30-04:00, stenn at whimsy.udel.edu +86 -0
  BitKeeper file /deacon/backroom/ntp-dev-hms/m4/ntp_lineeditlibs.m4

--- /dev/null	2007-10-15 04:59:21 -04:00
+++ 1.1/m4/ntp_lineeditlibs.m4	2007-10-15 04:41:30 -04:00
@@ -0,0 +1,86 @@
+AC_DEFUN([NTP_LINEEDITLIBS], [
+  AC_CACHE_VAL([ntp_cv_lib_lineedit], [
+    # Ralf Wildenhues: either unset ... or cache EDITLINE_LIBS
+    unset ntp_cv_lib_lineedit
+    ORIG_LIBS="$LIBS"
+    AC_ARG_WITH([lineeditlibs],
+        [AC_HELP_STRING([--with-lineeditlibs], [edit,editline,readline])],
+        [use_lineeditlibs="$withval"],
+	[use_lineeditlibs="edit,editline"])
+
+    for lineedit_lib in `echo $use_lineeditlibs | sed -e 's/,/ /'`; do
+      for term_lib in "" termcap curses ncurses; do
+        case "$term_lib" in
+         '') TRY_LIB="-l$lineedit_lib" ;;
+         *)  TRY_LIB="-l$lineedit_lib -l$term_lib" ;;
+        esac
+        LIBS="$ORIG_LIBS $TRY_LIB"
+	AC_MSG_CHECKING([for readline() with $TRY_LIB])
+        AC_TRY_LINK_FUNC([readline], [ntp_cv_lib_lineedit="$TRY_LIB"])
+        case "$ntp_cv_lib_lineedit" in
+	 '')
+	    AC_MSG_RESULT([no])
+	    ;;
+	 *) # Use readline()
+	    AC_MSG_RESULT([yes])
+	    break
+	    ;;
+        esac
+	AC_MSG_CHECKING([for el_gets() with $TRY_LIB])
+        AC_TRY_LINK_FUNC([el_gets], [ntp_cv_lib_lineedit="$TRY_LIB"])
+        case "$ntp_cv_lib_lineedit" in
+	 '')
+	    AC_MSG_RESULT([no])
+	    ;;
+	 *) # Use el_gets()
+	    AC_MSG_RESULT([yes])
+	    break
+	    ;;
+        esac
+      done
+      case "$ntp_cv_lib_lineedit" in
+       '') ;;
+       *)  break ;;
+      esac
+    done
+    LIBS="$ORIG_LIBS"
+    case "$ntp_cv_lib_lineedit" in
+     '')
+	ntp_cv_lib_lineedit="no"
+	;;
+     *) EDITLINE_LIBS="$ntp_cv_lib_lineedit"
+	AC_SUBST(EDITLINE_LIBS)
+	;;
+    esac
+  ])
+
+  case "$ntp_cv_lib_lineedit" in
+   no) ;;
+   -ledit)
+	AC_DEFINE(HAVE_LIBEDIT, 1,
+              [Define if you have libedit])
+	# we want to also check for readline.h
+	AC_CHECK_HEADERS(histedit.h)
+	;;
+   -leditline)
+	AC_MSG_WARN([editline is not yet supported])
+	;;
+   *)
+	AC_DEFINE(HAVE_LIBREADLINE, 1,
+              [Define if you have a readline compatible library])
+	AC_CHECK_HEADERS(readline.h readline/readline.h)
+	AC_CACHE_CHECK([whether readline supports history],
+                   ntp_cv_lib_lineedit_history, [
+	    ntp_cv_lib_lineedit_history="no"
+	    AC_TRY_LINK_FUNC(add_history, ntp_cv_lib_lineedit_history="yes")
+	])
+	case "$ntp_cv_lib_lineedit_history" in
+	 yes)
+		AC_DEFINE(HAVE_READLINE_HISTORY, 1,
+                    [Define if your readline library has \`add_history'])
+		AC_CHECK_HEADERS(history.h readline/history.h)
+		;;
+    	esac
+	;;
+  esac
+])dnl

==== m4/ntp_lineeditlibs.m4 ====
2007-10-15 04:41:30-04:00, stenn at whimsy.udel.edu +0 -0

==== ntpdc/Makefile.am ====
2007-10-15 04:48:54-04:00, stenn at whimsy.udel.edu +1 -1
  Use new line editing library detection code

--- 1.36/ntpdc/Makefile.am	2007-05-30 22:35:13 -04:00
+++ 1.37/ntpdc/Makefile.am	2007-10-15 04:48:54 -04:00
@@ -7,7 +7,7 @@ EXTRA_DATA=	check-layout
 BUILT_SOURCES=	@MAKE_CHECK_LAYOUT@
 AM_CPPFLAGS=	-I$(top_srcdir)/include $(LIBOPTS_CFLAGS)
 # LDADD might need RESLIB and ADJLIB
-ntpdc_LDADD=	version.o @READLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a
+ntpdc_LDADD=	version.o @EDITLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a
 # ntpdc-layout doesn't need any additional libraries at all
 ntpdc_layout_LDADD=
 DISTCLEANFILES=	.version version.c

==== ntpdc/ntpdc.c ====
2007-10-15 04:48:55-04:00, stenn at whimsy.udel.edu +6 -2
  Use new line editing library detection code

--- 1.56/ntpdc/ntpdc.c	2007-03-17 15:19:13 -05:00
+++ 1.57/ntpdc/ntpdc.c	2007-10-15 04:48:55 -04:00
@@ -26,10 +26,14 @@
 # define closesocket close
 #endif /* SYS_WINNT */
 
-#if defined(HAVE_LIBREADLINE) || defined (HAVE_LIBEDIT)
+#if defined(HAVE_LIBREADLINE)
 # include <readline/readline.h>
 # include <readline/history.h>
-#endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */
+#endif /* HAVE_LIBREADLINE */
+
+#if defined (HAVE_LIBEDIT)
+# include <editline/readline.h>
+#endif /* HAVE_LIBEDIT */
 
 #ifdef SYS_VXWORKS
 				/* vxWorks needs mode flag -casey*/

==== ntpq/Makefile.am ====
2007-10-15 04:49:02-04:00, stenn at whimsy.udel.edu +1 -1
  Use new line editing library detection code

--- 1.28/ntpq/Makefile.am	2007-05-30 22:35:14 -04:00
+++ 1.29/ntpq/Makefile.am	2007-10-15 04:49:02 -04:00
@@ -4,7 +4,7 @@ bin_PROGRAMS=	ntpq
 AM_CPPFLAGS=	-I$(top_srcdir)/include $(LIBOPTS_CFLAGS)
 
 # LDADD might need RESLIB and ADJLIB
-ntpq_LDADD=	version.o @READLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a
+ntpq_LDADD=	version.o @EDITLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a
 DISTCLEANFILES=	.version version.c
 noinst_HEADERS=	ntpq.h
 ETAGS_ARGS=	Makefile.am

==== ntpq/ntpq.c ====
2007-10-15 04:49:03-04:00, stenn at whimsy.udel.edu +6 -2
  Use new line editing library detection code

--- 1.70/ntpq/ntpq.c	2007-08-27 23:38:05 -04:00
+++ 1.71/ntpq/ntpq.c	2007-10-15 04:49:03 -04:00
@@ -31,10 +31,14 @@
 # define closesocket close
 #endif /* SYS_WINNT */
 
-#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)
+#if defined(HAVE_LIBREADLINE)
 # include <readline/readline.h>
 # include <readline/history.h>
-#endif /* HAVE_LIBREADLINE || HAVE_LIBEDIT */
+#endif /* HAVE_LIBREADLINE */
+
+#if defined(HAVE_LIBEDIT)
+# include <editline/readline.h>
+#endif /* HAVE_LIBEDIT */
 
 #ifdef SYS_VXWORKS
 				/* vxWorks needs mode flag -casey*/


More information about the bk-ntp-dev-send mailing list