emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Unbreak `make install' in leim/ when leim's ${INSTALLDIR} do


From: David Kastrup
Subject: Re: [PATCH] Unbreak `make install' in leim/ when leim's ${INSTALLDIR} doesn't exist
Date: Thu, 12 Oct 2006 14:52:26 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Giorgos Keramidas <address@hidden> writes:

> I just pulled the changes from CVS.
>
> It seems to include this part:
>
> +       if [ ! -d ${INSTALLDIR} ] ; then \
> +          ${srcdir}/${dot}${dot}/mkinstalldirs ${INSTALLDIR}; \
> +       else true; fi
>
> We don't really *need* to have an else branch in all statements.  We can
> write this as:
>
> +       if [ ! -d ${INSTALLDIR} ] ; then \
> +          ${srcdir}/${dot}${dot}/mkinstalldirs ${INSTALLDIR}; \
> +       fi

This disagrees with
(info "(autoconf) Limitations of Builtins")

    `if'
[...]
     There are shells that do not reset the exit status from an `if':

          $ if (exit 42); then true; fi; echo $?
          42

     whereas a proper shell should have printed `0'.  This is especially
     bad in Makefiles since it produces false failures.  This is why
     properly written Makefiles, such as Automake's, have such hairy
     constructs:

          if test -f "$file"; then
            install "$file" "$dest"
          else
            :
          fi


Note that you can often use `||' instead of `if', then this is not as
ugly.  Also note that `:' may actually more portable than `true'
according to the same source:

`true'
     Don't worry: as far as we know `true' is portable.  Nevertheless,
     it's not always a builtin (e.g., Bash 1.x), and the portable shell
     community tends to prefer using `:'.  This has a funny side
     effect: when asked whether `false' is more portable than `true'
     Alexandre Oliva answered:

          In a sense, yes, because if it doesn't exist, the shell will
          produce an exit status of failure, which is correct for
          `false', but not for `true'.


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

[Prev in Thread] Current Thread [Next in Thread]