Linking readline *only* against rpcclient, smbclient patch
samba-technical at thewrittenword.com
samba-technical at thewrittenword.com
Thu Apr 12 13:45:40 GMT 2001
Patch attached to restrict linking of readline library to rpcclient
and smbclient *only*. Against CVS 2.2.0. Tested on Solaris 2.6/SPARC
with the Sun C compiler.
There's also an AC_MSG_RESULT fix thrown in at the end of the
configure.in patch.
Help testing is much appreciated.
--
albert chin (china at thewrittenword.com)
-- snip snip
Index: configure.in
===================================================================
RCS file: /cvsroot/samba/source/configure.in,v
retrieving revision 1.130.4.28
diff -u -3 -p -r1.130.4.28 configure.in
--- configure.in 2001/04/12 05:33:08 1.130.4.28
+++ configure.in 2001/04/12 08:33:37
@@ -343,8 +343,8 @@ case "$host_os" in
esac
AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
AC_CHECK_HEADERS(nss.h sys/security.h security/pam_appl.h)
-AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
-AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
+AC_CHECK_HEADERS(stropts.h poll.h)
+AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h acl/acl.h)
# For experimental utmp support (lastlog on some BSD-like systems)
@@ -451,15 +451,68 @@ if test x"$ac_cv_func_crypt" = x"no"; th
fi
###############################################
+# Readline included by default unless explicitly asked not to
+test "${with_readline+set}" != "set" && with_readline=yes
+
# test for where we get readline() from
-if test "$ac_cv_header_readline_h" = "yes" ||
- test "$ac_cv_header_readline_readline_h" = "yes"; then
- # we need to also pull in termcap for some systems to use readline
- AC_CHECK_LIB(termcap,tgetent)
- AC_CHECK_LIB(readline,rl_callback_handler_install)
-fi
+AC_MSG_CHECKING(whether to use readline)
+AC_ARG_WITH(readline,
+[ --with-readline[=DIR] Look for readline include/libs in DIR
+ --without-readline Don't include readline support],
+[ case "$with_readline" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
+ AC_CHECK_HEADERS(readline/history.h)
+ AC_CHECK_HEADERS(readline.h readline/readline.h,[
+ for termlib in ncurses curses termcap terminfo termlib; do
+ AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
+ done
+ AC_CHECK_LIB(readline, rl_callback_handler_install,
+ [TERMLIBS="-lreadline $TERMLIBS"
+ AC_DEFINE(HAVE_LIBREADLINE)
+ break], [TERMLIBS=], $TERMLIBS)])
+ ;;
+ no)
+ AC_MSG_RESULT(no)
+ ;;
+ *)
+ AC_MSG_RESULT(yes)
+
+ # Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
+ # alternate readline path
+ _ldflags=${LDFLAGS}
+ _cppflags=${CPPFLAGS}
+
+ # Add additional search path
+ LDFLAGS="-L$with_readline/lib $LDFLAGS"
+ CPPFLAGS="-I$with_readline/include $CPPFLAGS"
+
+ AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
+ AC_CHECK_HEADERS(readline/history.h)
+
+ AC_CHECK_HEADERS(readline.h readline/readline.h,[
+ for termlib in ncurses curses termcap terminfo termlib; do
+ AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
+ done
+ AC_CHECK_LIB(readline, rl_callback_handler_install,
+ [TERMLDFLAGS="-L$with_readline/lib"
+ TERMCPPFLAGS="-I$with_readline/include"
+ CPPFLAGS="-I$with_readline/include $CPPFLAGS"
+ TERMLIBS="-lreadline $TERMLIBS"
+ AC_DEFINE(HAVE_LIBREADLINE)
+ break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
+
+ LDFLAGS=$_ldflags
+ ;;
+ esac],
+ AC_MSG_RESULT(no)
+)
+AC_SUBST(TERMLIBS)
+AC_SUBST(TERMLDFLAGS)
+
# The following test taken from the cvs sources
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
@@ -2021,10 +2074,10 @@ __COMPILE_ERROR_
[int i],
samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
- echo "yes"
+ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
else
- echo "no"
+ AC_MSG_RESULT(no)
fi
AC_ARG_WITH(spinlocks, [ --with-spinlocks use spin locks instead of fcntl locks ])
Index: Makefile.in
===================================================================
RCS file: /cvsroot/samba/source/Makefile.in,v
retrieving revision 1.227.2.36
diff -u -3 -p -r1.227.2.36 Makefile.in
--- Makefile.in 2001/04/10 17:17:55 1.227.2.36
+++ Makefile.in 2001/04/12 08:33:43
@@ -15,6 +15,9 @@ CPPFLAGS=@CPPFLAGS@
LDFLAGS=@LDFLAGS@
AWK=@AWK@
+TERMLDFLAGS=@TERMLDFLAGS@
+TERMLIBS=@TERMLIBS@
+
LIBTOOL=@LIBTOOL@ --quiet
LIBTOOL_DEPS=@LIBTOOL_DEPS@
LINK=$(LIBTOOL) --mode=link $(CC) $(FLAGS) $(LDFLAGS)
@@ -111,8 +114,9 @@ LIB_OBJ = lib/charcnv.o lib/charset.o li
lib/util.o lib/util_sock.o lib/util_sec.o smbd/ssl.o \
lib/talloc.o lib/hash.o lib/substitute.o lib/fsusage.o \
lib/ms_fnmatch.o lib/select.o lib/error.o lib/messages.o \
- nsswitch/wb_client.o nsswitch/wb_common.o lib/readline.o \
- $(TDB_OBJ)
+ nsswitch/wb_client.o nsswitch/wb_common.o $(TDB_OBJ)
+
+READLINE_OBJ = lib/readline.o
UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \
ubiqx/ubi_dLinkList.o ubiqx/ubi_sLinkList.o ubiqx/debugparse.o
@@ -251,7 +255,8 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o r
RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
$(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
- $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_OBJ)
+ $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_OBJ) \
+ $(READLINE_OBJ)
PAM_WINBIND_OBJ = nsswitch/pam_winbind.po nsswitch/wb_common.po
@@ -264,7 +269,8 @@ SMBW_OBJ = smbwrapper/smbw.o \
SMBWRAPPER_OBJ = $(SMBW_OBJ) smbwrapper/wrapped.o
CLIENT_OBJ = client/client.o client/clitar.o \
- $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
+ $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
+ $(READLINE_OBJ)
CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
@@ -459,11 +465,11 @@ bin/smbrun: $(SMBRUN_OBJ) bin/.dummy
bin/rpcclient: $(RPCCLIENT_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS)
bin/smbclient: $(CLIENT_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS)
bin/smbspool: $(CUPS_OBJ) bin/.dummy
@echo Linking $@
More information about the samba-technical
mailing list