how to check for HAVE_FOO_PROTO ?

Alexander Neundorf neundorf at kde.org
Sun Jan 15 14:39:21 CET 2006


On Sunday 15 January 2006 01:33, David Faure wrote:
> On Saturday 14 January 2006 17:25, Alexander Neundorf wrote:
> > Hi,
> >
> > in kdelibs/ there are configure checks for really a lot of stuff.
> > What does HAVE_FOO_PROTO mean ? (with FOO = GETHOSTNAME, INITGROUPS,
> > MKDTEMP, MKSTEMP, RANDOM and others)
> > How should be tested for it ?
> >
> > cmake has a check_function_exists(), which tries to compile and link a
> > small executable calling this function. But what should be done for
> > HAVE_FOO_PROTO ?
>
> This is about the functions that libkdefakes can provide if the system
> doesn't. If the system doesn't have it, there are still 2 cases : it has
> the prototype in a system header or it doesn't. If it doesn't, then a file
> like config.h must provide it, hence the HAVE_FOO_PROTO check in the m4
> implementation (which is used by the ifdefs in config.h.bot)
> But if you prefer, read my bksys implementation of those checks in
> bksys/kdefakes.py As you can see there, there is no need for the _PROTO
> intermediary if the configure check directly writes out the prototype to
> the config-kdefakes.h file when it's needed.

ret = context.TryLink(code, '.cpp')
if ret:
	import string
	dest.write("#define HAVE_%s 1\n" % (string.upper(function_name)))
	context.Result(ret)
else:
        context.Result('ok - in libkdefakes')
        dest.write("""
#ifdef __cplusplus
extern "C" {
#endif
%(prototype)s;
#ifdef __cplusplus
}
#endif

Doesn't this mean the declaration is written to config.h if the test 
application didn't link, but no matter whether the header actually contained 
the prototype or not ?

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list