Patchwork configure: include stddef.h for NULL

login
register
mail settings
Submitter Scott Wood
Date Oct. 4, 2010, 9:17 p.m.
Message ID <20101004211700.GA27097@udp111988uds.am.freescale.net>
Download mbox | patch
Permalink /patch/66742/
State New
Headers show

Comments

Scott Wood - Oct. 4, 2010, 9:17 p.m.
This fixes an observed failure to detect madvise() on Linux.

To avoid similar issues, all other tests that use NULL but don't already
have stddef.h are also fixed.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 configure |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Markus Armbruster - Oct. 5, 2010, 8:03 a.m.
Scott Wood <scottwood@freescale.com> writes:

> This fixes an observed failure to detect madvise() on Linux.
>
> To avoid similar issues, all other tests that use NULL but don't already
> have stddef.h are also fixed.

Appreciated, but several instances don't need fixing, because existing
includes already provide NULL.

> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
>  configure |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/configure b/configure
> index e0d34fd..9c4f1db 100755
> --- a/configure
> +++ b/configure
> @@ -1276,6 +1276,7 @@ if test "$vnc_sasl" != "no" ; then
>    cat > $TMPC <<EOF
>  #include <sasl/sasl.h>
>  #include <stdio.h>
> +#include <stddef.h>

stdio.h provides NULL.

>  int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
>  EOF
>    # Assuming Cyrus-SASL installed in /usr prefix
> @@ -1319,6 +1320,7 @@ if test "$vnc_png" != "no" ; then
>  cat > $TMPC <<EOF
>  //#include <stdio.h>
>  #include <png.h>
> +#include <stddef.h>
>  int main(void) {
>      png_structp png_ptr;
>      png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
> @@ -1503,6 +1505,7 @@ if test "$brlapi" != "no" ; then
>    brlapi_libs="-lbrlapi"
>    cat > $TMPC << EOF
>  #include <brlapi.h>
> +#include <stddef.h>
>  int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
>  EOF
>    if compile_prog "" "$brlapi_libs" ; then
> @@ -1737,6 +1740,7 @@ if test "$linux_aio" != "no" ; then
>    cat > $TMPC <<EOF
>  #include <libaio.h>
>  #include <sys/eventfd.h>
> +#include <stddef.h>
>  int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
>  EOF
>    if compile_prog "" "-laio" ; then
> @@ -1759,6 +1763,7 @@ if test "$attr" != "no" ; then
>  #include <stdio.h>
>  #include <sys/types.h>
>  #include <attr/xattr.h>
> +#include <stddef.h>

Same here.

>  int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
>  EOF
>    if compile_prog "" "-lattr" ; then
> @@ -1935,6 +1940,7 @@ cat > $TMPC << EOF
>  #include <unistd.h>
>  #include <fcntl.h>
>  #include <limits.h>
> +#include <stddef.h>

unistd.h provides NULL.

>  
>  int main(void)
>  {
> @@ -2032,6 +2038,7 @@ fi
>  cat > $TMPC <<EOF
>  #include <signal.h>
>  #include <time.h>
> +#include <stddef.h>

time.h provides NULL.

>  int main(void) { clockid_t id; return clock_gettime(id, NULL); }
>  EOF
>  
> @@ -2094,6 +2101,7 @@ madvise=no
>  cat > $TMPC << EOF
>  #include <sys/types.h>
>  #include <sys/mman.h>
> +#include <stddef.h>
>  int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
>  EOF
>  if compile_prog "" "" ; then
> @@ -2106,6 +2114,7 @@ fi
>  posix_madvise=no
>  cat > $TMPC << EOF
>  #include <sys/mman.h>
> +#include <stddef.h>
>  int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
>  EOF
>  if compile_prog "" "" ; then
Scott Wood - Oct. 5, 2010, 4:30 p.m.
On Tue, 5 Oct 2010 10:03:35 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Scott Wood <scottwood@freescale.com> writes:
> 
> > This fixes an observed failure to detect madvise() on Linux.
> >
> > To avoid similar issues, all other tests that use NULL but don't already
> > have stddef.h are also fixed.
> 
> Appreciated, but several instances don't need fixing, because existing
> includes already provide NULL.
> 
> > Signed-off-by: Scott Wood <scottwood@freescale.com>
> > ---
> >  configure |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> >
> > diff --git a/configure b/configure
> > index e0d34fd..9c4f1db 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1276,6 +1276,7 @@ if test "$vnc_sasl" != "no" ; then
> >    cat > $TMPC <<EOF
> >  #include <sasl/sasl.h>
> >  #include <stdio.h>
> > +#include <stddef.h>
> 
> stdio.h provides NULL.

Hmm, I had looked up a reference to see if stdio.h is defined to
supply this, and didn't see it.  Today I see it. :-P

I'll respin the patch.

-Scott

Patch

diff --git a/configure b/configure
index e0d34fd..9c4f1db 100755
--- a/configure
+++ b/configure
@@ -1276,6 +1276,7 @@  if test "$vnc_sasl" != "no" ; then
   cat > $TMPC <<EOF
 #include <sasl/sasl.h>
 #include <stdio.h>
+#include <stddef.h>
 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
 EOF
   # Assuming Cyrus-SASL installed in /usr prefix
@@ -1319,6 +1320,7 @@  if test "$vnc_png" != "no" ; then
 cat > $TMPC <<EOF
 //#include <stdio.h>
 #include <png.h>
+#include <stddef.h>
 int main(void) {
     png_structp png_ptr;
     png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -1503,6 +1505,7 @@  if test "$brlapi" != "no" ; then
   brlapi_libs="-lbrlapi"
   cat > $TMPC << EOF
 #include <brlapi.h>
+#include <stddef.h>
 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
 EOF
   if compile_prog "" "$brlapi_libs" ; then
@@ -1737,6 +1740,7 @@  if test "$linux_aio" != "no" ; then
   cat > $TMPC <<EOF
 #include <libaio.h>
 #include <sys/eventfd.h>
+#include <stddef.h>
 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
 EOF
   if compile_prog "" "-laio" ; then
@@ -1759,6 +1763,7 @@  if test "$attr" != "no" ; then
 #include <stdio.h>
 #include <sys/types.h>
 #include <attr/xattr.h>
+#include <stddef.h>
 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
 EOF
   if compile_prog "" "-lattr" ; then
@@ -1935,6 +1940,7 @@  cat > $TMPC << EOF
 #include <unistd.h>
 #include <fcntl.h>
 #include <limits.h>
+#include <stddef.h>
 
 int main(void)
 {
@@ -2032,6 +2038,7 @@  fi
 cat > $TMPC <<EOF
 #include <signal.h>
 #include <time.h>
+#include <stddef.h>
 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
 EOF
 
@@ -2094,6 +2101,7 @@  madvise=no
 cat > $TMPC << EOF
 #include <sys/types.h>
 #include <sys/mman.h>
+#include <stddef.h>
 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
 EOF
 if compile_prog "" "" ; then
@@ -2106,6 +2114,7 @@  fi
 posix_madvise=no
 cat > $TMPC << EOF
 #include <sys/mman.h>
+#include <stddef.h>
 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
 EOF
 if compile_prog "" "" ; then