1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-22 09:57:47 +03:00

Another attempt to support both readline versions.

This commit is contained in:
Alasdair Kergon 2002-01-08 19:17:08 +00:00
parent 8deaf0d253
commit 83912faa1d
5 changed files with 76 additions and 19 deletions

51
configure vendored
View File

@ -2020,7 +2020,57 @@ package as well (which may be called readline-devel or something similar).
fi
echo $ac_n "checking for rl_completion_matches""... $ac_c" 1>&6
echo "configure:2025: checking for rl_completion_matches" >&5
if eval "test \"`echo '$''{'ac_cv_func_rl_completion_matches'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2030 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char rl_completion_matches(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char rl_completion_matches();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_rl_completion_matches) || defined (__stub___rl_completion_matches)
choke me
#else
rl_completion_matches();
#endif
; return 0; }
EOF
if { (eval echo configure:2053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_rl_completion_matches=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_rl_completion_matches=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'rl_completion_matches`\" = yes"; then
echo "$ac_t""yes" 1>&6
HAVE_RL_COMPLETION_MATCHES=yes
else
echo "$ac_t""no" 1>&6
HAVE_RL_COMPLETION_MATCHES=no
fi
fi
@ -2197,6 +2247,7 @@ s%@CPP@%$CPP%g
s%@JOBS@%$JOBS%g
s%@STATIC_LINK@%$STATIC_LINK%g
s%@READLINE@%$READLINE%g
s%@HAVE_RL_COMPLETION_MATCHES@%$HAVE_RL_COMPLETION_MATCHES%g
s%@OWNER@%$OWNER%g
s%@GROUP@%$GROUP%g

View File

@ -112,11 +112,14 @@ package as well (which may be called readline-devel or something similar).
)
exit
)
AC_CHECK_FUNC(rl_completion_matches, HAVE_RL_COMPLETION_MATCHES=yes,
HAVE_RL_COMPLETION_MATCHES=no)
fi
AC_SUBST(JOBS)
AC_SUBST(STATIC_LINK)
AC_SUBST(READLINE)
AC_SUBST(HAVE_RL_COMPLETION_MATCHES)
AC_SUBST(OWNER)
AC_SUBST(GROUP)
AC_SUBST(LIBS)

View File

@ -73,6 +73,10 @@ ifeq ("@READLINE@", "yes")
CFLAGS += -DREADLINE_SUPPORT
endif
ifeq ("@HAVE_RL_COMPLETION_MATCHES@", "yes")
CFLAGS += -DHAVE_RL_COMPLETION_MATCHES
endif
OBJECTS=$(SOURCES:%.c=%.o)
SUBDIRS.install := $(SUBDIRS:=.install)

View File

@ -10,20 +10,20 @@
#define DEFAULT_SYS_DIR "/etc/lvm"
#define DEFAULT_ARCHIVE_FLAG 1
#define DEFAULT_BACKUP_FLAG 1
#define DEFAULT_ARCHIVE_ENABLED 1
#define DEFAULT_BACKUP_ENABLED 1
#define DEFAULT_ARCHIVE_SUBDIR "archive"
#define DEFAULT_BACKUP_SUBDIR "backup"
/*
* FIXME: these are deliberately low for the beta
* series to encourage testing.
*/
#define DEFAULT_ARCHIVE_DAYS 7
#define DEFAULT_ARCHIVE_NUMBER 5
#define DEFAULT_ARCHIVE_DAYS 30
#define DEFAULT_ARCHIVE_NUMBER 10
#define DEFAULT_DEV_DIR "/dev"
#ifdef READLINE_SUPPORT
#define DEFAULT_MAX_HISTORY 100
#endif
#endif /* _LVM_DEFAULTS_H */

View File

@ -8,6 +8,8 @@
#include "archive.h"
#include "defaults.h"
#include "stub.h"
#include <assert.h>
#include <getopt.h>
#include <signal.h>
@ -17,15 +19,12 @@
#include <ctype.h>
#include <time.h>
#include "stub.h"
#ifdef READLINE_SUPPORT
#include <readline/readline.h>
#include <readline/history.h>
#define MAX_HISTORY 100
#ifndef rl_completion_matches
#define rl_completion_matches(a, b) completion_matches((char *)a, b)
#endif
#include <readline/readline.h>
#include <readline/history.h>
#ifndef HAVE_RL_COMPLETION_MATCHES
#define rl_completion_matches(a, b) completion_matches((char *)a, b)
#endif
#endif
/* define exported table of valid switches */
@ -694,7 +693,7 @@ static int _init_backup(struct config_file *cf)
/* set up archiving */
_default_settings.archive =
find_config_bool(cmd->cf->root, "backup/archive", '/',
DEFAULT_ARCHIVE_FLAG);
DEFAULT_ARCHIVE_ENABLED);
days = find_config_int(cmd->cf->root, "backup/retain_days", '/',
DEFAULT_ARCHIVE_DAYS);
@ -720,7 +719,7 @@ static int _init_backup(struct config_file *cf)
/* set up the backup */
_default_settings.backup =
find_config_bool(cmd->cf->root, "backup/backup", '/',
DEFAULT_BACKUP_FLAG);
DEFAULT_BACKUP_ENABLED);
if (lvm_snprintf(default_dir, sizeof(default_dir), "%s/%s", _sys_dir,
DEFAULT_BACKUP_SUBDIR) == -1) {
@ -1155,7 +1154,7 @@ static void _read_history(void)
log_very_verbose("Couldn't read history from %s.", hist_file);
stifle_history(find_config_int(cmd->cf->root, "shell/history_size",
'/', MAX_HISTORY));
'/', DEFAULT_MAX_HISTORY));
}