Skip to contentSkip to conversation

qemu-kvm: fix pulseaudio detection in configure

PATCH Applied Marc-Antoine Perennou 7 participants 14 messages Apr 29, 2011 – Jun 24, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-kvm: fix pulseaudio detection in configure

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"
     libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
     audio_pt_int="yes"
     ;;
Signature · 1 line
1.7.5.52.ge839f.dirty
#1 lore raw

Any chance to get this reviewed/applied any time soon ? It currently does not build without it with gcc 4.6.0

Quoted 25 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

---
 configure |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu" audio_pt_int="yes"
    ;;
--
1.7.5.52.ge839f.dirty

#2 lore raw
In reply to Marc-Antoine Perennou
Quoted 3 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

I am unable to reproduce this issue, even with gcc-4.6. Also please note that NULL is defined in <stddef.h>, not <stdlib.h>. <stddef.h> is included from <sys/types.h> which is included from <pulse/simple.h>.

Do you have more information about the issue.

Quoted 10 lines
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index ea8b676..d67c3ce 100755

configure for drv in $audio_drv_list; do · line 1570

Quoted 5 lines
configure +1 -1
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

It should be ((void*)0) instead of simply 0.

Quoted 7 lines
configure +0 -0
     libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
     audio_pt_int="yes"
     ;;
Signature · 1 line
1.7.5.52.ge839f.dirty
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw
Quoted 22 lines · Aurelien Jarno
Quoted 3 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

I am unable to reproduce this issue, even with gcc-4.6. Also please note that NULL is defined in <stddef.h>, not <stdlib.h>. <stddef.h> is included from <sys/types.h> which is included from <pulse/simple.h>.

Do you have more information about the issue.

Quoted 11 lines
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
Quoted 6 lines

configure for drv in $audio_drv_list; do · line 1570

Quoted 4 lines
configure +1 -1
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

It should be ((void*)0) instead of simply 0.

No it shouldn't.

Quoted 10 lines
Quoted 8 lines
configure +0 -0
     libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
     audio_pt_int="yes"
     ;;
Signature · 1 line
1.7.5.52.ge839f.dirty
Signature · 1 line
mailto:[email protected]
#4 lore raw
Quoted 24 lines · malc
Quoted 22 lines · Aurelien Jarno
Quoted 3 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

I am unable to reproduce this issue, even with gcc-4.6. Also please note that NULL is defined in <stddef.h>, not <stdlib.h>. <stddef.h> is included from <sys/types.h> which is included from <pulse/simple.h>.

Do you have more information about the issue.

Quoted 11 lines
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
Quoted 9 lines
Quoted 6 lines

configure for drv in $audio_drv_list; do · line 1570

Quoted 4 lines
configure +1 -1
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

It should be ((void*)0) instead of simply 0.

No it shouldn't.

If we want to replace #include <stddef.h>, which should use the same code, that is:

| #ifndef __cplusplus
| #define NULL ((void *)0)
| #else   /* C++ */
| #define NULL 0
| #endif  /* C++ */

Given we are writing C code and not C++ code, NULL is defined as ((void *)0).

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#5 lore raw
Quoted 38 lines · Aurelien Jarno
Quoted 24 lines · malc
Quoted 22 lines · Aurelien Jarno
Quoted 3 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

I am unable to reproduce this issue, even with gcc-4.6. Also please note that NULL is defined in <stddef.h>, not <stdlib.h>. <stddef.h> is included from <sys/types.h> which is included from <pulse/simple.h>.

Do you have more information about the issue.

Quoted 11 lines
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
Quoted 9 lines
Quoted 6 lines

configure for drv in $audio_drv_list; do · line 1570

Quoted 4 lines
configure +1 -1
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

It should be ((void*)0) instead of simply 0.

No it shouldn't.

If we want to replace #include <stddef.h>, which should use the same code, that is:

Quoted 8 lines
| #ifndef __cplusplus
| #define NULL ((void *)0)
| #else   /* C++ */
| #define NULL 0
| #endif  /* C++ */

Given we are writing C code and not C++ code, NULL is defined as ((void *)0).

Doesn't make a dent of a differnce how particular implementation defines NULL, 6.2.3.3#3 covers it, what i'm trying to get across is that your strong "should" is wrong.

