diff options
-rw-r--r-- | acinclude.m4 | 33 | ||||
-rw-r--r-- | configure.in | 43 | ||||
-rw-r--r-- | plpftp/Makefile.am | 12 | ||||
-rw-r--r-- | plpftp/ftp.cc | 4 | ||||
-rw-r--r-- | plpnfsd/main.cc | 2 |
5 files changed, 75 insertions, 19 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 33e01db..e6db568 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,3 +1,36 @@ +AC_DEFUN(AC_CHECK_READLINE, +[ + AC_MSG_CHECKING(for readline in -lreadline) + ac_cv_addcurses=false + ac_cv_have_libreadline=false + saved_libs=$LIBS + LIBS="$LIBS -lreadline" + link1ok=0 + link2ok=0 + AC_TRY_LINK(,[extern char *readline(void); readline();],link1ok=1) + LIBS="$LIBS -lreadline -lcurses" + AC_TRY_LINK(,[extern char *readline(void); readline();],link2ok=1) + LIBS="$saved_LIBS" + case "$link1ok$link2ok" in + 00) + AC_MSG_RESULT(no) + ;; + 01) + ac_cv_have_libreadline=true; + ac_cv_addcurses=true + AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE) + AC_MSG_RESULT([yes, and needs libcurses]) + ;; + 1*) + ac_cv_have_libreadline=true; + AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE) + AC_MSG_RESULT(yes) + ;; + esac + AM_CONDITIONAL(HAVE_LIBREADLINE, test x$ac_cv_have_libreadline = xtrue) + AM_CONDITIONAL(ADD_LIBCURSES, test x$ac_cv_addcurses = xtrue) +]) + AC_DEFUN(AC_FIND_FILE, [ $2=NO diff --git a/configure.in b/configure.in index 3b8a96c..e73ecd3 100644 --- a/configure.in +++ b/configure.in @@ -49,18 +49,37 @@ AC_SUBST(EXTRA_OBJS) dnl checks for libraries dnl readline and history for plpftp -AC_CHECK_LIB(readline, readline, -[ - AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE) - have_libreadline=true -]) -AC_CHECK_LIB(history, add_history, -[ - AC_DEFINE_UNQUOTED(HAVE_LIBHISTORY) - have_libhistory=true -]) -AM_CONDITIONAL(HAVE_LIBREADLINE, test x$have_libreadline = xtrue) -AM_CONDITIONAL(HAVE_LIBHISTORY, test x$have_libhistory = xtrue) +ac_enable_readline=yes +AM_CONDITIONAL(HAVE_LIBREADLINE, false) +AM_CONDITIONAL(ADD_LIBCURSES, false) +AC_ARG_ENABLE(readline, + [ --disable-readline disable libreadline support [no]], + if test "$enableval" = "no" ; then + AC_MSG_RESULT([support for libreadline disabled]) + ac_enable_readline=no + fi +) +if test "x$ac_enable_readline" = "xyes" ; then + AC_CHECK_READLINE +fi + +ac_enable_history=yes +AM_CONDITIONAL(HAVE_LIBHISTORY, false) +AC_ARG_ENABLE(history, + [ --disable-history disable libhistory support [no]], + if test "$enableval" = "no" ; then + AC_MSG_RESULT([support for libhistory disabled]) + ac_enable_history=no + fi +) +if test "x$ac_enable_history" = "xyes" ; then + AC_CHECK_LIB(history, add_history, + [ + AC_DEFINE_UNQUOTED(HAVE_LIBHISTORY) + have_libhistory=true + ]) + AM_CONDITIONAL(HAVE_LIBHISTORY, test x$have_libhistory = xtrue) +fi dnl these three are for solaris AC_CHECK_LIB(socket, socket) diff --git a/plpftp/Makefile.am b/plpftp/Makefile.am index 4ca89a0..4805577 100644 --- a/plpftp/Makefile.am +++ b/plpftp/Makefile.am @@ -2,12 +2,16 @@ # INCLUDES=-I$(top_srcdir)/lib -#if HAVE_LIBREADLINE +if HAVE_LIBREADLINE +if ADD_LIBCURSES +LIBREADLINE=-lreadline -lcurses +else LIBREADLINE=-lreadline -#endif -#if HAVE_LIBHISTORY +endif +endif +if HAVE_LIBHISTORY LIBHISTORY=-lhistory -#endif +endif bin_PROGRAMS = plpftp plpftp_LDADD = $(top_srcdir)/lib/libplp.la $(LIBREADLINE) $(LIBHISTORY) diff --git a/plpftp/ftp.cc b/plpftp/ftp.cc index 595ca75..41fa429 100644 --- a/plpftp/ftp.cc +++ b/plpftp/ftp.cc @@ -1008,7 +1008,7 @@ do_completion(char *text, int start, int end) rl_completion_entry_function = (Function *)null_completion; if (start == 0) - matches = completion_matches(text, command_generator); + matches = completion_matches(text, (CPFunction *)command_generator); else { int idx = 0; char *name; @@ -1029,7 +1029,7 @@ do_completion(char *text, int start, int end) maskAttr = rfsv::PSI_A_DIR; } - matches = completion_matches(text, filename_generator); + matches = completion_matches(text, (CPFunction *)filename_generator); } return matches; } diff --git a/plpnfsd/main.cc b/plpnfsd/main.cc index da515f5..261dfd5 100644 --- a/plpnfsd/main.cc +++ b/plpnfsd/main.cc @@ -251,7 +251,7 @@ long rfsv_mkdir(const char *file) { return a->mkdir(file); } -static long rfsv_closecached() { +long rfsv_closecached() { if (!a) return -1; if (!a_filename) |