From 3127ded8bd83b7321374c946f805ca880f41993c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 24 Nov 2012 21:53:13 +0000 Subject: [PATCH] build-sys: make ./configure to seach vi path Using "/usr/ucb/vi" as defaut fallback EDITOR is not going to work on most of distributions where this package is installed. That said it might work somewhere, so searching the vi editor at configure time is the sensible thing to do, if user does not want to define the default. Signed-off-by: Sami Kerola --- configure.ac | 9 +++++++++ src/pathnames.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index db2d579..e590a7a 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,15 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include ]) dnl Checking for programs +AC_ARG_WITH([editor], + [AC_HELP_STRING([--with-editor=EDITOR], [path to default editor])], + [editor_defined="$with_editor"], + [editor_defined="no"]) +AS_IF([test "x$editor_defined" = "xno"], [ + AC_PATH_PROG([editor_defined], [vi], [/usr/bin/vi]) +]) +AC_DEFINE_UNQUOTED([EDITOR], ["$editor_defined"], [default editor]) + AC_MSG_CHECKING(username to run under) AC_ARG_WITH(daemon_username, [AS_HELP_STRING([--with-daemon_username=DAEMON_USERNAME], [Username to run under (default daemon) ])], diff --git a/src/pathnames.h b/src/pathnames.h index b5d5c70..1d716be 100644 --- a/src/pathnames.h +++ b/src/pathnames.h @@ -45,15 +45,6 @@ #define _PATH_CRON_PID PIDDIR PIDFILE #define REBOOT_LOCK PIDDIR "cron.reboot" - /* what editor to use if no EDITOR or VISUAL - * environment variable specified. - */ -#if defined(_PATH_VI) -# define EDITOR _PATH_VI -#else -# define EDITOR "/usr/ucb/vi" -#endif - #ifndef _PATH_BSHELL # define _PATH_BSHELL "/bin/sh" #endif -- 2.40.0