[PATCH] configure: use cc/c++ when GCC not installed

Tomi Ollila tomi.ollila at iki.fi
Wed May 21 12:50:42 PDT 2014


On Wed, May 21 2014, Fraser Tweedale <frase at frase.id.au> wrote:

> Some systems (e.g. FreeBSD 10) do not ship with the GNU Compiler
> Collection.  Use generic cc/c++ as a fallback when gcc/g++ are not
> available.
> ---
>  configure | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 9bde2eb..3f4942b 100755
> --- a/configure
> +++ b/configure
> @@ -43,8 +43,16 @@ fi
>  
>  # Set several defaults (optionally specified by the user in
>  # environment variables)
> -CC=${CC:-gcc}
> -CXX=${CXX:-g++}
> +if which gcc >/dev/null 2>&1; then
> +    CC=${CC:-gcc}
> +else
> +    CC=${CC:-cc}
> +fi

perhaps:

if [ -z "$CC" ]; then
   if hash gcc 2>/dev/null; then
   	CC=gcc
   else 
   	CC=cc
   fi
fi

and same for g++

hash is builtin in modern shells, and is command in some systems
which(1) is builtin in zsh (only?). Solaris 10 which(1) exits 0
even the command is not found.

Tomi


> +if which g++ >/dev/null 2>&1; then
> +    CXX=${CXX:-g++}
> +else
> +    CXX=${CXX:-c++}
> +fi
>  CFLAGS=${CFLAGS:--O2}
>  CPPFLAGS=${CPPFLAGS:-}
>  CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
> -- 
> 1.9.2
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list