Signature · 1 line
mailto:[email protected]
#6 lore raw
Quoted 49 lines · malc
Quoted 38 lines · Aurelien Jarno
Quoted 24 lines · malc
Quoted 22 lines · Aurelien Jarno
Quoted 3 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

I am unable to reproduce this issue, even with gcc-4.6. Also please note that NULL is defined in <stddef.h>, not <stdlib.h>. <stddef.h> is included from <sys/types.h> which is included from <pulse/simple.h>.

Do you have more information about the issue.

Quoted 11 lines

---
 configure |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
Quoted 9 lines
Quoted 6 lines

configure for drv in $audio_drv_list; do · line 1570

Quoted 4 lines
configure +1 -1
      pa)
      audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

It should be ((void*)0) instead of simply 0.

No it shouldn't.

If we want to replace #include <stddef.h>, which should use the same code, that is:

Quoted 8 lines
| #ifndef __cplusplus
| #define NULL ((void *)0)
| #else   /* C++ */
| #define NULL 0
| #endif  /* C++ */

Given we are writing C code and not C++ code, NULL is defined as ((void *)0).

Quoted 6 lines

Doesn't make a dent of a differnce how particular implementation defines NULL, 6.2.3.3#3 covers it, what i'm trying to get across is that your strong "should" is wrong.

--
mailto:[email protected]

It's kinda weird actually, just wrote a small program to test:

#include <stddef.h>

int main() {
    int * i = NULL;
    return 0;
}

It builds fine
Now if I replace "stddef.h" by "sys/types.h"
‘NULL’ undeclared

I'm running Gentoo GNU/Linux, and everyone using it in my friends get the same problem, and there is no problem at all with the whole system which is around.
(Only gcc 4.6 is installed fyi)

Manually including stddef.h or replacing NULL by 0 or (void*)0 makes it work.

Hope I provided enough informations to justify this thread

#7 lore raw

Am 09.06.2011 um 17:52 schrieb Marc-Antoine Perennou:

Quoted 27 lines · malc
Quoted 12 lines · Aurelien Jarno
Quoted 11 lines · malc
Quoted 9 lines · Aurelien Jarno
Quoted 8 lines · Marc-Antoine Perennou
Quoted 6 lines
configure +0 -0
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

configure for drv in $audio_drv_list; do · line 1570

Quoted 5 lines
configure +1 -1
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple - 
 lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

It's kinda weird actually, just wrote a small program to test:

#include <stddef.h>

int main() {
   int * i = NULL;
   return 0;
}
Quoted 7 lines

It builds fine
Now if I replace "stddef.h" by "sys/types.h"
‘NULL’ undeclared

I'm running Gentoo GNU/Linux [...]

Manually including stddef.h or replacing NULL by 0 or (void*)0 makes it work.

Then please submit a new patch that explicit includes that header with a comment explaining why, so that it doesn't get removed by accident.

Andreas

Reviewed-by
#8 lore raw
Quoted 6 lines · Andreas Färber

Am 09.06.2011 um 17:52 schrieb Marc-Antoine Perennou:

Quoted 2 lines

Manually including stddef.h or replacing NULL by 0 or (void*)0 makes it work.

Then please submit a new patch that explicit includes that header with a comment explaining why, so that it doesn't get removed by accident.

I think the original patch is fine. This configure test isn't trying to test whether we correctly found some definition of NULL, it's testing pulseaudio presence. The test code should be the simplest and most stand-alone code that achieves that. There's no need to go dragging in extra headers when we don't even need to be using NULL here anyhow.

We already have configure tests which use unadorned 0 for pointers (eg the pthread test), it's legal C, and it works. I think we should call this a trivial patch and just apply it.

-- PMM

#9 lore raw
Quoted 15 lines · Peter Maydell
Quoted 6 lines · Andreas Färber

Am 09.06.2011 um 17:52 schrieb Marc-Antoine Perennou:

Quoted 2 lines

Manually including stddef.h or replacing NULL by 0 or (void*)0 makes it work.

Then please submit a new patch that explicit includes that header with a comment explaining why, so that it doesn't get removed by accident.

I think the original patch is fine. This configure test isn't trying to test whether we correctly found some definition of NULL, it's testing pulseaudio presence. The test code should be the simplest and most stand-alone code that achieves that. There's no need to go dragging in extra headers when we don't even need to be using NULL here anyhow.

Quoted 5 lines

