unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] configure: use cc/c++ when GCC not installed
@ 2014-05-21  8:58 Fraser Tweedale
  2014-05-21 19:50 ` Tomi Ollila
  2014-05-22  3:49 ` [PATCH] " Felipe Contreras
  0 siblings, 2 replies; 9+ messages in thread
From: Fraser Tweedale @ 2014-05-21  8:58 UTC (permalink / raw)
  To: notmuch; +Cc: Fraser Tweedale

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
+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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] configure: use cc/c++ when GCC not installed
  2014-05-21  8:58 [PATCH] configure: use cc/c++ when GCC not installed Fraser Tweedale
@ 2014-05-21 19:50 ` Tomi Ollila
  2014-05-21 20:09   ` David Bremner
  2014-05-22  3:49 ` [PATCH] " Felipe Contreras
  1 sibling, 1 reply; 9+ messages in thread
From: Tomi Ollila @ 2014-05-21 19:50 UTC (permalink / raw)
  To: Fraser Tweedale, notmuch

On Wed, May 21 2014, Fraser Tweedale <frase@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@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] configure: use cc/c++ when GCC not installed
  2014-05-21 19:50 ` Tomi Ollila
@ 2014-05-21 20:09   ` David Bremner
  2014-05-21 22:21     ` Tomi Ollila
  0 siblings, 1 reply; 9+ messages in thread
From: David Bremner @ 2014-05-21 20:09 UTC (permalink / raw)
  To: Tomi Ollila, Fraser Tweedale, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:
>
> 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

I thought "command -v" was the posix way of testing for a binary?

d

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] configure: use cc/c++ when GCC not installed
  2014-05-21 20:09   ` David Bremner
@ 2014-05-21 22:21     ` Tomi Ollila
  2014-05-22 10:12       ` [PATCH v3] " Fraser Tweedale
  0 siblings, 1 reply; 9+ messages in thread
From: Tomi Ollila @ 2014-05-21 22:21 UTC (permalink / raw)
  To: David Bremner, Fraser Tweedale, notmuch

On Wed, May 21 2014, David Bremner <david@tethera.net> wrote:

> Tomi Ollila <tomi.ollila@iki.fi> writes:
>>
>> 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
>
> I thought "command -v" was the posix way of testing for a binary?


Ok, I wrote quite a few lines why hash instead of command -v,
just to finally notice this:

$ dash -c 'hash zapdsb || echo foo'
dash: 1: hash: zapdsb : not found
foo

which is ok... but:

$ ksh -c 'hash zapdsb || echo foo'
$ mksh -c 'hash zapdsb || echo foo'

Wat! hash in these shells do not exit nonzero -- so good with my which(1)
rant >;/

So I change my preference totally -- `command -v` instead of `hash` -- we
have to fix the current uses of `hash` too...


> d


Tomi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] configure: use cc/c++ when GCC not installed
  2014-05-21  8:58 [PATCH] configure: use cc/c++ when GCC not installed Fraser Tweedale
  2014-05-21 19:50 ` Tomi Ollila
@ 2014-05-22  3:49 ` Felipe Contreras
  2014-05-22  4:04   ` Fraser Tweedale
  2014-05-22 10:10   ` [PATCH v2] configure: use cc/c++ instead of gcc/g++ Fraser Tweedale
  1 sibling, 2 replies; 9+ messages in thread
From: Felipe Contreras @ 2014-05-22  3:49 UTC (permalink / raw)
  To: Fraser Tweedale, notmuch; +Cc: Fraser Tweedale

Fraser Tweedale 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++}

Why not just use cc and c++?

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] configure: use cc/c++ when GCC not installed
  2014-05-22  3:49 ` [PATCH] " Felipe Contreras
@ 2014-05-22  4:04   ` Fraser Tweedale
  2014-05-22 10:10   ` [PATCH v2] configure: use cc/c++ instead of gcc/g++ Fraser Tweedale
  1 sibling, 0 replies; 9+ messages in thread
From: Fraser Tweedale @ 2014-05-22  4:04 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

On Wed, May 21, 2014 at 10:49:03PM -0500, Felipe Contreras wrote:
> Fraser Tweedale 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++}
> 
> Why not just use cc and c++?
 
I intended to change the behaviour as little as possible, however,
if you and others are satisfied to simply use cc/c++ then I will
make it so.

> -- 
> Felipe Contreras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] configure: use cc/c++ instead of gcc/g++
  2014-05-22  3:49 ` [PATCH] " Felipe Contreras
  2014-05-22  4:04   ` Fraser Tweedale
@ 2014-05-22 10:10   ` Fraser Tweedale
  2014-07-04 12:03     ` David Bremner
  1 sibling, 1 reply; 9+ messages in thread
From: Fraser Tweedale @ 2014-05-22 10:10 UTC (permalink / raw)
  To: notmuch; +Cc: Fraser Tweedale

Some systems (e.g. FreeBSD 10) do not ship with the GNU Compiler
Collection.  Use generic cc/c++ instead of gcc/g++ (unless the
CC/CXX environment variables are used).
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 9bde2eb..7d015c6 100755
--- a/configure
+++ b/configure
@@ -43,8 +43,8 @@ fi
 
 # Set several defaults (optionally specified by the user in
 # environment variables)
-CC=${CC:-gcc}
-CXX=${CXX:-g++}
+CC=${CC:-cc}
+CXX=${CXX:-c++}
 CFLAGS=${CFLAGS:--O2}
 CPPFLAGS=${CPPFLAGS:-}
 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3] configure: use cc/c++ when GCC not installed
  2014-05-21 22:21     ` Tomi Ollila
@ 2014-05-22 10:12       ` Fraser Tweedale
  0 siblings, 0 replies; 9+ messages in thread
From: Fraser Tweedale @ 2014-05-22 10:12 UTC (permalink / raw)
  To: notmuch; +Cc: Fraser Tweedale

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..59ab87b 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 command -v gcc >/dev/null; then
+    CC=${CC:-gcc}
+else
+    CC=${CC:-cc}
+fi
+if command -v g++ >/dev/null; then
+    CXX=${CXX:-g++}
+else
+    CXX=${CXX:-c++}
+fi
 CFLAGS=${CFLAGS:--O2}
 CPPFLAGS=${CPPFLAGS:-}
 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] configure: use cc/c++ instead of gcc/g++
  2014-05-22 10:10   ` [PATCH v2] configure: use cc/c++ instead of gcc/g++ Fraser Tweedale
@ 2014-07-04 12:03     ` David Bremner
  0 siblings, 0 replies; 9+ messages in thread
From: David Bremner @ 2014-07-04 12:03 UTC (permalink / raw)
  To: Fraser Tweedale, notmuch; +Cc: Fraser Tweedale

Fraser Tweedale <frase@frase.id.au> writes:

> Some systems (e.g. FreeBSD 10) do not ship with the GNU Compiler
> Collection.  Use generic cc/c++ instead of gcc/g++ (unless the
> CC/CXX environment variables are used).

pushed to master.

d

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-07-04 12:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-21  8:58 [PATCH] configure: use cc/c++ when GCC not installed Fraser Tweedale
2014-05-21 19:50 ` Tomi Ollila
2014-05-21 20:09   ` David Bremner
2014-05-21 22:21     ` Tomi Ollila
2014-05-22 10:12       ` [PATCH v3] " Fraser Tweedale
2014-05-22  3:49 ` [PATCH] " Felipe Contreras
2014-05-22  4:04   ` Fraser Tweedale
2014-05-22 10:10   ` [PATCH v2] configure: use cc/c++ instead of gcc/g++ Fraser Tweedale
2014-07-04 12:03     ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).