[Python-Dev] Good way of finding out what C functions we have?
Brett C.
bac at OCF.Berkeley.EDU
Mon Sep 29 22:07:58 EDT 2003
Martin v. Löwis wrote:
> "Brett C." <bac at OCF.Berkeley.EDU> writes:
>
>
>>Does there happen to be a better way to find out what functions we
>>check for beyond grepping configure.in? The entire reason I bothered
>>to do so much research is I thought we were only supposed to assume
>>ANSI C with POSIX (which, from what I can tell, strdup() is not).
>
>
> Actually, strdup is in POSIX:
>
> http://www.opengroup.org/onlinepubs/007904975/functions/strdup.html
>
Shows how much I know; I found that last night but since it didn't say
POSIX anywhere I thought it was part of another standard. I guess the
"Issue 5" mention means that BASE is POSIX? Or is IEEE 1003.1 basically
POSIX?
> If we still check for it, it is because it might not have been
> available on some system, at some point in time.
>
We don't only check for it, but we have a replacement implementation
(the comment for Python/strdup.c seems to suggest it is needed by the
parser).
>
>>Because of this I would like to list in the Python development guide I
>>am writing up all of the places one can check for info; what
>>configure.in checks for or handles and pyport.h come to mind. It
>>would be nice to have a place that lists all the places one can check
>>for C functionality that are not in the Python/C API directly. If
>>people have other places in the code that one should check please let
>>me know so I can make sure it makes it into the doc and prevents me
>>from having to come up with another Brett Newbie Question. =)
>
>
> I would look in pyconfig.h.in as the first thing. There is a pitfall,
> though: presence of some HAVE_foo in pyconfig.h does not mean that
> Python gracefully deals with the absence of foo. When converting
> configure to autoconf 2.5x, I checked all macros to determine whether
> they were still in use, but some may have become unused/not processed
> correctly since. That would be a bug, of course.
>
What does happen if a HAVE_foo is actually required? Does the build
fail or will configure halt and say that the build will fail if you proceed?
And if no one objects I will mention that looking in pyconfig.h.in is a
good place to look to see what C functions that are non-POSIX and
non-ANSI C we check for and pyport.h has helpful stuff as well.
-Brett
More information about the Python-Dev
mailing list