* configure tool
@ 2015-05-19 18:31 Ronny Chevalier
2015-05-19 19:01 ` David Bremner
0 siblings, 1 reply; 12+ messages in thread
From: Ronny Chevalier @ 2015-05-19 18:31 UTC (permalink / raw)
To: notmuch
Hi,
I'm curious about the reason behind choosing to do your own configure
tool instead of using tools like autotools or cmake?
Because for me it increases the chance to introduce bugs in the build
system since you are redeveloping tests to know whether a library is
present or not, the system to check if a flag is supported by the
compiler, to check if a function is present, to manage different
platforms,... All of these things are provided by tools like autotools
or cmake.
For example, I noticed that the part that check if the compiler
options are supported, is not working. Try adding a flag supported by
gcc but not by clang and use clang to compile or vice-versa.
Thanks
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: configure tool
2015-05-19 18:31 configure tool Ronny Chevalier
@ 2015-05-19 19:01 ` David Bremner
2015-05-19 19:08 ` Ronny Chevalier
0 siblings, 1 reply; 12+ messages in thread
From: David Bremner @ 2015-05-19 19:01 UTC (permalink / raw)
To: Ronny Chevalier, notmuch
Ronny Chevalier <chevalier.ronny@gmail.com> writes:
> Hi,
>
> I'm curious about the reason behind choosing to do your own configure
> tool instead of using tools like autotools or cmake?
I guess the most relevant discussion is not that recent:
http://mid.gmane.org/1258897630-22282-1-git-send-email-jeff@ocjtech.us
and to a lesser extent the discussion starting atL
http://article.gmane.org/gmane.mail.notmuch.general/635
> For example, I noticed that the part that check if the compiler
> options are supported, is not working. Try adding a flag supported by
> gcc but not by clang and use clang to compile or vice-versa.
Sure, of course there can be bugs, just as in any configuration system.
Can you give a more specific recipe to reproduce it?
Thanks,
d
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: configure tool
2015-05-19 19:01 ` David Bremner
@ 2015-05-19 19:08 ` Ronny Chevalier
2015-05-19 20:52 ` [PATCH] configure: Add sanity checking for environment variables David Bremner
0 siblings, 1 reply; 12+ messages in thread
From: Ronny Chevalier @ 2015-05-19 19:08 UTC (permalink / raw)
To: David Bremner; +Cc: notmuch
On Tue, May 19, 2015 at 9:01 PM, David Bremner <david@tethera.net> wrote:
> Ronny Chevalier <chevalier.ronny@gmail.com> writes:
>
>> Hi,
>>
>> I'm curious about the reason behind choosing to do your own configure
>> tool instead of using tools like autotools or cmake?
>
> I guess the most relevant discussion is not that recent:
>
> http://mid.gmane.org/1258897630-22282-1-git-send-email-jeff@ocjtech.us
>
> and to a lesser extent the discussion starting atL
>
> http://article.gmane.org/gmane.mail.notmuch.general/635
>
Ok thanks I will look into it.
>> For example, I noticed that the part that check if the compiler
>> options are supported, is not working. Try adding a flag supported by
>> gcc but not by clang and use clang to compile or vice-versa.
>
> Sure, of course there can be bugs, just as in any configuration system.
> Can you give a more specific recipe to reproduce it?
Yeah I forgot to provide an example sorry.
-Wdouble-promotion for example is available on gcc but not clang and
it is still added to the command line when using clang. I think this
is because clang does not return an error code, but just prints a
warning.
>
> Thanks,
>
> d
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] configure: Add sanity checking for environment variables
2015-05-19 19:08 ` Ronny Chevalier
@ 2015-05-19 20:52 ` David Bremner
2015-05-19 21:11 ` Tomi Ollila
0 siblings, 1 reply; 12+ messages in thread
From: David Bremner @ 2015-05-19 20:52 UTC (permalink / raw)
To: Ronny Chevalier, David Bremner; +Cc: notmuch
Passing in environment variables incompatible with the compiler may
cause other parts of the configure script to fail in hard to
understand ways, so we abort early.
---
This doesn't actually fix the problem Ronny points out, but a more
serious one where configure can actually fail when using gcc, if
e.g. nonsense is passed in CFLAGS.
configure | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 4af7ba9..cf618e8 100755
--- a/configure
+++ b/configure
@@ -269,6 +269,34 @@ dependencies are available:
EOF
errors=0
+printf "int main(void){return 0;}\n" > minimal.c
+
+printf "Sanity checking C compilation environment... "
+if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
+then
+ printf "Ok.\n"
+else
+ printf "Fail.\n"
+ errors=$((errors + 1))
+fi
+
+printf "Sanity checking C++ compilation environment... "
+if ${CXX} ${CXXFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
+then
+ printf "Ok.\n"
+else
+ printf "Fail.\n"
+ errors=$((errors + 1))
+fi
+
+if [ $errors -gt 0 ]; then
+ cat <<EOF
+*** Error: Initial sanity checking of environment failed. Please try
+running configure in a clean environment, and if the problem persists,
+report a bug.
+EOF
+ exit 1
+fi
if pkg-config --version > /dev/null 2>&1; then
have_pkg_config=1
@@ -690,8 +718,6 @@ else
fi
rm -f compat/check_asctime
-printf "int main(void){return 0;}\n" > minimal.c
-
printf "Checking for rpath support... "
if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
then
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] configure: Add sanity checking for environment variables
2015-05-19 20:52 ` [PATCH] configure: Add sanity checking for environment variables David Bremner
@ 2015-05-19 21:11 ` Tomi Ollila
2015-05-20 8:12 ` David Bremner
0 siblings, 1 reply; 12+ messages in thread
From: Tomi Ollila @ 2015-05-19 21:11 UTC (permalink / raw)
To: David Bremner, Ronny Chevalier; +Cc: notmuch
On Tue, May 19 2015, David Bremner <david@tethera.net> wrote:
> Passing in environment variables incompatible with the compiler may
> cause other parts of the configure script to fail in hard to
> understand ways, so we abort early.
> ---
>
> This doesn't actually fix the problem Ronny points out, but a more
> serious one where configure can actually fail when using gcc, if
> e.g. nonsense is passed in CFLAGS.
>
> configure | 30 ++++++++++++++++++++++++++++--
> 1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 4af7ba9..cf618e8 100755
> --- a/configure
> +++ b/configure
> @@ -269,6 +269,34 @@ dependencies are available:
> EOF
>
> errors=0
> +printf "int main(void){return 0;}\n" > minimal.c
> +
> +printf "Sanity checking C compilation environment... "
> +if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
Looks good, but there is 2 spcs ^^ there (and same in CXX part)...
... also minimal.c is not removed if we exit early.
In the future we could think of writing all temp files to a subdirectory
which is cleared out using trap -- then we could drop all temp file
deletions... but now simple rm -f minimal minimal.c suffices
Tomi
> +then
> + printf "Ok.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
> +
> +printf "Sanity checking C++ compilation environment... "
> +if ${CXX} ${CXXFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
> +then
> + printf "Ok.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
> +
> +if [ $errors -gt 0 ]; then
> + cat <<EOF
> +*** Error: Initial sanity checking of environment failed. Please try
> +running configure in a clean environment, and if the problem persists,
> +report a bug.
> +EOF
> + exit 1
> +fi
>
> if pkg-config --version > /dev/null 2>&1; then
> have_pkg_config=1
> @@ -690,8 +718,6 @@ else
> fi
> rm -f compat/check_asctime
>
> -printf "int main(void){return 0;}\n" > minimal.c
> -
> printf "Checking for rpath support... "
> if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
> then
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] configure: Add sanity checking for environment variables
2015-05-19 21:11 ` Tomi Ollila
@ 2015-05-20 8:12 ` David Bremner
2015-05-20 8:37 ` Tomi Ollila
2015-05-20 8:48 ` Tomi Ollila
0 siblings, 2 replies; 12+ messages in thread
From: David Bremner @ 2015-05-20 8:12 UTC (permalink / raw)
To: Tomi Ollila, David Bremner, Ronny Chevalier; +Cc: notmuch
Passing in environment variables incompatible with the compiler may
cause other parts of the configure script to fail in hard to
understand ways, so we abort early.
---
meh, the previous version was borken by lazy evaluation of CXXFLAGS
using make syntax. Better suggestions for how to do this?
configure | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 4af7ba9..650b976 100755
--- a/configure
+++ b/configure
@@ -269,6 +269,35 @@ dependencies are available:
EOF
errors=0
+printf "int main(void){return 0;}\n" > minimal.c
+
+printf "Sanity checking C compilation environment... "
+if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
+then
+ printf "OK.\n"
+else
+ printf "Fail.\n"
+ errors=$((errors + 1))
+fi
+
+printf "Sanity checking C++ compilation environment... "
+if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
+then
+ printf "OK.\n"
+else
+ printf "Fail.\n"
+ errors=$((errors + 1))
+fi
+
+if [ $errors -gt 0 ]; then
+ cat <<EOF
+*** Error: Initial sanity checking of environment failed. Please try
+running configure in a clean environment, and if the problem persists,
+report a bug.
+EOF
+ rm -f minimal minimal.c
+ exit 1
+fi
if pkg-config --version > /dev/null 2>&1; then
have_pkg_config=1
@@ -690,8 +719,6 @@ else
fi
rm -f compat/check_asctime
-printf "int main(void){return 0;}\n" > minimal.c
-
printf "Checking for rpath support... "
if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
then
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] configure: Add sanity checking for environment variables
2015-05-20 8:12 ` David Bremner
@ 2015-05-20 8:37 ` Tomi Ollila
2015-05-20 8:41 ` Tomi Ollila
2015-05-20 8:48 ` Tomi Ollila
1 sibling, 1 reply; 12+ messages in thread
From: Tomi Ollila @ 2015-05-20 8:37 UTC (permalink / raw)
To: David Bremner, David Bremner, Ronny Chevalier; +Cc: notmuch
On Wed, May 20 2015, David Bremner <david@tethera.net> wrote:
> Passing in environment variables incompatible with the compiler may
> cause other parts of the configure script to fail in hard to
> understand ways, so we abort early.
> ---
>
> meh, the previous version was borken by lazy evaluation of CXXFLAGS
> using make syntax. Better suggestions for how to do this?
>
> configure | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 4af7ba9..650b976 100755
> --- a/configure
> +++ b/configure
> @@ -269,6 +269,35 @@ dependencies are available:
> EOF
>
> errors=0
> +printf "int main(void){return 0;}\n" > minimal.c
> +
> +printf "Sanity checking C compilation environment... "
> +if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
still 2 spaces ----------------^
> +then
> + printf "OK.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
> +
> +printf "Sanity checking C++ compilation environment... "
> +if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
${CXXFLAGS:-$CFLAGS} ?
> +then
> + printf "OK.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
> +
> +if [ $errors -gt 0 ]; then
> + cat <<EOF
> +*** Error: Initial sanity checking of environment failed. Please try
> +running configure in a clean environment, and if the problem persists,
> +report a bug.
> +EOF
> + rm -f minimal minimal.c
> + exit 1
> +fi
>
> if pkg-config --version > /dev/null 2>&1; then
> have_pkg_config=1
> @@ -690,8 +719,6 @@ else
> fi
> rm -f compat/check_asctime
>
> -printf "int main(void){return 0;}\n" > minimal.c
> -
> printf "Checking for rpath support... "
> if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
> then
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] configure: Add sanity checking for environment variables
2015-05-20 8:37 ` Tomi Ollila
@ 2015-05-20 8:41 ` Tomi Ollila
0 siblings, 0 replies; 12+ messages in thread
From: Tomi Ollila @ 2015-05-20 8:41 UTC (permalink / raw)
To: David Bremner, David Bremner, Ronny Chevalier; +Cc: notmuch
On Wed, May 20 2015, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Wed, May 20 2015, David Bremner <david@tethera.net> wrote:
>
>> Passing in environment variables incompatible with the compiler may
>> cause other parts of the configure script to fail in hard to
>> understand ways, so we abort early.
>> ---
>>
>> meh, the previous version was borken by lazy evaluation of CXXFLAGS
>> using make syntax. Better suggestions for how to do this?
>>
>> configure | 31 +++++++++++++++++++++++++++++--
>> 1 file changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 4af7ba9..650b976 100755
>> --- a/configure
>> +++ b/configure
>> @@ -269,6 +269,35 @@ dependencies are available:
>> EOF
>>
>> errors=0
>> +printf "int main(void){return 0;}\n" > minimal.c
>> +
>> +printf "Sanity checking C compilation environment... "
>> +if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
>
> still 2 spaces ----------------^
>
>> +then
>> + printf "OK.\n"
>> +else
>> + printf "Fail.\n"
>> + errors=$((errors + 1))
>> +fi
>> +
>> +printf "Sanity checking C++ compilation environment... "
>> +if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
>
> ${CXXFLAGS:-$CFLAGS} ?
of course not... I did not find any definition for CXXFLAGS_for_sh....
... so
case $CXXFLAGS
in *'(CFLAGS)'*) CXXFLAGS_for_sh=$CFLAGS
;; *) CXXFLAGS_for_sh=CXXFLAGS
esac
>
>> +then
>> + printf "OK.\n"
>> +else
>> + printf "Fail.\n"
>> + errors=$((errors + 1))
>> +fi
>> +
>> +if [ $errors -gt 0 ]; then
>> + cat <<EOF
>> +*** Error: Initial sanity checking of environment failed. Please try
>> +running configure in a clean environment, and if the problem persists,
>> +report a bug.
>> +EOF
>> + rm -f minimal minimal.c
>> + exit 1
>> +fi
>>
>> if pkg-config --version > /dev/null 2>&1; then
>> have_pkg_config=1
>> @@ -690,8 +719,6 @@ else
>> fi
>> rm -f compat/check_asctime
>>
>> -printf "int main(void){return 0;}\n" > minimal.c
>> -
>> printf "Checking for rpath support... "
>> if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
>> then
>> --
>> 2.1.4
>>
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] configure: Add sanity checking for environment variables
2015-05-20 8:12 ` David Bremner
2015-05-20 8:37 ` Tomi Ollila
@ 2015-05-20 8:48 ` Tomi Ollila
2015-05-20 9:45 ` David Bremner
1 sibling, 1 reply; 12+ messages in thread
From: Tomi Ollila @ 2015-05-20 8:48 UTC (permalink / raw)
To: David Bremner, David Bremner, Ronny Chevalier; +Cc: notmuch
On Wed, May 20 2015, David Bremner <david@tethera.net> wrote:
> Passing in environment variables incompatible with the compiler may
> cause other parts of the configure script to fail in hard to
> understand ways, so we abort early.
> ---
>
> meh, the previous version was borken by lazy evaluation of CXXFLAGS
> using make syntax. Better suggestions for how to do this?
Final try, I promise ;D
>
> configure | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 4af7ba9..650b976 100755
> --- a/configure
> +++ b/configure
> @@ -269,6 +269,35 @@ dependencies are available:
> EOF
>
> errors=0
> +printf "int main(void){return 0;}\n" > minimal.c
> +
> +printf "Sanity checking C compilation environment... "
> +if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
> +then
> + printf "OK.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
if [ "$CXXFLAGS" = '$(CFLAGS)' ]
then
CXXFLAGS_for_sh=$CFLAGS
else
CXXFLAGS_for_sh=$CXXFLAGS
fi
the above is basically safe as if there are slight chages in string
'$(CFLAGS)' the CXXFLAGS_for_sh=$CXXFLAGS applies and if it is borken
then we notice it.
> +
> +printf "Sanity checking C++ compilation environment... "
> +if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
> +then
> + printf "OK.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
unset CXXFLAGS_for_sh
> +
> +if [ $errors -gt 0 ]; then
> + cat <<EOF
> +*** Error: Initial sanity checking of environment failed. Please try
> +running configure in a clean environment, and if the problem persists,
> +report a bug.
> +EOF
> + rm -f minimal minimal.c
> + exit 1
> +fi
>
> if pkg-config --version > /dev/null 2>&1; then
> have_pkg_config=1
> @@ -690,8 +719,6 @@ else
> fi
> rm -f compat/check_asctime
>
> -printf "int main(void){return 0;}\n" > minimal.c
> -
> printf "Checking for rpath support... "
> if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
> then
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] configure: Add sanity checking for environment variables
2015-05-20 8:48 ` Tomi Ollila
@ 2015-05-20 9:45 ` David Bremner
2015-05-20 10:45 ` Tomi Ollila
2015-05-23 18:33 ` David Bremner
0 siblings, 2 replies; 12+ messages in thread
From: David Bremner @ 2015-05-20 9:45 UTC (permalink / raw)
To: Tomi Ollila, David Bremner; +Cc: notmuch
Passing in environment variables incompatible with the compiler may
cause other parts of the configure script to fail in hard to
understand ways, so we abort early.
---
Gah, I left out the one line I actually wanted feedback on.
configure | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 4af7ba9..9b01025 100755
--- a/configure
+++ b/configure
@@ -47,6 +47,7 @@ CC=${CC:-cc}
CXX=${CXX:-c++}
CFLAGS=${CFLAGS:--g -O2}
CPPFLAGS=${CPPFLAGS:-}
+CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
LDFLAGS=${LDFLAGS:-}
XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config}
@@ -269,6 +270,35 @@ dependencies are available:
EOF
errors=0
+printf "int main(void){return 0;}\n" > minimal.c
+
+printf "Sanity checking C compilation environment... "
+if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
+then
+ printf "OK.\n"
+else
+ printf "Fail.\n"
+ errors=$((errors + 1))
+fi
+
+printf "Sanity checking C++ compilation environment... "
+if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
+then
+ printf "OK.\n"
+else
+ printf "Fail.\n"
+ errors=$((errors + 1))
+fi
+
+if [ $errors -gt 0 ]; then
+ cat <<EOF
+*** Error: Initial sanity checking of environment failed. Please try
+running configure in a clean environment, and if the problem persists,
+report a bug.
+EOF
+ rm -f minimal minimal.c
+ exit 1
+fi
if pkg-config --version > /dev/null 2>&1; then
have_pkg_config=1
@@ -690,8 +720,6 @@ else
fi
rm -f compat/check_asctime
-printf "int main(void){return 0;}\n" > minimal.c
-
printf "Checking for rpath support... "
if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
then
--
2.1.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] configure: Add sanity checking for environment variables
2015-05-20 9:45 ` David Bremner
@ 2015-05-20 10:45 ` Tomi Ollila
2015-05-23 18:33 ` David Bremner
1 sibling, 0 replies; 12+ messages in thread
From: Tomi Ollila @ 2015-05-20 10:45 UTC (permalink / raw)
To: David Bremner; +Cc: notmuch
On Wed, May 20 2015, David Bremner <david@tethera.net> wrote:
> Passing in environment variables incompatible with the compiler may
> cause other parts of the configure script to fail in hard to
> understand ways, so we abort early.
> ---
> Gah, I left out the one line I actually wanted feedback on.
This version looks simplest and most readable to me (personally i don't
like the variable naming but that is just (*))
Just 's/${CPPFLAGS} minimal.c/${CPPFLAGS} minimal.c/
Tomi
(*) http://martinfowler.com/bliki/TwoHardThings.html
>
> configure | 32 ++++++++++++++++++++++++++++++--
> 1 file changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 4af7ba9..9b01025 100755
> --- a/configure
> +++ b/configure
> @@ -47,6 +47,7 @@ CC=${CC:-cc}
> CXX=${CXX:-c++}
> CFLAGS=${CFLAGS:--g -O2}
> CPPFLAGS=${CPPFLAGS:-}
> +CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
> CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
> LDFLAGS=${LDFLAGS:-}
> XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config}
> @@ -269,6 +270,35 @@ dependencies are available:
> EOF
>
> errors=0
> +printf "int main(void){return 0;}\n" > minimal.c
> +
> +printf "Sanity checking C compilation environment... "
> +if ${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
> +then
> + printf "OK.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
> +
> +printf "Sanity checking C++ compilation environment... "
> +if ${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal > /dev/null 2>&1
> +then
> + printf "OK.\n"
> +else
> + printf "Fail.\n"
> + errors=$((errors + 1))
> +fi
> +
> +if [ $errors -gt 0 ]; then
> + cat <<EOF
> +*** Error: Initial sanity checking of environment failed. Please try
> +running configure in a clean environment, and if the problem persists,
> +report a bug.
> +EOF
> + rm -f minimal minimal.c
> + exit 1
> +fi
>
> if pkg-config --version > /dev/null 2>&1; then
> have_pkg_config=1
> @@ -690,8 +720,6 @@ else
> fi
> rm -f compat/check_asctime
>
> -printf "int main(void){return 0;}\n" > minimal.c
> -
> printf "Checking for rpath support... "
> if ${CC} -Wl,--enable-new-dtags -Wl,-rpath,/tmp/ -o minimal minimal.c >/dev/null 2>&1
> then
> --
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] configure: Add sanity checking for environment variables
2015-05-20 9:45 ` David Bremner
2015-05-20 10:45 ` Tomi Ollila
@ 2015-05-23 18:33 ` David Bremner
1 sibling, 0 replies; 12+ messages in thread
From: David Bremner @ 2015-05-23 18:33 UTC (permalink / raw)
To: Tomi Ollila; +Cc: notmuch
David Bremner <david@tethera.net> writes:
> Passing in environment variables incompatible with the compiler may
> cause other parts of the configure script to fail in hard to
> understand ways, so we abort early.
> ---
> Gah, I left out the one line I actually wanted feedback on.
pushed to master, amended s/ minimal.c/ minimal.c/
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-05-23 18:35 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19 18:31 configure tool Ronny Chevalier
2015-05-19 19:01 ` David Bremner
2015-05-19 19:08 ` Ronny Chevalier
2015-05-19 20:52 ` [PATCH] configure: Add sanity checking for environment variables David Bremner
2015-05-19 21:11 ` Tomi Ollila
2015-05-20 8:12 ` David Bremner
2015-05-20 8:37 ` Tomi Ollila
2015-05-20 8:41 ` Tomi Ollila
2015-05-20 8:48 ` Tomi Ollila
2015-05-20 9:45 ` David Bremner
2015-05-20 10:45 ` Tomi Ollila
2015-05-23 18:33 ` 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).