We already have configure tests which use unadorned 0 for pointers (eg the pthread test), it's legal C, and it works. I think we should call this a trivial patch and just apply it.

I agree with your reasoning.

#10 lore raw
Quoted 17 lines · Markus Armbruster
Quoted 15 lines · Peter Maydell
Quoted 6 lines · Andreas Färber

Am 09.06.2011 um 17:52 schrieb Marc-Antoine Perennou:

Quoted 2 lines

Manually including stddef.h or replacing NULL by 0 or (void*)0 makes it work.

Then please submit a new patch that explicit includes that header with a comment explaining why, so that it doesn't get removed by accident.

I think the original patch is fine. This configure test isn't trying to test whether we correctly found some definition of NULL, it's testing pulseaudio presence. The test code should be the simplest and most stand-alone code that achieves that. There's no need to go dragging in extra headers when we don't even need to be using NULL here anyhow.

Quoted 8 lines
Quoted 5 lines

We already have configure tests which use unadorned 0 for pointers (eg the pthread test), it's legal C, and it works. I think we should call this a trivial patch and just apply it.

I agree with your reasoning.

If you want me to provide a patch with the extra include instead, I can, otherwise, could this trivial one get merged so qemu-kvm can be built on several systems on which it actually can't ?

#11 lore raw
Quoted 22 lines · Marc-Antoine Perennou
Quoted 21 lines · Markus Armbruster
Quoted 19 lines · Peter Maydell
Quoted 6 lines · Andreas Färber

Am 09.06.2011 um 17:52 schrieb Marc-Antoine Perennou:

Quoted 2 lines

Manually including stddef.h or replacing NULL by 0 or (void*)0 makes it work.

Then please submit a new patch that explicit includes that header with a comment explaining why, so that it doesn't get removed by accident.

I think the original patch is fine. This configure test isn't trying to test whether we correctly found some definition of NULL, it's testing pulseaudio presence. The test code should be the simplest and most stand-alone code that achieves that. There's no need to go dragging in extra headers when we don't even need to be using NULL here anyhow.

We already have configure tests which use unadorned 0 for pointers (eg the pthread test), it's legal C, and it works. I think we should call this a trivial patch and just apply it.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I agree with your reasoning.

If you want me to provide a patch with the extra include instead, I can, otherwise, could this trivial one get merged so qemu-kvm can be built on several systems on which it actually can't ?

It is in the trivial-patches tree now. qemu.git will pick it up next and then qemu-kvm.git will pull it in when it syncs up with qemu.git.

Stefan

#12 lore raw
In reply to Aurelien Jarno
Quoted 7 lines · Aurelien Jarno
Quoted 3 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

I am unable to reproduce this issue, even with gcc-4.6. Also please note that NULL is defined in <stddef.h>, not <stdlib.h>.

NULL is defined in stddef.h (ISO/IEC 9899:1999 7.17), locale.h (ibid 7.11), stdio.h (ibid 7.19.1), stdlib.h (ibid 7.20), string.h (ibid 7.21.1), time.h (ibid 7.23.1), wchar.h (ibid 7.24.1).

Quoted 2 lines

<stddef.h> is
included from <sys/types.h> which is included from <pulse/simple.h>.

I don't think POSIX specifies sys/types.h defines NULL, let alone includes stddef.h.

Quoted 13 lines

Do you have more information about the issue.

Quoted 11 lines
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +0 -0
index ea8b676..d67c3ce 100755
@@ -1567,7 +1567,7 @@ for drv in $audio_drv_list; do
 
Quoted 6 lines

configure for drv in $audio_drv_list; do · line 1570

Quoted 4 lines
configure +1 -1
     pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
-        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+        "pa_simple *s = 0; pa_simple_free(s); return 0;"

It should be ((void*)0) instead of simply 0.

Matter of taste.

Quoted 3 lines
Quoted 3 lines
configure +0 -0
     libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
     audio_pt_int="yes"
     ;;
#13 lore raw
In reply to Marc-Antoine Perennou
Quoted 8 lines · Marc-Antoine Perennou

pulse/simple.h does not include stdlib.h
We cannot use NULL since it may not be defined
Use 0 instead

---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

There has been discussion but I hope we've arrived at consensus based on the fact that 0 is already used for pthreads and it's valid C.

Thanks, applied to the trivial patches tree:
http://repo.or.cz/w/qemu/stefanha.git/shortlog/refs/heads/trivial-patches

Stefan