]> granicus.if.org Git - fcron/commitdiff
fixed configure script so as the usage of sendmail can be disabled (previously it...
authorthib <thib@thib-eee.(none)>
Sun, 15 Feb 2009 17:08:40 +0000 (17:08 +0000)
committerthib <thib@thib-eee.(none)>
Sun, 15 Feb 2009 17:08:40 +0000 (17:08 +0000)
config.h.in
configure.in
fileconf.c
job.c

index d55432ef0c47373eac882a1668e1ade5bbef5f0e..fe99202444b578fdcc6d7d94e3d71ee429394c89 100644 (file)
 /* ****************************************************************** */
 /* *** Compilation options *** */
 
+#undef USE_SENDMAIL
 /* 1 if we want to compile and install fcrondyn */
 #undef FCRONDYN
 #undef NOLOADAVG
index 71e6640da1875e2b2f2acfe9344bd4997049d8f5..71b2aba890e71b479bd0033aa0aab9dccbdf45bc 100644 (file)
@@ -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=
index 20893d9f986db761c6fc02657af0666564ad472c..cfa3be4cfd385e9daf490fc93b5582a3777d9f9b 100644 (file)
@@ -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 00d64aa5456d8d6795ce524d81eda5c2be32dfa6..426e52b93bf4bd3c0cf5ad0b06ef2463fabb3119 100644 (file)
--- 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
 }