From: thib Date: Mon, 1 Jan 2007 18:50:48 +0000 (+0000) Subject: new configure script and Makefiles which are more standard X-Git-Tag: ver3_0_2-rc1~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80b9f096e56803d563acb0749d321416659c2367;p=fcron new configure script and Makefiles which are more standard --- diff --git a/Makefile.in b/Makefile.in index 84df487..209b1e4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,27 +4,36 @@ # @configure_input@ -# $Id: Makefile.in,v 1.105 2004-11-14 16:32:36 thib Exp $ +# $Id: Makefile.in,v 1.106 2007-01-01 18:51:34 thib Exp $ # The following should not be edited manually (use configure options) # If you must do it, BEWARE : some of the following is also defined # in config.h, so you must modify config.h AND Makefile in order # to set the same values in the two files. +FCRON_ALLOW = fcron.allow +FCRON_DENY = fcron.deny +FCRON_CONF = fcron.conf + SRCDIR := @srcdir@ # Useful to build packages # you may want to use this var with a : 'make DESTDIR=dir install' DESTDIR := # Where should we install it ? -prefix := $(DESTDIR)@prefix@ -# We set exec_prefix to $prefix (if you change this, you should also change -# it in configure.in) -exec_prefix := $(DESTDIR)@exec_prefix@ -DESTSBIN := @sbindir@ -DESTBIN := @bindir@ -FCRONTABS := $(DESTDIR)@FCRONTABS@ -ETC := $(DESTDIR)@ETC@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +DESTSBIN = @sbindir@ +DESTBIN = @bindir@ +ETC = @sysconfdir@ +FCRONTABS = @FCRONTABS@ +PIDDIR = @PIDDIR@ +FIFODIR = @FIFODIR@ +PIDFILE = @PIDFILE@ +FIFOFILE = @FIFOFILE@ +FCRON_SHELL = @FCRON_SHELL@ +SENDMAIL = @SENDMAIL@ +FCRON_EDITOR = @FCRON_EDITOR@ OPTIM := @CFLAGS@ LDFLAGS := @LDFLAGS@ CPPFLAGS := @CPPFLAGS@ -I. -I${SRCDIR} @@ -105,47 +114,110 @@ convert-fcrontab: $(OBJCONV) $(CC) $(CFLAGS) -o $@ $(OBJCONV) $(LIBS) %.o: $(SRCDIR)/%.c $(HEADERSALL) $(SRCDIR)/%.h - $(CC) $(CFLAGS) -c $< + $(CC) $(CFLAGS) -DPIDFILE="\"${PIDFILE}\"" \ + -DFIFOFILE="\"${FIFOFILE}\"" -DETC="\"${ETC}\"" \ + -DFCRON_SHELL="\"${FCRON_SHELL}\"" -DFCRON_CONF="\"${FCRON_CONF}\"" \ + -DFCRONTABS="\"${FCRONTABS}\"" \ + -DFCRON_ALLOW="\"${FCRON_ALLOW}\"" -DFCRON_DENY="\"${FCRON_DENY}\"" \ + -DFCRON_SHELL="\"${FCRON_SHELL}\"" -DSENDMAIL="\"${SENDMAIL}\"" \ + -DFCRON_EDITOR="\"${FCRON_EDITOR}\"" -DBINDIREX="\"${DESTBIN}\"" \ + -c $< + +install: install-staged strip perms +ifeq ($(BOOTINSTALL), 1) + $(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS) $(ANSWERALL) $(SRCDIR) +endif -install: all +install-staged: all # needed by boot-install script : - echo `fcron -V 2>&1 | grep "^fcron "` > $(SRCDIR)/script/PREVIOUS_VERSION + echo `fcron -V 2>&1 | grep "^fcron "` > PREVIOUS_VERSION && chmod a+rw PREVIOUS_VERSION $(SRCDIR)/script/user-group $(USERNAME) $(GROUPNAME) $(ANSWERALL) $(SRCDIR) # check if the directories we use exist, and if not, create them - if test ! -d $(DESTSBIN); then $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $(DESTSBIN) ; fi - if test ! -d $(DESTBIN); then $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $(DESTBIN) ; fi - if test ! -d $(ETC); then $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $(ETC) ; fi -# create the spool dir (and change its mode if it already exists) - $(INSTALL) -g $(GROUPNAME) -o $(USERNAME) -m 770 -d $(FCRONTABS) - - $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 110 -s fcron $(DESTSBIN) - $(INSTALL) -g $(GROUPNAME) -o $(USERNAME) -m $(BINMODE) -s fcrontab $(DESTBIN) - $(INSTALL) -g $(GROUPNAME) -o $(ROOTNAME) -m $(BINMODESIGHUP) -s fcronsighup $(DESTBIN) + if test ! -d $(DESTDIR)$(DESTSBIN); then $(INSTALL) -m 755 -d $(DESTDIR)$(DESTSBIN) ; fi + if test ! -d $(DESTDIR)$(DESTBIN); then $(INSTALL) -m 755 -d $(DESTDIR)$(DESTBIN) ; fi + if test ! -d $(DESTDIR)$(ETC); then $(INSTALL) -m 755 -d $(DESTDIR)$(ETC) ; fi + if test ! -d $(DESTDIR)$(PIDDIR); then $(INSTALL) -m 755 -d $(DESTDIR)$(PIDDIR) ; fi + if test ! -d $(DESTDIR)$(FIFODIR); then $(INSTALL) -m 755 -d $(DESTDIR)$(FIFODIR) ; fi +# create the spool dir + $(INSTALL) -m 755 -d $(DESTDIR)$(FCRONTABS) + + $(INSTALL) -m 755 fcron $(DESTDIR)$(DESTSBIN) + $(INSTALL) -m 755 fcrontab $(DESTDIR)$(DESTBIN) + $(INSTALL) -m 755 fcronsighup $(DESTDIR)$(DESTBIN) ifeq ($(FCRONDYN), 1) - $(INSTALL) -g $(GROUPNAME) -o $(USERNAME) -m $(BINMODE) -s fcrondyn $(DESTBIN) -endif - test -f $(ETC)/fcron.allow || test -f $(ETC)/fcron.deny || $(INSTALL) -m 640 -o $(ROOTNAME) -g $(GROUPNAME) $(SRCDIR)/files/fcron.allow $(SRCDIR)/files/fcron.deny $(ETC) - test -f $(ETC)/fcron.conf || $(INSTALL) -m 640 -o $(ROOTNAME) -g $(GROUPNAME) files/fcron.conf $(ETC) -ifeq ($(USEPAM), 1) - $(SRCDIR)/script/install-pam-conf $(SRCDIR) $(ETC) $(ROOTNAME) $(ROOTGROUP) "$(INSTALL)" + $(INSTALL) -m 755 fcrondyn $(DESTDIR)$(DESTBIN) endif + test -f $(DESTDIR)$(ETC)/fcron.allow || test -f $(DESTDIR)$(ETC)/fcron.deny || $(INSTALL) -m 644 $(SRCDIR)/files/fcron.allow $(SRCDIR)/files/fcron.deny $(DESTDIR)$(ETC) + test -f $(DESTDIR)$(ETC)/fcron.conf || $(INSTALL) -m 644 files/fcron.conf $(DESTDIR)$(ETC) - make -C doc install + make -C doc install-staged -# in order to get correct rights when upgrading : + +perms: # Note : we don't use "chown user:group file" because some systems use ":" # and others "." as separator. - find $(FCRONTABS) -type f \( -name "*.orig" -a ! -name "$(ROOTNAME).orig" -a ! -name "$(SYSFCRONTAB).orig" \) -exec chown $(USERNAME) {} \; -exec chgrp $(GROUPNAME) {} \; -exec chmod 640 {} \; - find $(FCRONTABS) -type f \( -name "$(ROOTNAME).orig" -o -name "$(SYSFCRONTAB).orig" \) -exec chown $(ROOTNAME) {} \; -exec chgrp $(GROUPNAME) {} \; -exec chmod 600 {} \; - find $(FCRONTABS) -type f ! -name "*.orig" -exec chown $(ROOTNAME) {} \; -exec chgrp $(ROOTGROUP) {} \; -exec chmod 600 {} \; - if test -f $(ETC)/fcron.deny; then chown $(ROOTNAME) $(ETC)/fcron.deny ; chgrp $(GROUPNAME) $(ETC)/fcron.deny ; fi - if test -f $(ETC)/fcron.allow; then chown $(ROOTNAME) $(ETC)/fcron.allow ; chgrp $(GROUPNAME) $(ETC)/fcron.allow ; fi + chown $(ROOTNAME) $(DESTDIR)$(DESTSBIN) + chgrp $(ROOTGROUP) $(DESTDIR)$(DESTSBIN) + chown $(ROOTNAME) $(DESTDIR)$(DESTBIN) + chgrp $(ROOTGROUP) $(DESTDIR)$(DESTBIN) + chown $(ROOTNAME) $(DESTDIR)$(ETC) + chgrp $(ROOTGROUP) $(DESTDIR)$(ETC) + chown $(ROOTNAME) $(DESTDIR)$(FIFODIR) + chgrp $(ROOTGROUP) $(DESTDIR)$(FIFODIR) + chown $(ROOTNAME) $(DESTDIR)$(PIDDIR) + chgrp $(ROOTGROUP) $(DESTDIR)$(PIDDIR) + +# change spool dir mode + chown $(USERNAME) $(DESTDIR)$(FCRONTABS) + chgrp $(GROUPNAME) $(DESTDIR)$(FCRONTABS) + chmod 770 $(DESTDIR)$(FCRONTABS) + + chown $(ROOTNAME) $(DESTDIR)$(DESTSBIN)/fcron + chgrp $(ROOTGROUP) $(DESTDIR)$(DESTSBIN)/fcron + chmod 110 $(DESTDIR)$(DESTSBIN)/fcron + + chown $(USERNAME) $(DESTDIR)$(DESTBIN)/fcrontab + chgrp $(GROUPNAME) $(DESTDIR)$(DESTBIN)/fcrontab + chmod $(BINMODE) $(DESTDIR)$(DESTBIN)/fcrontab + + chown $(ROOTNAME) $(DESTDIR)$(DESTBIN)/fcronsighup + chgrp $(GROUPNAME) $(DESTDIR)$(DESTBIN)/fcronsighup + chmod $(BINMODESIGHUP) $(DESTDIR)$(DESTBIN)/fcronsighup -ifeq ($(BOOTINSTALL), 1) - $(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS) $(ANSWERALL) $(SRCDIR) +ifeq ($(FCRONDYN), 1) + chown $(USERNAME) $(DESTDIR)$(DESTBIN)/fcrondyn + chgrp $(GROUPNAME) $(DESTDIR)$(DESTBIN)/fcrondyn + chmod $(BINMODE) $(DESTDIR)$(DESTBIN)/fcrondyn +endif + chown $(ROOTNAME) $(DESTDIR)$(ETC)/fcron.allow $(DESTDIR)$(ETC)/fcron.deny + chgrp $(GROUPNAME) $(DESTDIR)$(ETC)/fcron.allow $(DESTDIR)$(ETC)/fcron.deny + chmod 640 $(DESTDIR)$(ETC)/fcron.allow $(DESTDIR)$(ETC)/fcron.deny + + chown $(ROOTNAME) $(DESTDIR)$(ETC)/fcron.conf + chgrp $(GROUPNAME) $(DESTDIR)$(ETC)/fcron.conf + chmod 640 $(DESTDIR)$(ETC)/fcron.conf +ifeq ($(USEPAM), 1) + $(SRCDIR)/script/install-pam-conf $(SRCDIR) $(DESTDIR)$(ETC) $(ROOTNAME) $(ROOTGROUP) "$(INSTALL)" +endif + +# in order to get correct rights when upgrading : + + find $(DESTDIR)$(FCRONTABS) -type f \( -name "*.orig" -a ! -name "$(ROOTNAME).orig" -a ! -name "$(SYSFCRONTAB).orig" \) -exec chown $(USERNAME) {} \; -exec chgrp $(GROUPNAME) {} \; -exec chmod 640 {} \; + find $(DESTDIR)$(FCRONTABS) -type f \( -name "$(ROOTNAME).orig" -o -name "$(SYSFCRONTAB).orig" \) -exec chown $(ROOTNAME) {} \; -exec chgrp $(GROUPNAME) {} \; -exec chmod 600 {} \; + find $(DESTDIR)$(FCRONTABS) -type f ! -name "*.orig" -exec chown $(ROOTNAME) {} \; -exec chgrp $(ROOTGROUP) {} \; -exec chmod 600 {} \; + + make -C doc perms + +# strip executables +strip: + strip $(DESTDIR)$(DESTSBIN)/fcron + strip $(DESTDIR)$(DESTBIN)/fcrontab + strip $(DESTDIR)$(DESTBIN)/fcronsighup +ifeq ($(FCRONDYN), 1) + strip $(DESTDIR)$(DESTBIN)/fcrondyn endif install-boot: install @@ -158,24 +230,25 @@ ifeq ($(DEBUG), 1) endif uninstall: - rm -f $(DESTSBIN)/fcron - rm -f $(DESTBIN)/fcrontab - rm -f $(DESTBIN)/fcronsighup - rm -f $(DESTBIN)/fcrondyn + rm -f $(DESTDIR)$(DESTSBIN)/fcron + rm -f $(DESTDIR)$(DESTBIN)/fcrontab + rm -f $(DESTDIR)$(DESTBIN)/fcronsighup + rm -f $(DESTDIR)$(DESTBIN)/fcrondyn make -C doc uninstall $(SRCDIR)/script/boot-uninstall clean: rm -f *.o core rm -f fcron fcrontab fcrondyn fcronsighup convert-fcrontab files/fcron.conf + make -C doc clean ciclean: clean find ./ -name "*~" -exec rm -f {} \; rm -fR autom4te* - make -C doc clean vclean: ciclean - rm -f config.log config.status config.h config.cache Makefile + rm -f config.log config.status config.h config.cache Makefile PREVIOUS_VERSION + make -C doc vclean files/fcron.conf: $(SRCDIR)/files/fcron.conf.in config.h diff --git a/config.h.in b/config.h.in index d40a71b..9984416 100644 --- a/config.h.in +++ b/config.h.in @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: config.h.in,v 1.58 2006-06-05 20:03:05 thib Exp $ */ + /* $Id: config.h.in,v 1.59 2007-01-01 18:51:50 thib Exp $ */ /* *********************************************************** */ @@ -33,11 +33,6 @@ /* beginning of configurable stuff ********************************** */ -/* fcron allow, deny and conf files are located in directory ETC (see below) */ -#define FCRON_ALLOW "fcron.allow" -#define FCRON_DENY "fcron.deny" -#define FCRON_CONF "fcron.conf" - #define SENDMAIL_ARGS "-Ffcron", "-odi" /* args of mail command */ /* *** time *** */ @@ -154,20 +149,7 @@ #undef CFLAGS /* *** paths *** */ -#undef ETC -#undef SBINDIREX -#undef BINDIREX -#undef FCRONTABS -#undef SENDMAIL #undef PROC -/* default editor */ -#undef EDITOR -/* default shell */ -#undef SHELL -/* where is located pid file ? */ -#undef PIDFILE -/* where is located fifo file ? */ -#undef FIFOFILE /* 1 if we want to compile and install fcrondyn */ #undef FCRONDYN @@ -181,7 +163,7 @@ /* Define if we should use sete[ug]id() funcs */ #undef USE_SETE_ID -/* root uid, gid, name and group */ +/* root name and group */ #undef ROOTNAME #undef ROOTGROUP diff --git a/configure.in b/configure.in index 4bef3b3..32ae9f4 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -nl Process this file with autoconf to produce a configure script. +dnl Process this file with autoconf to produce a configure script. dnl --------------------------------------------------------------------- @@ -6,14 +6,10 @@ dnl Initial settings dnl --------------------------------------------------------------------- AC_INIT(allow.c) -if test \( "$prefix" = "NONE" \) -o \( -z "$prefix" \); then - prefix="/usr" -fi -AC_PREFIX_DEFAULT($prefix) AC_CONFIG_HEADER(config.h) AC_PREREQ(2.57) -vers="3.0.2" +vers="3.0.2-rc1" vers_quoted="\"$vers\"" AC_DEFINE_UNQUOTED(VERSION, $vers) AC_DEFINE_UNQUOTED(VERSION_QUOTED, $vers_quoted) @@ -142,204 +138,151 @@ dnl --------------------------------------------------------------------- dnl Check for fcron more specific stuffs (paths, progs, ...) dnl --------------------------------------------------------------------- +fcron_enable_checks=yes +AC_ARG_ENABLE(checks, +[ --disable-checks Don't verify that programs exist on the host ], +[ case "$enableval" in + no) + fcron_enable_checks=no + ;; + yes) + fcron_enable_checks=yes + ;; + *) + AC_MSG_WARN([Bad value for --disable-checks]) + ;; + esac +]) + 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.], [ case "$withval" in no) - AC_MSG_CHECKING(sendmail) AC_MSG_WARN([ Without sendmail you won't get the output of the jobs by mail ]) + fcron_use_sendmail=no + SENDMAIL=no ;; yes) - AC_PATH_PROG(SENDMAIL, sendmail, , $PATH:/usr/lib:/usr/sbin ) - if test "$ac_cv_path_SENDMAIL" != "" ; then - AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL") - else - AC_MSG_ERROR([ -Cannot determine path to sendmail: try option --with-sendmail=PATH]) - fi ;; *) - AC_MSG_CHECKING(sendmail) - if test -x "$withval"; then - AC_DEFINE_UNQUOTED(SENDMAIL, "$withval") - AC_MSG_RESULT($withval) - else + SENDMAIL=$withval + if test $fcron_enable_checks = 'yes' -a ! -x "$withval"; then AC_MSG_ERROR([ File $withval is not an executable file]) fi ;; - esac ], [ - AC_PATH_PROG(SENDMAIL, sendmail, , $PATH:/usr/lib:/usr/sbin ) - if test "$ac_cv_path_SENDMAIL" != "" ; then - AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path_SENDMAIL") - else + 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 +fi + +AC_MSG_RESULT([$SENDMAIL]) +AC_SUBST([SENDMAIL]) +AC_PATH_PROG(FOUND_FCRON_SHELL, sh, , $PATH) +FCRON_SHELL= +AC_MSG_CHECKING(shell) AC_ARG_WITH(shell, [ --with-shell=PATH Path to default shell (by default, path to sh).], [ case "$withval" in no) - AC_MSG_CHECKING(shell) AC_MSG_ERROR(Need a default shell) ;; yes) - AC_PATH_PROG(SHELL, sh, , $PATH) - if test "$ac_cv_path_SHELL" != "" ; then - AC_DEFINE_UNQUOTED(SHELL,"$ac_cv_path_SHELL") - else - AC_MSG_ERROR([ -Cannot determine path to sh: try option --with-shell=PATH]) - fi ;; *) - AC_MSG_CHECKING(shell) - if test -x "$withval"; then - AC_DEFINE_UNQUOTED(SHELL, "$withval") - AC_MSG_RESULT($withval) - else + FCRON_SHELL=$withval + if test $fcron_enable_checks = 'yes' -a ! -x "$withval"; then AC_MSG_ERROR([ File $withval is not an executable file]) fi ;; - esac ], [ - AC_PATH_PROG(SHELL, sh, , $PATH) - if test "$ac_cv_path_SHELL" != "" ; then - AC_DEFINE_UNQUOTED(SHELL,"$ac_cv_path_SHELL") - else + esac ] +) +if test x"$FCRON_SHELL" = x ; then + FCRON_SHELL=$FOUND_FCRON_SHELL + if test "$FOUND_FCRON_SHELL" = "" ; then AC_MSG_ERROR([ Cannot determine path to sh: try option --with-shell=PATH]) - fi ] -) + fi +fi + +AC_MSG_RESULT([$FCRON_SHELL]) +AC_SUBST([FCRON_SHELL]) +AC_PATH_PROG(FOUND_FCRON_EDITOR, vi) +FCRON_EDITOR= +AC_MSG_CHECKING(editor) AC_ARG_WITH(editor, -[ --with-editor=PATH Path to default editor (by default, path to vi.], +[ --with-editor=PATH Path to default editor (by default, path to vi).], [ case "$withval" in no) - AC_MSG_CHECKING(editor) AC_MSG_ERROR([Need a default editor]) ;; yes) - AC_PATH_PROG(EDITOR, vi) - if test "$ac_cv_path_EDITOR" != "" ; then - AC_DEFINE_UNQUOTED(EDITOR,"$ac_cv_path_EDITOR") - else - AC_MSG_ERROR([ -Cannot determine path to vi: try option --with-editor=PATH]) - fi ;; *) - AC_MSG_CHECKING(editor) - if test -x "$withval"; then - AC_DEFINE_UNQUOTED(EDITOR, "$withval") - AC_MSG_RESULT($withval) - else + FCRON_EDITOR=$withval + if test $fcron_enable_checks = 'yes' -a ! -x "$withval"; then AC_MSG_ERROR([ File $withval is not an executable file]) fi ;; - esac ], [ - AC_PATH_PROG(EDITOR, vi) - if test "$ac_cv_path_EDITOR" != "" ; then - AC_DEFINE_UNQUOTED(EDITOR,"$ac_cv_path_EDITOR") - else - AC_MSG_ERROR([ -Cannot determine path to vi: try option --with-editor=PATH]) - fi ] + esac ] ) +if test x"$FCRON_EDITOR" = x; then + FCRON_EDITOR=$FOUND_FCRON_EDITOR + if test x"$FCRON_EDITOR" = x ; then + AC_MSG_ERROR([ +Cannot determine path to vi: try option --with-editor=PATH]) + fi +fi + +AC_MSG_RESULT([$FCRON_EDITOR]) +AC_SUBST([FCRON_EDITOR]) dnl --------------------------------------------------------------------- dnl Paths ... -AC_MSG_CHECKING(location of etc directory) -AC_ARG_WITH(etcdir, -[ --with-etcdir=PATH Directory containing permission files (default /etc).], -[ case "$withval" in - no) - AC_MSG_ERROR(Need ETCDIR.) - ;; - yes) - if test -d "/etc"; then - etcdir=/etc - AC_MSG_RESULT(/etc) - else - AC_MSG_ERROR([ -Directory /etc does not exist: try option --with-etcdir=PATH]) - fi - ;; - *) - if test -d "$withval"; then - etcdir="$withval" - AC_MSG_RESULT($withval) - else - AC_MSG_ERROR([ -Directory $withval does not exist]) - fi - ;; - esac ], - if test -d "/etc"; then - etcdir="/etc" - AC_MSG_RESULT(/etc) - else - AC_MSG_ERROR([ -Directory /etc does not exist: try option --with-etcdir=PATH]) - fi -) -ETC="$etcdir" -AC_DEFINE_UNQUOTED(ETC, "$etcdir") -AC_SUBST(ETC) - +PIDDIR="${localstatedir}/run" AC_MSG_CHECKING(location of pid files) AC_ARG_WITH(piddir, [ --with-piddir=PATH Directory containing pid files.], [ case "$withval" in no) - AC_MSG_ERROR(Need PIDDIR.) + AC_MSG_ERROR([Need PIDDIR.]) ;; yes) - if test -d /var/run ; then - AC_DEFINE(PIDFILE, "/var/run/fcron.pid") - AC_MSG_RESULT(/var/run) - elif test -d /usr/run ; then - AC_DEFINE(PIDFILE, "/usr/run/fcron.pid") - AC_MSG_RESULT(/usr/run) - else - AC_DEFINE_UNQUOTED(PIDFILE, "$ETC/fcron.pid") - AC_MSG_RESULT($ETC) - fi ;; *) - if test -d "$withval"; then - AC_DEFINE_UNQUOTED(PIDFILE, "$withval/fcron.pid") - AC_MSG_RESULT($withval) - else - AC_MSG_ERROR([ -Directory $withval does not exist]) - fi + PIDDIR=$withval ;; - esac ], - if test -d /var/run ; then - AC_DEFINE(PIDFILE, "/var/run/fcron.pid") - AC_MSG_RESULT(/var/run) - elif test -d /usr/run ; then - AC_DEFINE(PIDFILE, "/usr/run/fcron.pid") - AC_MSG_RESULT(/usr/run) - else - AC_DEFINE_UNQUOTED(PIDFILE, "$ETC/fcron.pid") - AC_MSG_RESULT($ETC) - fi + esac ] ) +AC_MSG_RESULT([$PIDDIR]) +PIDFILE="${PIDDIR}/fcron.pid" +AC_SUBST(PIDDIR) +AC_SUBST(PIDFILE) +FIFODIR="${localstatedir}/run" AC_MSG_CHECKING(location of fifo files) AC_ARG_WITH(fifodir, [ --with-fifodir=PATH Directory containing fifo files.], @@ -348,85 +291,39 @@ AC_ARG_WITH(fifodir, AC_MSG_ERROR(Need FIFODIR.) ;; yes) - if test -d /var/run ; then - AC_DEFINE(FIFOFILE, "/var/run/fcron.fifo") - AC_MSG_RESULT(/var/run) - elif test -d /usr/run ; then - AC_DEFINE(FIFOFILE, "/usr/run/fcron.fifo") - AC_MSG_RESULT(/usr/run) - else - AC_DEFINE_UNQUOTED(FIFOFILE, "$ETC/fcron.fifo") - AC_MSG_RESULT($ETC) - fi ;; *) - if test -d "$withval"; then - AC_DEFINE_UNQUOTED(FIFOFILE, "$withval/fcron.fifo") - AC_MSG_RESULT($withval) - else - AC_MSG_ERROR([ -Directory $withval does not exist]) - fi + FIFODIR=$withval ;; - esac ], - if test -d /var/run ; then - AC_DEFINE(FIFOFILE, "/var/run/fcron.fifo") - AC_MSG_RESULT(/var/run) - elif test -d /usr/run ; then - AC_DEFINE(FIFOFILE, "/usr/run/fcron.fifo") - AC_MSG_RESULT(/usr/run) - else - AC_DEFINE_UNQUOTED(FIFOFILE, "$ETC/fcron.fifo") - AC_MSG_RESULT($ETC) - fi + esac] ) +AC_MSG_RESULT([$FIFODIR]) +FIFOFILE="${FIFODIR}/fcron.fifo" +AC_SUBST(FIFODIR) +AC_SUBST(FIFOFILE) +sp="${localstatedir}/spool/fcron" AC_MSG_CHECKING(location of spool directory) AC_ARG_WITH(spooldir, -[ --with-spooldir=PATH Directory containing fcron spool (default /var/spool/fcron).], +[ --with-spooldir=PATH Directory containing fcron spool (default PREFIX/var/spool/fcron).], [ case "$withval" in no) AC_MSG_ERROR(Need SPOOLDIR.) ;; yes) - if test -d /var/spool/fcron ; then - sp=/var/spool/fcron - AC_MSG_RESULT(Using existing /var/spool/fcron) - elif test -d /var/spool/ ; then - sp=/var/spool/fcron - AC_MSG_RESULT(/var/spool/fcron) - elif test -d /usr/spool/ ; then - sp=/usr/spool/fcron - AC_MSG_RESULT(/usr/spool/fcron) - else - AC_MSG_ERROR([ -Cannot determine value for spool directory: try option --with-spooldir=PATH]) - fi ;; *) sp="$withval" - AC_MSG_RESULT($withval) ;; - esac ], - if test -d /var/spool/fcron ; then - sp=/var/spool/fcron - AC_MSG_RESULT(Using existing /var/spool/fcron) - elif test -d /var/spool/ ; then - sp=/var/spool/fcron - AC_MSG_RESULT(/var/spool/fcron) - elif test -d /usr/spool/ ; then - sp=/usr/spool/fcron - AC_MSG_RESULT(/usr/spool/fcron) - else - AC_MSG_ERROR([ -Cannot determine value for spool directory: try option --with-spooldir=PATH]) - fi + esac ] ) +AC_MSG_RESULT($sp) FCRONTABS="$sp" AC_DEFINE_UNQUOTED(FCRONTABS, "$sp") AC_SUBST(FCRONTABS) if test \( $getloadavg -eq 0 \) -a \( $kstat -eq 0 \); then +proc=/proc AC_MSG_CHECKING(proc directory) AC_ARG_WITH(proc, [ --with-proc=PATH Directory where linux procfs is mounted (default /proc).], @@ -438,38 +335,28 @@ Without proc, you won't be able to use the lavg* options AC_DEFINE(NOLOADAVG) ;; yes) - if test -f /proc/loadavg ; then - proc="/proc" - AC_MSG_RESULT(/proc) - else - AC_MSG_WARN([ -Cannot determine value for proc directory: try option --with-proc=PATH]) - AC_MSG_ERROR(Use --with-proc=no to disable the lavg* options) - fi ;; *) - if test -f "$withval/loadavg"; then - proc="$withval" - AC_MSG_RESULT($withval) - else - AC_MSG_ERROR(directory $withval does not exist) - fi + proc=$withval ;; - esac ], - if test -f "/proc/loadavg" ; then - proc="/proc" - AC_MSG_RESULT(/proc) + esac ] +) + +if test "$withval" != "no" -a $fcron_enable_checks = 'yes'; then + if test -f "$proc/loadavg"; then : else AC_MSG_WARN([ Cannot determine value for proc directory: try option --with-proc=PATH]) AC_MSG_ERROR(Use --with-proc=no to disable the lavg* options) fi -) -PROC="$proc" +fi + +AC_MSG_RESULT($proc) +PROC=$proc AC_DEFINE_UNQUOTED(PROC, "$proc") -AC_SUBST(PROC) fi +docdir="${datadir}/doc" AC_MSG_CHECKING(location of doc directory) AC_ARG_WITH(docdir, [ --with-docdir=PATH Directory containing documentation.], @@ -478,52 +365,16 @@ AC_ARG_WITH(docdir, AC_MSG_ERROR(Need DOCDIR.) ;; yes) - if test -d "${prefix}/share/doc" ; then - docdir="${prefix}/share/doc" - AC_MSG_RESULT(${prefix}/share/doc) - elif test -d "${prefix}/doc" ; then - docdir="${prefix}/doc" - AC_MSG_RESULT(${prefix}/doc) - elif test -d "${prefix}/local/share/doc" ; then - docdir="${prefix}/local/share/doc" - AC_MSG_RESULT(${prefix}/local/share/doc) - else - AC_MSG_ERROR([ -Cannot determine value for doc directory: try option --with-docdir=PATH]) - fi ;; *) docdir="$withval" - AC_MSG_RESULT($withval) ;; - esac ], - if test -d "${prefix}/share/doc" ; then - docdir="${prefix}/share/doc" - AC_MSG_RESULT(${prefix}/share/doc) - elif test -d "${prefix}/doc" ; then - docdir="${prefix}/doc" - AC_MSG_RESULT(${prefix}/doc) - elif test -d "${prefix}/local/share/doc" ; then - docdir="${prefix}/local/share/doc" - AC_MSG_RESULT(${prefix}/local/share/doc) - else - AC_MSG_ERROR([ -Cannot determine value for doc directory: try option --with-docdir=PATH]) - fi -) + esac ]) + +AC_MSG_RESULT($docdir) DOCDIR="$docdir" -AC_DEFINE_UNQUOTED(DOCDIR, "$docdir") AC_SUBST(DOCDIR) -dnl Check if --mandir option has been used -if test "$mandir" = "\${prefix}/man"; then - if test -d ${prefix}/share/man; then - mandir=${prefix}/share/man - fi - AC_SUBST(mandir) - AC_DEFINE_UNQUOTED(mandir, "$mandir") -fi - dnl --------------------------------------------------------------------- dnl Users and groups ... @@ -604,82 +455,80 @@ if test "$fcrondyn" = 1; then AC_SUBST(FCRONDYN) fi - -AC_MSG_CHECKING(root's username) +AC_MSG_CHECKING([root's username]) +rootname=root AC_ARG_WITH(rootname, [ --with-rootname=USERNAME Root's username (default root) ], [ case "$withval" in no) - AC_MSG_ERROR(Need rootname.) + AC_MSG_ERROR([Need rootname.]) ;; yes) - if rootuid=`$srcdir/script/has_usrgrp.pl -user root -printuid`; then - rootname=root - AC_MSG_RESULT($rootname uid: $rootuid) - else - AC_MSG_ERROR([ -Cannot determine root's username: try option --with-rootname=USERNAME]) - fi ;; *) - if rootuid=`$srcdir/script/has_usrgrp.pl -user $withval -printuid`; then rootname=$withval - AC_MSG_RESULT($rootname uid: $rootuid) - else - AC_MSG_ERROR([ -Invalid root's username : cannot find it using getpwnam()]) - fi ;; - esac ], - if rootuid=`$srcdir/script/has_usrgrp.pl -user root -printuid`; then - rootname=root - AC_MSG_RESULT($rootname uid: $rootuid) - else - AC_MSG_ERROR([ -Cannot determine root's username: try option --with-rootname=USERNAME]) - fi -) + esac +]) + +if test $fcron_enable_checks = 'yes'; then + + if ! rootuid=`$srcdir/script/has_usrgrp.pl -user $rootname -printuid`; then + AC_MSG_ERROR([ +Invalid root's username or cannot determine root's username: try option --with-rootname=USERNAME]) + fi +fi +AC_MSG_RESULT([$rootname]) -AC_MSG_CHECKING(root's groupname) + +AC_MSG_CHECKING([root's groupname]) AC_ARG_WITH(rootgroup, -[ --with-rootgroup=GROUPNAME Root's groupname (default root) ], +[ --with-rootgroup=GROUPNAME Root's groupname (default root (or wheel)) ], [ case "$withval" in no) AC_MSG_ERROR(Need rootgroup.) ;; yes) - if rootgid=`$srcdir/script/has_usrgrp.pl -group root -printgid`; then - rootgroup=root - AC_MSG_RESULT($rootgroup gid: $rootgid) - elif rootgid=`$srcdir/script/has_usrgrp.pl -group wheel -printgid`; then - rootgroup=wheel - AC_MSG_RESULT($rootgroup gid: $rootgid) - else - AC_MSG_ERROR([ -Cannot determine root's groupname: try option --with-rootgroup=GROUPNAME]) - fi ;; *) - if rootgid=`$srcdir/script/has_usrgrp.pl -group $withval -printgid`; then - rootgroup=$withval - AC_MSG_RESULT($rootgroup gid: $rootgid) - else - AC_MSG_ERROR([ -Invalid root's groupname : cannot find it using getgrnam()]) - fi + rootgroup=$withval ;; - esac ], - if rootgid=`$srcdir/script/has_usrgrp.pl -group root -printgid`; then + esac ] +) + +if test $fcron_enable_checks = 'yes'; then + + if test x"$rootgroup" = x; then + # rootgroup not defined: test a few possibilities + rgid=`$srcdir/script/has_usrgrp.pl -group root -printgid` + wgid=`$srcdir/script/has_usrgrp.pl -group wheel -printgid` + if test "x$rgid" != "x"; then + rootgid=$rgid rootgroup=root - AC_MSG_RESULT($rootgroup gid: $rootgid) - elif rootgid=`$srcdir/script/has_usrgrp.pl -group wheel -printgid`; then + elif test "x$wgid" != "x"; then + rootgid=$wgid rootgroup=wheel - AC_MSG_RESULT($rootgroup gid: $rootgid) else AC_MSG_ERROR([ Cannot determine root's groupname: try option --with-rootgroup=GROUPNAME]) fi -) + else + # rootgroup defined: check it + if ! rootgid=`$srcdir/script/has_usrgrp.pl -group $rootgroup -printgid`; then + AC_MSG_ERROR([ +Cannot determine root's groupname: try option --with-rootgroup=GROUPNAME]) + fi + fi + +else + # no check: use values given by user or default values + if test x"$rootgroup" = x ; then + rootgroup=root + fi + +fi + +AC_MSG_RESULT([$rootgroup]) ROOTNAME="$rootname" AC_SUBST(ROOTNAME) @@ -688,6 +537,7 @@ ROOTGROUP="$rootgroup" AC_SUBST(ROOTGROUP) AC_DEFINE_UNQUOTED(ROOTGROUP, "$rootgroup") + username="$rootname" groupname="$rootgroup" @@ -764,11 +614,13 @@ GROUPNAME="$groupname" AC_SUBST(GROUPNAME) AC_DEFINE_UNQUOTED(GROUPNAME, "$groupname") + if test "$has_euid" -eq 1 ; then AC_DEFINE(USE_SETE_ID) fi + sysfcrontab="systab" use_sysfcrontab=1 AC_MSG_CHECKING(use a system fcrontab) @@ -1091,15 +943,6 @@ dnl Final settings dnl --------------------------------------------------------------------- -dnl We set exec_prefix to $prefix (also done in Makefile) -exec_prefix=$prefix -BINDIREX=`eval echo $bindir` -SBINDIREX=`eval echo $sbindir` -AC_DEFINE_UNQUOTED(BINDIREX, "$BINDIREX") -AC_DEFINE_UNQUOTED(SBINDIREX, "$SBINDIREX") -AC_SUBST(BINDIREX) -AC_SUBST(SBINDIREX) - AC_OUTPUT(Makefile doc/Makefile doc/stylesheets/fcron-doc.dsl) @@ -1139,17 +982,6 @@ else echo "no" fi -echo "fcron's user (resp. group) name : $username (resp. $groupname)" - -echo -n "sysfcrontab : " -if test "$use_sysfcrontab" -eq 1; then - echo "yes ($sysfcrontab)" -else - echo "no" -fi - -echo "spooldir : $sp" - echo -n "Load average support : " if test "$getloadavg" -eq 1 -o ! -z "$proc"; then echo "yes" @@ -1164,6 +996,22 @@ else echo "no" fi +echo "fcron's user (resp. group) name : $username (resp. $groupname)" + +echo -n "sysfcrontab : " +if test "$use_sysfcrontab" -eq 1; then + echo "yes ($sysfcrontab)" +else + echo "no" +fi + +echo "prefix: $prefix" +echo "spool dir: $sp" +echo "etc dir: $sysconfdir" +echo "doc dir: $docdir" +echo "man dir: $mandir" + + echo echo "You can now run 'make' to compile" echo "and then (as root) 'make install' to install fcron." diff --git a/doc/Makefile.in b/doc/Makefile.in index 01a4491..c665947 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -4,7 +4,7 @@ # @configure_input@ -# $Id: Makefile.in,v 1.26 2006-05-20 16:33:12 thib Exp $ +# $Id: Makefile.in,v 1.27 2007-01-01 18:53:51 thib Exp $ # The following should not be edited manually (use configure options) # If you must do it, BEWARE: some of the following is also defined @@ -15,8 +15,8 @@ SRCDIR = @srcdir@ prefix = @prefix@ -DESTMAN = $(DESTDIR)@mandir@ -DESTDOC = $(DESTDIR)@DOCDIR@ +DESTMAN = @mandir@ +DESTDOC = @DOCDIR@ INSTALL = @INSTALL@ JADE = @JADE@ @@ -41,7 +41,7 @@ LANGUAGES = en fr # this is a regular expression: # do not ci these files -RCSNOCI=.*\(bitstring.3\|fcron-doc.ced\|Makefile\|stylesheets/fcron-doc.dsl\|fcron-doc.mod\|HTML.*\|txt.*\|man\/.*\|CVS.*\) +RCSNOCI=.*\(bitstring.3\|fcron-doc.ced\|Makefile\|${STYLESHEET}\|fcron-doc.mod\|HTML.*\|txt.*\|man\/.*\|CVS.*\) all: doc @@ -53,7 +53,7 @@ doc: done) # man/fcron.8 means in fact "build *all* the man pages" -%/man/fcron.8: %/*.sgml fcron-doc.mod stylesheets/fcron-doc.dsl.in +%/man/fcron.8: %/*.sgml fcron-doc.mod ${STYLESHEET}.in @(if test -z "$(DB2MAN_BEFORE)"; then \ echo "ERROR: cannot generate man pages." ; \ echo " Please check if a db2man converter is installed, or if" \ @@ -89,51 +89,89 @@ fcron-doc.mod: fcron-doc.mod.in ../configure.in @(../script/gen-in.pl fcron-doc.mod.in fcron-doc.mod ../) # HTML/index.html means in fact "build *all* the HTML pages" -%/HTML/index.html: %/*.sgml fcron-doc.mod stylesheets/fcron-doc.dsl.in +%/HTML/index.html: %/*.sgml fcron-doc.mod ${STYLESHEET}.in @(echo ; echo "Building $(@D)...") @(rm -fR $(@D)/*.html) - @(cd $(@D)/../ ; $(JADE) -D ../ -D ./ -t sgml -i html -d ../stylesheets/fcron-doc.dsl\#html fcron-doc.sgml) + @(cd $(@D)/../ ; $(JADE) -D ../ -D ./ -t sgml -i html -d ../${STYLESHEET}\#html fcron-doc.sgml) -install: clean - @(echo "Installing man pages in $(DESTMAN)...") +install: install-staged perms + +install-staged: clean + @(echo "Installing man pages in $(DESTDIR)$(DESTMAN)...") @(for l in $(LANGUAGES); do \ if test "x$$l" = "xen"; then \ - DIR=$(DESTMAN); \ + DIR=$(DESTDIR)$(DESTMAN); \ else \ - DIR=$(DESTMAN)/$$l; \ + DIR=$(DESTDIR)$(DESTMAN)/$$l; \ fi ; \ for i in 1 3 5 8; do \ if test ! -d $$DIR/man$$i; then \ - $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $$DIR/man$$i ; \ + $(INSTALL) -m 755 -d $$DIR/man$$i ; \ fi ; \ - $(INSTALL) -m 644 -o $(ROOTNAME) $(SRCDIR)/$$l/man/*.$$i $$DIR/man$$i ; \ + $(INSTALL) -m 644 $(SRCDIR)/$$l/man/*.$$i $$DIR/man$$i ; \ done ; \ done ) - @(echo "Installing documentation files in $(DESTDOC)/fcron-$(VERSION)...") - @(if test ! -d $(DESTDOC)/fcron-$(VERSION); then $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $(DESTDOC)/fcron-$(VERSION) ; fi) + @(echo "Installing documentation files in $(DESTDIR)$(DESTDOC)/fcron-$(VERSION)...") + @(if test ! -d $(DESTDIR)$(DESTDOC)/fcron-$(VERSION); then $(INSTALL) -m 755 -d $(DESTDIR)$(DESTDOC)/fcron-$(VERSION) ; fi) @(for l in $(LANGUAGES); do \ - DIR=$(DESTDOC)/fcron-$(VERSION) ; \ + DIR=$(DESTDIR)$(DESTDOC)/fcron-$(VERSION) ; \ if test ! -d $$DIR/$$l; then \ - $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $$DIR/$$l ; \ + $(INSTALL) -m 755 -d $$DIR/$$l ; \ fi ; \ for i in txt HTML; do \ if test ! -d $$DIR/$$l/$$i; then \ - $(INSTALL) -g $(ROOTGROUP) -o $(ROOTNAME) -m 755 -d $$DIR/$$l/$$i ; \ + $(INSTALL) -m 755 -d $$DIR/$$l/$$i ; \ fi ; \ - $(INSTALL) -m 644 -o $(ROOTNAME) $$l/$$i/* $$DIR/$$l/$$i/ ;\ + $(INSTALL) -m 644 $(SRCDIR)/$$l/$$i/* $$DIR/$$l/$$i/ ;\ done ; \ done ) +perms: + for l in $(LANGUAGES); do \ + if test "x$$l" = "xen"; then \ + DIR=$(DESTDIR)$(DESTMAN); \ + else \ + DIR=$(DESTDIR)$(DESTMAN)/$$l; \ + fi ; \ + chown $(ROOTNAME) $$DIR; \ + chgrp $(ROOTGROUP) $$DIR; \ + for i in 1 3 5 8; do \ + chown $(ROOTNAME) $$DIR/man$$i; \ + chgrp $(ROOTGROUP) $$DIR/man$$i; \ + done ; \ + for f in man1/fcrontab.1 man1/fcrondyn.1 man3/bitstring.3 \ + man5/fcrontab.5 man5/fcron.conf.5 man8/fcron.8 ; do \ + chown $(ROOTNAME) $$DIR/$$f; \ + chgrp $(ROOTGROUP) $$DIR/$$f; \ + done ; \ + done + chown $(ROOTNAME) $(DESTDIR)$(DESTDOC) + chgrp $(ROOTGROUP) $(DESTDIR)$(DESTDOC) + chown $(ROOTNAME) $(DESTDIR)$(DESTDOC)/fcron-$(VERSION) + chgrp $(ROOTGROUP) $(DESTDIR)$(DESTDOC)/fcron-$(VERSION) + for l in $(LANGUAGES); do \ + DIR=$(DESTDIR)$(DESTDOC)/fcron-$(VERSION)/$$l ; \ + chown $(ROOTNAME) $$DIR ; \ + chgrp $(ROOTGROUP) $$DIR ; \ + for i in txt HTML; do \ + chown $(ROOTNAME) $$DIR/$$i; \ + chgrp $(ROOTGROUP) $$DIR/$$i; \ + chown $(ROOTNAME) $$DIR/$$i/*; \ + chgrp $(ROOTGROUP) $$DIR/$$i/*; \ + done ; \ + done + + uninstall: rm -fR $(DESTDOC)/fcron-$(VERSION) @(echo "Removing man pages ...") @(for l in $(LANGUAGES); do \ if test "x$$l" = "xen"; then \ - DIR=$(DESTMAN); \ + DIR=$(DESTDIR)$(DESTMAN); \ else \ - DIR=$(DESTMAN)/$$l; \ + DIR=$(DESTDIR)$(DESTMAN)/$$l; \ fi ; \ rm -f $$DIR/man1/fcrontab.1 ; \ rm -f $$DIR/man1/fcrondyn.1 ; \ @@ -156,10 +194,11 @@ clean: done) tarclean: clean - rm -f Makefile stylesheets/fcron-doc.dsl fcron-doc.mod + rm -f Makefile ${STYLESHEET} fcron-doc.mod vclean: clean - rm -f */HTML/* */man/* */txt/* +# rm -f */HTML/* */man/* */txt/* + rm -f Makefile ${STYLESHEET} ci: clean # we run a "cd .." because it makes appear the path of the file ( ./doc/XXXX ) diff --git a/doc/fcron-doc.mod.in b/doc/fcron-doc.mod.in index a2b8f81..91c878d 100644 --- a/doc/fcron-doc.mod.in +++ b/doc/fcron-doc.mod.in @@ -15,7 +15,7 @@ &webpageadr/files/fcron-doc-html.tar.gz'> &webpageadr/files/fcron-doc-html.tar.gz'> - + @@ -33,7 +33,7 @@ - + diff --git a/script/gen-in.pl b/script/gen-in.pl index b5c340d..fa2e8d7 100755 --- a/script/gen-in.pl +++ b/script/gen-in.pl @@ -9,14 +9,14 @@ # ex : "@@VERSION@" will be substitute by "0.8.4" # # + substitute "@@Date@" by the current date - +# +# USAGE: gen-in.pl %map = (); open(CONFIG, "$ARGV[2]/config.h") or print "error while opening config.h\n" and exit; - while ( ) { if ( /^\#define\s+(\w+?)\s+([\w\/-]+?)\s/ ) { $map{$1} = $2; @@ -26,18 +26,24 @@ while ( ) { } } +close(CONFIG); open(MAKEFILE, "$ARGV[2]/Makefile") or print "error while opening Makefile\n" and exit; - while ( ) { - if ( /^\s*?(\w+?)\s*?=\s*?([\w\.\/-]+)\s/ ) { - $map{$1} = $2; + if ( /^\s*?(\w+?)\s*?=\s*?([^\s]+)\s/ ) { + $name = $1; + $value = $2; + + # replace all occurrences of Makefile variables of the form ${VAR} by their values + $value =~ s/\$\{([^\}]+)\}/$map{$1}/g; + + $map{$name} = $value; } if ( /^\#define\s+(\w+?)\s+["](.+)["]\s/ ) { $map{$1} = $2; } - } +close(MAKEFILE); chop ($map{Date} = `date +%m/%d/%Y`); @@ -49,3 +55,6 @@ while ( ) { print DEST $_; } + +close(SRC); +close(DEST); diff --git a/subs.c b/subs.c index 30705e0..c7afea0 100644 --- a/subs.c +++ b/subs.c @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: subs.c,v 1.25 2006-05-20 16:29:41 thib Exp $ */ + /* $Id: subs.c,v 1.26 2007-01-01 18:53:10 thib Exp $ */ #include "global.h" #include "subs.h" @@ -153,13 +153,13 @@ init_conf(void) fcronallow = strdup2(ETC "/" FCRON_ALLOW); fcrondeny = strdup2(ETC "/" FCRON_DENY); /* // */ - /* shell = strdup2(SHELL); */ + /* shell = strdup2(FCRON_SHELL); */ shell = strdup2(""); #ifdef SENDMAIL sendmail = strdup2(SENDMAIL); #endif - editor = strdup2(EDITOR); + editor = strdup2(FCRON_EDITOR); } void