httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jean-frederic clere <jfrederic.cl...@fujitsu.siemens.es>
Subject Re: APACHE20 problem with string.h and strings.h
Date Tue, 30 Jan 2001 14:44:31 GMT
Jeff Trawick wrote:
> 
> jean-frederic clere <jfrederic.clere@fujitsu.siemens.es> writes:
> 
> > Yes, the problem is in apr_general.h where there is "unsupported"
> > prototyping...
> > +++
> > #if
> > (!APR_HAVE_BZERO)
> > #define bzero(a,b)
> > memset(a,0,b)
> > #endif
> > +++
> > I would to prevent it when there is a strings.h that contains bzero.

It will not (and does not) help, the problem I have is that bzero() is
not in the default libraries so APR cannot find it, but bzero() is
defined in strings.h.

So the #define bzero(a,b) memset(a,0,b) causes the error:
+++
        /bin/sh /home3/apache20/apache/httpd-2.0/srclib/apr/libtool
--mode=compile --silent /usr/bin/cc -DSVR4  -I../../include
-I../../include/arch/unix -I../../include/arch/unix -c dir.c && touch
dir.lo                                    
/usr/include/strings.h    55: [error]:   CFE1079 expected a type
specifier      
  void bzero(void *,
size_t);                                                   
      
^                                                                        
                                                                                
/usr/include/strings.h    55: [error]:   CFE1147 declaration is
incompatible with "void *memset(void *, int, size_t)" (declared at line
62 of
"/usr/include/string.h")                                                                 
        
  void bzero(void *,
size_t);                                                   
      
^                                                                        
+++
Only removing strings.h or having the #define bzero after the includes
will help...
The problem is basicly that APR redefines the system include. That is
because the system include are after the apr*.h includes. We should not
redefine bzero or any "system" function before the system include
otherwise we will have problems...

I would suggest to create a new apr_system_redef.h that would contain
#define bzero (it just has to be included in
server/mpm/prefork/prefork.c and test/test_limits.c) and any similar
defines.
 
Jean-frederic

> In srclib/apr/configure.in, we have
> 
>   AC_CHECK_FUNCS(bzero, [ have_bzero="1" ], [ have_bzero="0"] )
> 
> I have found other cases where AC_CHECK_FUNCS()  doesn't work for some
> function on some platform because that platform requires a header
> file.  Maybe this will help?  It works for me on Linux/glibc.
> 
> Test this code on your platform and see if it results in happiness.
> 
> Index: configure.in
> ===================================================================
> RCS file: /home/cvspublic/apr/configure.in,v
> retrieving revision 1.220
> diff -u -r1.220 configure.in
> --- configure.in        2001/01/28 12:18:38     1.220
> +++ configure.in        2001/01/30 11:57:38
> @@ -251,7 +251,7 @@
>  fi
>  AC_CHECK_FUNCS(hstrerror)
>  AC_CHECK_FUNCS(memmove, [ have_memmove="1" ], [have_memmove="0" ])
> -AC_CHECK_FUNCS(bzero, [ have_bzero="1" ], [ have_bzero="0"] )
> +APR_CHECK_BZERO
> 
>  AC_SUBST(fork)
>  AC_SUBST(have_inet_addr)
> Index: helpers/apr-conf.m4
> ===================================================================
> RCS file: /home/cvspublic/apr/helpers/apr-conf.m4,v
> retrieving revision 1.3
> diff -u -r1.3 apr-conf.m4
> --- helpers/apr-conf.m4 2001/01/09 11:05:49     1.3
> +++ helpers/apr-conf.m4 2001/01/30 11:57:52
> @@ -534,3 +534,31 @@
>      AC_MSG_RESULT([$ac_cv_h_errno_cflags])
>    fi
>  ])
> +
> +dnl
> +dnl check for bzero
> +dnl Some platforms need strings.h to be included in order to detect
> +dnl bzero, so we can't use AC_CHECK_FUNCS
> +dnl
> +AC_DEFUN(APR_CHECK_BZERO,[
> +AC_CACHE_CHECK(for bzero, ac_cv_func_bzero,[
> +AC_TRY_COMPILE([
> +#ifdef HAVE_STRINGS_H
> +#include <strings.h>
> +#endif
> +#include <string.h>
> +],[
> +bzero(0,0);
> +],[
> +    ac_cv_func_bzero=yes
> +],[
> +    ac_cv_func_bzero=no
> +])
> +])
> +
> +if test "$ac_cv_func_bzero" = "yes"; then
> +  have_bzero="1"
> +else
> +  have_bzero="0"
> +fi
> +])
> 
> --
> Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
>        http://www.geocities.com/SiliconValley/Park/9289/
>              Born in Roswell... married an alien...

Mime
View raw message