You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rasmus Lerdorf <ra...@lerdorf.on.ca> on 1998/03/05 16:26:24 UTC

[PATCH] HAS_DLFCN -> HAVE_DLFCN_H 1

Ok, with the 3 patches I submitted.  (ap_config.h, conf.h and the typo fix
to os.h) PHP3 now compiles nicely with the latest Apache CVS and it does
so with all the correct -D's to avoid any potential voodoo.

I still don't like this piece of code from os.h:

#if defined(LINUX) || defined(__FreeBSD__) || defined(SOLARIS2) || \
    defined(__bsdi__) || defined(IRIX)
# define HAS_DLFCN
#endif

#ifdef HAS_DLFCN
# include <dlfcn.h>
#else
void * dlopen (const char * __filename, int __flag);
const char * dlerror (void);
void * dlsym (void *, const char *);
int dlclose (void *);
#endif

This should be in src/include/conf.h and it should be doing a
#define HAVE_DLFCN_H 1

The reason being that an autoconf'ed module may detect a dlfcn.h header
file on a system other than the ones Apache thinks might have such a file.
If that is the case, it is likely that one of those dl* functions will end
up being defined differently by Apache.  

By moving this to conf.h and checking HAVE_DLFCN_H instead of HAS_DLFCN we
can ensure that if somebody somewhere has defined HAVE_DLFCN_H, we won't
try to redefine those functions.

-Rasmus


mkid

Posted by Ben Hyde <bh...@pobox.com>.
>#!/bin/sh
>find . \( -name '*.[cChHylsS]' -o -name '*.cpp' -o -name '*.[cC][cC]' \) \
>    -print0 | xargs -0r grep ${1+"$@"}

The single most valuable tool for software development is:

http://wwwcn1.cern.ch/dci/asis/products/GNU.MISC/id-utils-3.2/id-utils_toc.html

Instant access to the lines matching a pattern over the entire source
tree.  Keep one over the set of mailing list archives.

More valuable than meta-dot, maybe more valuable than the compiler.

> ... I'd rather see things
>moved out of conf.h into os.h files.  I believe Ben Hyde feels the
>opposite way -- because that results in poor maintenance of other ports
>because they're "out of sight, out of mind".

I'm touched that you so accurately recall my final opinion on this subject.

The more practical part of my opinion is that I've never seen a project 
use a single consistent way of doing this, so I suspect this dialectic 
between function and platform is a force of nature - like the tides - and 
it ebbs and flows.  So yeah, go with the flow.

If you move things into the os.h files then you have layering issues as
some functions will require other functions that must already have been
included - even if these are platform independent.

 - ben hyde

"The concept that civilization is inherently corrupt, but Nature
inevitably benign, is particularly popular in earthquake and floodridden
California."- Judith Martin



Re: [PATCH] HAS_DLFCN -> HAVE_DLFCN_H 1

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Dean Gaudet wrote:
> 
> I personally find it hard to wade through lots of levels of #ifdefism
> (i.e. http_main.c, conf.h to a lesser extent).  I'd rather see things
> moved out of conf.h into os.h files.

Erm, I don't know about os.h - but Jim has already proposed a platform.h
file (to be built by Configure) that discards all the inappropriate
#ifdef blocks.  I think a couple of people have +1ed it.  I've been
musing about it, and I think I'm going to +1 it myself.

#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://WWW.Dummies.Com/

Re: [PATCH] HAS_DLFCN -> HAVE_DLFCN_H 1

Posted by Dean Gaudet <dg...@arctic.org>.
Uh why is os.h included before conf.h?  Is it just 'cause WIN32's
definitions are all in os.h?  That's kind of lame. 

obautoconfism: elided. 

I personally find it hard to wade through lots of levels of #ifdefism
(i.e. http_main.c, conf.h to a lesser extent).  I'd rather see things
moved out of conf.h into os.h files.  I believe Ben Hyde feels the
opposite way -- because that results in poor maintenance of other ports
because they're "out of sight, out of mind".

Dunno what to say really.  But hey, here's a useful sh script:

#!/bin/sh
find . \( -name '*.[cChHylsS]' -o -name '*.cpp' -o -name '*.[cC][cC]' \) \
    -print0 | xargs -0r grep ${1+"$@"}

