Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Run autoconf before building the extension. #40 (#48)
Browse files Browse the repository at this point in the history
Add an autoconf script to test for features.
Run autoconf at setuptools build_ext time.

Python 2.x's configure script does not test for the more recent
features we use so their defines are not in pyconfig.h.  We run
our own autoconf to verify those and use its generated header
to pick those up.

Getting configure to run via setuptools is... wacky. :/

also, internal: Run python2 tests first, get rid of the old .hgtags file.
  • Loading branch information
gpshead authored May 9, 2018
1 parent 1d45b1e commit 06114fb
Show file tree
Hide file tree
Showing 8 changed files with 5,023 additions and 26 deletions.
1 change: 0 additions & 1 deletion .hgtags

This file was deleted.

9 changes: 6 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
include *.md
include LICENSE*
include LICENSE
include setup.py
include setup.cfg
include ChangeLog
include MANIFEST.in

include *.c *.h *.py
include configure.ac configure *.h.in

include *.c *.py
include testdata/*
include python3_redirect/*

prune build
prune dist
prune .hg*
prune config.*
prune *.pyc
28 changes: 14 additions & 14 deletions _posixsubprocess.c
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
/* Authors: Gregory P. Smith & Jeffrey Yasskin */

/* Needed to enable CLOEXEC support on OSes with ancient defaults. */
#define _POSIX_C_SOURCE 200809L
#define _XOPEN_SOURCE 700
/* We use our own small autoconf to fill in for things that were not checked
* for in Python 2's configure and thus pyconfig.h.
*
* This comes before Python.h on purpose. 2.7's Python.h redefines critical
* defines such as _POSIX_C_SOURCE with undesirable old values impacting system
* which header defines are available.
*/
#include "_posixsubprocess_config.h"
#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#if defined(__linux__) && !defined(HAVE_PIPE2)
# define HAVE_PIPE2 1 /* From 3.2's configure script, undef if you don't. */
#endif
#if defined(HAVE_PIPE2) && !defined(_GNU_SOURCE)
# define _GNU_SOURCE
#endif

#include <unistd.h>
#include <fcntl.h>
#ifdef __linux__
# define HAVE_SYS_TYPES_H 1 /* From 3.2's configure script, undef if reqd. */
# define HAVE_SYS_SYSCALL_H 1 /* From 3.2's configure script, undef if reqd. */
# define HAVE_SYS_DIRENT_H 1 /* From 3.2's configure script, undef if reqd. */
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
Expand All @@ -32,6 +30,8 @@
#include <dirent.h>
#endif

/* TODO: Some platform conditions below could move into configure.ac. */

#if defined(__ANDROID__) && !defined(SYS_getdents64)
/* Android doesn't expose syscalls, add the definition manually. */
# include <sys/linux-syscalls.h>
Expand Down
109 changes: 109 additions & 0 deletions _posixsubprocess_config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/* _posixsubprocess_config.h.in. Generated from configure.ac by autoheader. */

/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H

/* Define if you have the 'dirfd' function or macro. */
#undef HAVE_DIRFD

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H

/* Define to 1 if you have the `pipe2' function. */
#undef HAVE_PIPE2

/* Define to 1 if you have the `setsid' function. */
#undef HAVE_SETSID

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the <sys/cdefs.h> header file. */
#undef HAVE_SYS_CDEFS_H

/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H

/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the home page for this package. */
#undef PACKAGE_URL

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Define on OpenBSD to activate all library features */
#undef _BSD_SOURCE

/* Define on Irix to enable u_int */
#undef _BSD_TYPES

/* Define on Darwin to activate all library features */
#undef _DARWIN_C_SOURCE

/* Define on Linux to activate all library features */
#undef _GNU_SOURCE

/* Define on NetBSD to activate all library features */
#undef _NETBSD_SOURCE

/* Define to activate features from IEEE Stds 1003.1-2008 */
#undef _POSIX_C_SOURCE

/* Define to the level of X/Open that your system supports */
#undef _XOPEN_SOURCE

/* Define to activate Unix95-and-earlier features */
#undef _XOPEN_SOURCE_EXTENDED

/* Define on FreeBSD to activate all library features */
#undef __BSD_VISIBLE
Loading

0 comments on commit 06114fb

Please sign in to comment.