From 1ce7042a23b1392cb724fbffb957d4fbd4258de2 Mon Sep 17 00:00:00 2001 From: thib Date: Sun, 15 Feb 2009 17:08:40 +0000 Subject: [PATCH] fixed configure script so as the usage of sendmail can be disabled (previously it would then try to run "no"!) --- config.h.in | 1 + configure.in | 31 ++++++++++++++++--------------- fileconf.c | 6 +++--- job.c | 4 ++-- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/config.h.in b/config.h.in index d55432e..fe99202 100644 --- a/config.h.in +++ b/config.h.in @@ -159,6 +159,7 @@ /* ****************************************************************** */ /* *** Compilation options *** */ +#undef USE_SENDMAIL /* 1 if we want to compile and install fcrondyn */ #undef FCRONDYN #undef NOLOADAVG diff --git a/configure.in b/configure.in index 71e6640..71b2aba 100644 --- a/configure.in +++ b/configure.in @@ -179,8 +179,6 @@ dnl --------------------------------------------------------------------- dnl Programs ... AC_PATH_PROG(FOUND_SENDMAIL, sendmail, , $PATH:/usr/lib:/usr/sbin ) -SENDMAIL= -fcron_use_sendmail=yes AC_MSG_CHECKING(sendmail) AC_ARG_WITH(sendmail, [ --with-sendmail=PATH Path to sendmail.], @@ -190,14 +188,20 @@ AC_ARG_WITH(sendmail, Without sendmail you won't get the output of the jobs by mail ]) - fcron_use_sendmail=no - SENDMAIL=no ;; yes) + if test "$FOUND_SENDMAIL" = "" ; then + AC_MSG_ERROR([ +Cannot determine path to sendmail: try option --with-sendmail=PATH]) + fi + SENDMAIL=$FOUND_SENDMAIL + USE_SENDMAIL=1 ;; *) - SENDMAIL=$withval - if test $fcron_enable_checks = 'yes' -a ! -x "$withval"; then + if test -x $withval ; then + SENDMAIL=$withval + USE_SENDMAIL=1 + else AC_MSG_ERROR([ File $withval is not an executable file]) fi @@ -205,16 +209,13 @@ File $withval is not an executable file]) esac ] ) -if test $fcron_use_sendmail = yes -a x"$SENDMAIL" = x ; then - SENDMAIL=$FOUND_SENDMAIL - if test "$FOUND_SENDMAIL" = "" ; then - AC_MSG_ERROR([ -Cannot determine path to sendmail: try option --with-sendmail=PATH]) - fi -fi - -AC_MSG_RESULT([$SENDMAIL]) AC_SUBST([SENDMAIL]) +if test x"$USE_SENDMAIL" != x ; then + AC_DEFINE([USE_SENDMAIL]) + AC_MSG_RESULT([$SENDMAIL]) +else + AC_MSG_RESULT([disabled]) +fi AC_PATH_PROG(FOUND_FCRON_SHELL, sh, , $PATH) FCRON_SHELL= diff --git a/fileconf.c b/fileconf.c index 20893d9..cfa3be4 100644 --- a/fileconf.c +++ b/fileconf.c @@ -1188,7 +1188,7 @@ read_freq(char *ptr, cf_t *cf) goto exiterr; } -#ifndef SENDMAIL +#ifndef USE_SENDMAIL clear_mail(cl->cl_option); #endif @@ -1293,7 +1293,7 @@ read_arys(char *ptr, cf_t *cf) goto exiterr; } -#ifndef SENDMAIL +#ifndef USE_SENDMAIL clear_mail(cl->cl_option); #endif @@ -1431,7 +1431,7 @@ read_period(char *ptr, cf_t *cf) } ok: -#ifndef SENDMAIL +#ifndef USE_SENDMAIL clear_mail(cl->cl_option); #endif diff --git a/job.c b/job.c index 00d64aa..426e52b 100644 --- a/job.c +++ b/job.c @@ -784,7 +784,7 @@ void launch_mailer(cl_t *line, FILE *mailf) /* mail the output of a job to user */ { -#ifdef SENDMAIL +#ifdef USE_SENDMAIL foreground = 0; /* set stdin to the job's output */ @@ -808,7 +808,7 @@ launch_mailer(cl_t *line, FILE *mailf) error_e("Can't find \"%s\". Trying a execlp(\"sendmail\")", sendmail); execlp("sendmail", "sendmail", SENDMAIL_ARGS, line->cl_mailto, NULL); die_e("Can't exec " SENDMAIL); -#else /* defined(SENDMAIL) */ +#else /* defined(USE_SENDMAIL) */ exit(EXIT_OK); #endif } -- 2.40.0