That's what I use when doing things with global rammification.  I call it
rgrep.

Dean

On Thu, 5 Mar 1998, Rasmus Lerdorf wrote:

> > > +1 on the move and rename
> > 
> > +1 (see my earlier mail about the same problem, some days ago)
> 
> Ok, but this still isn't easy to do.  In conf.h we include os.h right near
> the top.  I question the whole concept of os.h, but I assume I am missing
> something basic here.  Regardless, since I assume that this dl abstraction
> needs to be done in os.h, all the dl stuff needs to detected properly
> before the abstraction defines in os.h.  Since os.h is included before
> conf.h can go through and define HAVE_DLFCN_H for the various operating
> systems, we are out of luck.  To move this dl abstraction to conf.h, we
> would basically just have a block near the end of conf.h with:
> 
> #ifdef WIN32
> #define os_dl_module_handle_type HINSTANCE
> #define os_dl_load(l)   LoadLibraryEx(l,NULL,LOAD_WITH_ALTERED_SEARCH_PATH)
> #define os_dl_unload(l) FreeLibrary(l)
> #define os_dl_sym(h,s)  GetProcAddress(h,s)
> #define os_dl_error()   ""  /* for now */
> #else
> # define os_dl_module_handle_type void *
> # define os_dl_load(l)   dlopen(l, RTLD_NOW)
> # define os_dl_unload(l) dlclose(l)
> # define os_dl_sym(h,s)  dlsym(h,s)
> # define os_dl_error()   dlerror()
> #endif
> 
> If we had this, we could do the DLFCN checks in conf.h somewhere above
> this block.  But doing this invalidates the entire existence of the os.h
> files.  We might as well move the entire contents of the various os.h
> files into conf.h and ifdef everything appropriately.
> 
> Or alternatively, all of conf.h should be moved into os.h.  All the
> various checks for different brands of Unix should be in the os/unix/os.h
> file, for example.
> 
> The way we have repeated checks for the same thing in the two files right
> now seems redundant.
> 
> -Rasmus
> 
> 


Re: [PATCH] HAS_DLFCN -> HAVE_DLFCN_H 1

Posted by Rasmus Lerdorf <ra...@lerdorf.on.ca>.
> > +1 on the move and rename
> 
> +1 (see my earlier mail about the same problem, some days ago)

Ok, but this still isn't easy to do.  In conf.h we include os.h right near
the top.  I question the whole concept of os.h, but I assume I am missing
something basic here.  Regardless, since I assume that this dl abstraction
needs to be done in os.h, all the dl stuff needs to detected properly
before the abstraction defines in os.h.  Since os.h is included before
conf.h can go through and define HAVE_DLFCN_H for the various operating
systems, we are out of luck.  To move this dl abstraction to conf.h, we
would basically just have a block near the end of conf.h with:

#ifdef WIN32
#define os_dl_module_handle_type HINSTANCE
#define os_dl_load(l)   LoadLibraryEx(l,NULL,LOAD_WITH_ALTERED_SEARCH_PATH)
#define os_dl_unload(l) FreeLibrary(l)
#define os_dl_sym(h,s)  GetProcAddress(h,s)
#define os_dl_error()   ""  /* for now */
#else
# define os_dl_module_handle_type void *
# define os_dl_load(l)   dlopen(l, RTLD_NOW)
# define os_dl_unload(l) dlclose(l)
# define os_dl_sym(h,s)  dlsym(h,s)
# define os_dl_error()   dlerror()
#endif

If we had this, we could do the DLFCN checks in conf.h somewhere above
this block.  But doing this invalidates the entire existence of the os.h
files.  We might as well move the entire contents of the various os.h
files into conf.h and ifdef everything appropriately.

Or alternatively, all of conf.h should be moved into os.h.  All the
various checks for different brands of Unix should be in the os/unix/os.h
file, for example.

The way we have repeated checks for the same thing in the two files right
now seems redundant.

-Rasmus


Re: [PATCH] HAS_DLFCN -> HAVE_DLFCN_H 1

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Thu, Mar 05, 1998 at 10:58:51AM -0500, Jim Jagielski wrote:
> 
> +1 on the move and rename

+1 (see my earlier mail about the same problem, some days ago)

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request