Module Name: othersrc
Committed By: lukem
Date: Sun Jul 5 09:37:53 UTC 2020
Modified Files:
othersrc/usr.bin/tnftp: Makefile.am configure.ac todo
othersrc/usr.bin/tnftp/src: Makefile.am
Log Message:
implement --with-local-libedit
Add --with-local-libedit=(yes|auto|no) to control which libedit
implementation to use:
- yes - force local implementation
- auto - try system library, fallback to local implementation. Default
- no - force system library and fail if not found
Define NO_EDITCOMPLETE as AH_TEMPLATE() instead of adding to CFLAGS.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/usr.bin/tnftp/Makefile.am
cvs rdiff -u -r1.34 -r1.35 othersrc/usr.bin/tnftp/configure.ac
cvs rdiff -u -r1.14 -r1.15 othersrc/usr.bin/tnftp/todo
cvs rdiff -u -r1.4 -r1.5 othersrc/usr.bin/tnftp/src/Makefile.am
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: othersrc/usr.bin/tnftp/Makefile.am
diff -u othersrc/usr.bin/tnftp/Makefile.am:1.3 othersrc/usr.bin/tnftp/Makefile.am:1.4
--- othersrc/usr.bin/tnftp/Makefile.am:1.3 Sun May 5 13:06:37 2013
+++ othersrc/usr.bin/tnftp/Makefile.am Sun Jul 5 09:37:53 2020
@@ -1,10 +1,10 @@
-## $NetBSD: Makefile.am,v 1.3 2013/05/05 13:06:37 lukem Exp $
+## $NetBSD: Makefile.am,v 1.4 2020/07/05 09:37:53 lukem Exp $
ACLOCAL_AMFLAGS = -I buildaux
SUBDIRS = libnetbsd
-if USE_LIBEDIT
+if WITH_LOCAL_LIBEDIT
SUBDIRS += libedit
endif
Index: othersrc/usr.bin/tnftp/configure.ac
diff -u othersrc/usr.bin/tnftp/configure.ac:1.34 othersrc/usr.bin/tnftp/configure.ac:1.35
--- othersrc/usr.bin/tnftp/configure.ac:1.34 Sun Jan 31 22:23:59 2016
+++ othersrc/usr.bin/tnftp/configure.ac Sun Jul 5 09:37:53 2020
@@ -1,4 +1,4 @@
-# $NetBSD: configure.ac,v 1.34 2016/01/31 22:23:59 lukem Exp $
+# $NetBSD: configure.ac,v 1.35 2020/07/05 09:37:53 lukem Exp $
#
# Process this file with autoconf to produce a configure script.
@@ -9,7 +9,7 @@ AC_COPYRIGHT([
Copyright (c) 1999-2016 The NetBSD Foundation, Inc.
All rights reserved.
])
-AC_REVISION([$Revision: 1.34 $])
+AC_REVISION([$Revision: 1.35 $])
AS_SHELL_SANITIZE()
@@ -28,6 +28,7 @@ AM_MAINTAINER_MODE()
AC_ARG_ENABLE([editcomplete],
[AS_HELP_STRING([--enable-editcomplete],
[turn on command line editing and completion
+ (requires system or local libedit)
[default=enabled]])],
[opt_editcomplete=$enableval],
[opt_editcomplete=yes])
@@ -43,6 +44,13 @@ AC_ARG_ENABLE([ssl],
[default=auto]])],
[with_ssl=$enableval],
[with_ssl=auto])
+AC_ARG_WITH([local-libedit],
+ [AS_HELP_STRING([--with-local-libedit],
+ [use local libedit instead of system library:
+ yes; auto (try system, fallback to local); no
+ [default=auto]])],
+ [],
+ [with_local_libedit=auto])
AC_ARG_WITH([socks],
[AS_HELP_STRING([--with-socks],
[enable support for (Dante) SOCKS5 proxy
@@ -65,6 +73,8 @@ AH_TEMPLATE([HAVE_VA_COPY],
[Define to 1 if the 'va_copy' function is supported.])
AH_TEMPLATE([HAVE___BUILTIN_VA_COPY],
[Define to 1 if the '__builtin_va_copy' function is supported.])
+AH_TEMPLATE([NO_EDITCOMPLETE],
+ [Define if disabling command-line editing and completion.])
AH_TEMPLATE([USE_INET6],
[Define if using IPv6 support.])
AH_TEMPLATE([USE_SOCKS],
@@ -99,14 +109,31 @@ AS_CASE([$target_os],
#
# Checks for libraries.
#
+
+# Check if libedit is required, and which implementation.
+#
AS_IF([test "$opt_editcomplete" = yes],
- [AC_SEARCH_LIBS([tgetent],
+ [AC_MSG_NOTICE([--enable-editcomplete; checking for required features])
+ AC_SEARCH_LIBS([tgetent],
[termcap termlib curses ncurses tinfo],
[],
- [AC_MSG_ERROR(
- [no relevant library found containing tgetent])])
- ])
+ [AC_MSG_ERROR([no relevant library found containing tgetent])])
+ AS_IF([test "$with_local_libedit" != yes],
+ [AC_CHECK_LIB([edit],
+ [el_init],
+ [AC_MSG_NOTICE([using system libedit])
+ with_local_libedit=no],
+ [AS_IF([test "$with_local_libedit" = no],
+ [AC_MSG_ERROR([--without-local-libedit was given, but system libedit was not found])])
+ AC_MSG_NOTICE([using local libedit])
+ with_local_libedit=yes])],
+ [AC_MSG_NOTICE([using local libedit])])],
+ [AC_MSG_NOTICE([--disable-editcomplete; disabling --with-local-libedit])
+ AC_DEFINE([NO_EDITCOMPLETE], [1])
+ with_local_libedit=no])
+# Check for ns and socket libraries.
+#
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([socket],
[socket],
@@ -117,7 +144,6 @@ AC_SEARCH_LIBS([socket],
[],
[-lnsl])])
-#
# Check for (Dante) SOCKS5.
#
AS_IF([test "$with_socks" != no],
@@ -131,13 +157,12 @@ AS_IF([test "$with_socks" != no],
[AC_MSG_WARN(
[IPv6 is incompatible with socks, disabling IPv6 support])
opt_ipv6=no])],
- [AS_IF([test "$with_socks" != "auto"],
- [AC_MSG_FAILURE(
+ [AS_IF([test "$with_socks" != auto],
+ [AC_MSG_ERROR(
[--with-socks was given, but SOCKSinit() was not found])])
AC_MSG_NOTICE([disabling --with-socks])
with_socks=no])])
-#
# Check for OpenSSL.
#
AX_CHECK_OPENSSL([have_ssl=yes])
@@ -148,13 +173,11 @@ AS_IF([test "$with_ssl" != no],
[AC_DEFINE([WITH_SSL], [1])
AC_MSG_NOTICE([enabling SSL support])
with_ssl=yes],
- [AS_IF([test "$with_ssl" != "auto"],
- [AC_MSG_FAILURE([--with-ssl was given, but OpenSSL was not found])])
+ [AS_IF([test "$with_ssl" != auto],
+ [AC_MSG_ERROR([--with-ssl was given, but OpenSSL was not found])])
AC_MSG_NOTICE([disabling --with-ssl])
with_ssl=no])])
-AM_CONDITIONAL([WITH_SSL], [test "$with_ssl" = yes])
-
#
# Checks for header files.
#
@@ -404,12 +427,6 @@ exit(!res);
AC_LIBOBJ([strptime])],
[AC_MSG_RESULT([unknown - cross-compiling])])])
-# Use local libedit if editcomplete is requested
-#
-AS_IF([test "$opt_editcomplete" = yes],
- [AC_MSG_NOTICE([--enable-editcomplete; using internal libedit])],
- [CFLAGS="-DNO_EDITCOMPLETE $CFLAGS"])
-
# Replace sl_init() (et al) if it provides the older API.
#
AS_IF([test "$ac_cv_func_sl_init" = yes],
@@ -439,7 +456,9 @@ AS_IF([test "$ac_cv_header_vis_h" = yes]
#include <vis.h>
])])
-AM_CONDITIONAL([USE_LIBEDIT], [test "$opt_editcomplete" = yes])
+AM_CONDITIONAL([WITH_SSL], [test "$with_ssl" = yes])
+AM_CONDITIONAL([OPT_EDITCOMPLETE], [test "$opt_editcomplete" = yes])
+AM_CONDITIONAL([WITH_LOCAL_LIBEDIT], [test "$with_local_libedit" = yes])
#
# Create the Makefiles.
@@ -459,6 +478,7 @@ AC_MSG_NOTICE([ === Configuration result
AC_MSG_NOTICE([Package: $PACKAGE_STRING])
AC_MSG_NOTICE([Prefix: $prefix])
AC_MSG_NOTICE([Command-line editing: $opt_editcomplete])
+AC_MSG_NOTICE([Local libedit: $with_local_libedit])
AC_MSG_NOTICE([IPv6 support: $opt_ipv6])
AC_MSG_NOTICE([SOCKS5 proxy support: $with_socks])
AC_MSG_NOTICE([SSL: $with_ssl])
Index: othersrc/usr.bin/tnftp/todo
diff -u othersrc/usr.bin/tnftp/todo:1.14 othersrc/usr.bin/tnftp/todo:1.15
--- othersrc/usr.bin/tnftp/todo:1.14 Sat Jul 4 14:51:15 2020
+++ othersrc/usr.bin/tnftp/todo Sun Jul 5 09:37:53 2020
@@ -1,10 +1,8 @@
-$NetBSD: todo,v 1.14 2020/07/04 14:51:15 lukem Exp $
+$NetBSD: todo,v 1.15 2020/07/05 09:37:53 lukem Exp $
Current Items
-------------
-add autoconf control to use system libedit instead of internal libedit
-
autoconf test for HAVE_DECL_GETADDRINFO if providing getaddrinfo() override.
(required for UnixWare 7.1.1)
Index: othersrc/usr.bin/tnftp/src/Makefile.am
diff -u othersrc/usr.bin/tnftp/src/Makefile.am:1.4 othersrc/usr.bin/tnftp/src/Makefile.am:1.5
--- othersrc/usr.bin/tnftp/src/Makefile.am:1.4 Sun May 5 13:29:19 2013
+++ othersrc/usr.bin/tnftp/src/Makefile.am Sun Jul 5 09:37:53 2020
@@ -1,4 +1,4 @@
-## $NetBSD: Makefile.am,v 1.4 2013/05/05 13:29:19 lukem Exp $
+## $NetBSD: Makefile.am,v 1.5 2020/07/05 09:37:53 lukem Exp $
bin_PROGRAMS = tnftp
@@ -26,13 +26,17 @@ tnftp_LDADD = \
../libnetbsd/libnetbsd.la
-if USE_LIBEDIT
+if OPT_EDITCOMPLETE
+if WITH_LOCAL_LIBEDIT
tnftp_CPPFLAGS += \
-I$(top_srcdir)/libedit
tnftp_LDADD += \
../libedit/libedit.la
-endif
+else # !WITH_LOCAL_LIBEDIT
+tnftp_LDADD += -ledit
+endif # !WITH_LOCAL_LIBEDIT
+endif # !OPT_EDITCOMPLETE
if WITH_SSL