[Python-Dev] Good way of finding out what C functions we have? (original) (raw)

Martin v. Löwis martin at v.loewis.de
Mon Sep 29 02:03:39 EDT 2003


"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

If we still check for it, it is because it might not have been available on some system, at some point in time.

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.

Regards, Martin



More information about the Python-Dev mailing list