diff options
author | Alasdair Kergon <agk@redhat.com> | 2002-01-08 19:17:08 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2002-01-08 19:17:08 +0000 |
commit | 83912faa1d452d2309a2cda38338fc995804d463 (patch) | |
tree | 1751d52392381e7b2803a71339f404c4a007e22d | |
parent | 8deaf0d253c585d5cc6bf2a8a808ff6dac3cd328 (diff) | |
download | lvm2-83912faa1d452d2309a2cda38338fc995804d463.tar.gz lvm2-83912faa1d452d2309a2cda38338fc995804d463.tar.xz lvm2-83912faa1d452d2309a2cda38338fc995804d463.zip |
Another attempt to support both readline versions.
-rwxr-xr-x | configure | 51 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | make.tmpl.in | 4 | ||||
-rw-r--r-- | tools/defaults.h | 16 | ||||
-rw-r--r-- | tools/lvm.c | 21 |
5 files changed, 76 insertions, 19 deletions
@@ -2020,8 +2020,58 @@ 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 diff --git a/configure.in b/configure.in index 2ae0f100..9687f2e5 100644 --- a/configure.in +++ b/configure.in @@ -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) diff --git a/make.tmpl.in b/make.tmpl.in index a264eb7a..512bf3a6 100644 --- a/make.tmpl.in +++ b/make.tmpl.in @@ -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) diff --git a/tools/defaults.h b/tools/defaults.h index b5354aae..c6e7db26 100644 --- a/tools/defaults.h +++ b/tools/defaults.h @@ -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 */ diff --git a/tools/lvm.c b/tools/lvm.c index e42cd9e0..c2102738 100644 --- a/tools/lvm.c +++ b/tools/lvm.c @@ -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)); } |