Patchwork [1/2] configure: Don't run Xen compile checks in subshells

login
register
mail settings
Submitter Peter Maydell
Date Aug. 2, 2012, 5:30 p.m.
Message ID <1343928627-11311-2-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/174791/
State New
Headers show

Comments

Peter Maydell - Aug. 2, 2012, 5:30 p.m.
The Xen compile checks are currently run inside subshells. This
is unnecessary and has the effect that if do_cc() exits with
an error message then this only causes the subshell to exit,
not the whole of configure, which is confusing. Remove the
subshells, changing:
  if ( cat ; compile_prog ) ; then ...
to
  if cat && compile_prog ; then ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
Blue Swirl - Aug. 4, 2012, 4:13 p.m.
Thanks, applied both.

On Thu, Aug 2, 2012 at 5:30 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> The Xen compile checks are currently run inside subshells. This
> is unnecessary and has the effect that if do_cc() exits with
> an error message then this only causes the subshell to exit,
> not the whole of configure, which is confusing. Remove the
> subshells, changing:
>   if ( cat ; compile_prog ) ; then ...
> to
>   if cat && compile_prog ; then ...
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  configure |   30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/configure b/configure
> index 027a718..c47e440 100755
> --- a/configure
> +++ b/configure
> @@ -1397,8 +1397,8 @@ EOF
>      xen=no
>
>    # Xen unstable
> -  elif (
> -      cat > $TMPC <<EOF
> +  elif
> +      cat > $TMPC <<EOF &&
>  #include <xenctrl.h>
>  #include <xenstore.h>
>  #include <stdint.h>
> @@ -1418,12 +1418,12 @@ int main(void) {
>  }
>  EOF
>        compile_prog "" "$xen_libs"
> -    ) ; then
> +    then
>      xen_ctrl_version=420
>      xen=yes
>
> -  elif (
> -      cat > $TMPC <<EOF
> +  elif
> +      cat > $TMPC <<EOF &&
>  #include <xenctrl.h>
>  #include <xs.h>
>  #include <stdint.h>
> @@ -1442,13 +1442,13 @@ int main(void) {
>  }
>  EOF
>        compile_prog "" "$xen_libs"
> -    ) ; then
> +    then
>      xen_ctrl_version=410
>      xen=yes
>
>    # Xen 4.0.0
> -  elif (
> -      cat > $TMPC <<EOF
> +  elif
> +      cat > $TMPC <<EOF &&
>  #include <xenctrl.h>
>  #include <xs.h>
>  #include <stdint.h>
> @@ -1469,13 +1469,13 @@ int main(void) {
>  }
>  EOF
>        compile_prog "" "$xen_libs"
> -    ) ; then
> +    then
>      xen_ctrl_version=400
>      xen=yes
>
>    # Xen 3.4.0
> -  elif (
> -      cat > $TMPC <<EOF
> +  elif
> +      cat > $TMPC <<EOF &&
>  #include <xenctrl.h>
>  #include <xs.h>
>  int main(void) {
> @@ -1491,13 +1491,13 @@ int main(void) {
>  }
>  EOF
>        compile_prog "" "$xen_libs"
> -    ) ; then
> +    then
>      xen_ctrl_version=340
>      xen=yes
>
>    # Xen 3.3.0
> -  elif (
> -      cat > $TMPC <<EOF
> +  elif
> +      cat > $TMPC <<EOF &&
>  #include <xenctrl.h>
>  #include <xs.h>
>  int main(void) {
> @@ -1509,7 +1509,7 @@ int main(void) {
>  }
>  EOF
>        compile_prog "" "$xen_libs"
> -    ) ; then
> +    then
>      xen_ctrl_version=330
>      xen=yes
>
> --
> 1.7.9.5
>

Patch

diff --git a/configure b/configure
index 027a718..c47e440 100755
--- a/configure
+++ b/configure
@@ -1397,8 +1397,8 @@  EOF
     xen=no
 
   # Xen unstable
-  elif (
-      cat > $TMPC <<EOF
+  elif 
+      cat > $TMPC <<EOF &&
 #include <xenctrl.h>
 #include <xenstore.h>
 #include <stdint.h>
@@ -1418,12 +1418,12 @@  int main(void) {
 }
 EOF
       compile_prog "" "$xen_libs"
-    ) ; then
+    then
     xen_ctrl_version=420
     xen=yes
 
-  elif (
-      cat > $TMPC <<EOF
+  elif 
+      cat > $TMPC <<EOF &&
 #include <xenctrl.h>
 #include <xs.h>
 #include <stdint.h>
@@ -1442,13 +1442,13 @@  int main(void) {
 }
 EOF
       compile_prog "" "$xen_libs"
-    ) ; then
+    then
     xen_ctrl_version=410
     xen=yes
 
   # Xen 4.0.0
-  elif (
-      cat > $TMPC <<EOF
+  elif
+      cat > $TMPC <<EOF &&
 #include <xenctrl.h>
 #include <xs.h>
 #include <stdint.h>
@@ -1469,13 +1469,13 @@  int main(void) {
 }
 EOF
       compile_prog "" "$xen_libs"
-    ) ; then
+    then
     xen_ctrl_version=400
     xen=yes
 
   # Xen 3.4.0
-  elif (
-      cat > $TMPC <<EOF
+  elif
+      cat > $TMPC <<EOF &&
 #include <xenctrl.h>
 #include <xs.h>
 int main(void) {
@@ -1491,13 +1491,13 @@  int main(void) {
 }
 EOF
       compile_prog "" "$xen_libs"
-    ) ; then
+    then
     xen_ctrl_version=340
     xen=yes
 
   # Xen 3.3.0
-  elif (
-      cat > $TMPC <<EOF
+  elif
+      cat > $TMPC <<EOF &&
 #include <xenctrl.h>
 #include <xs.h>
 int main(void) {
@@ -1509,7 +1509,7 @@  int main(void) {
 }
 EOF
       compile_prog "" "$xen_libs"
-    ) ; then
+    then
     xen_ctrl_version=330
     xen=yes