Skip to content

Commit 8572981

Browse files
committed
Merged revisions 84584 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84584 | antoine.pitrou | 2010-09-07 16:52:42 +0200 (mar., 07 sept. 2010) | 4 lines Issue #4026: Make the fcntl extension build under AIX. Patch by Sébastien Sablé. ........
1 parent e80513c commit 8572981

5 files changed

Lines changed: 103 additions & 8 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ Extension Modules
275275
Build
276276
-----
277277

278+
- Issue #4026: Make the fcntl extension build under AIX. Patch by Sébastien
279+
Sablé.
280+
278281
- Issue #3101: Helper functions _add_one_to_index_C() and
279282
_add_one_to_index_F() become _Py_add_one_to_index_C() and
280283
_Py_add_one_to_index_F(), respectively.

configure

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 81582 .
2+
# From configure.in Revision: 84368 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.65 for python 2.7.
55
#
@@ -9742,6 +9742,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
97429742
97439743
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock" >&5
97449744
$as_echo_n "checking for flock... " >&6; }
9745+
have_flock=no
97459746
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
97469747
/* end confdefs.h. */
97479748
@@ -9759,14 +9760,84 @@ if ac_fn_c_try_compile "$LINENO"; then :
97599760
97609761
$as_echo "#define HAVE_FLOCK 1" >>confdefs.h
97619762
9762-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9763-
$as_echo "yes" >&6; }
9764-
else
9763+
have_flock=yes
9764+
9765+
fi
9766+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9767+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_flock" >&5
9768+
$as_echo "$have_flock" >&6; }
9769+
9770+
if test "$have_flock" = yes ; then
9771+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if flock requires additional libraries." >&5
9772+
$as_echo_n "checking if flock requires additional libraries.... " >&6; }
9773+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9774+
/* end confdefs.h. */
9775+
9776+
#include <sys/file.h>
9777+
9778+
int
9779+
main ()
9780+
{
9781+
void *p = flock; flock(0, 0)
9782+
;
9783+
return 0;
9784+
}
9785+
_ACEOF
9786+
if ac_fn_c_try_link "$LINENO"; then :
97659787
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
97669788
$as_echo "no" >&6; }
9789+
else
9790+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9791+
$as_echo "yes" >&6; }
9792+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5
9793+
$as_echo_n "checking for flock in -lbsd... " >&6; }
9794+
if test "${ac_cv_lib_bsd_flock+set}" = set; then :
9795+
$as_echo_n "(cached) " >&6
9796+
else
9797+
ac_check_lib_save_LIBS=$LIBS
9798+
LIBS="-lbsd $LIBS"
9799+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9800+
/* end confdefs.h. */
97679801
9802+
/* Override any GCC internal prototype to avoid an error.
9803+
Use char because int might match the return type of a GCC
9804+
builtin and then its argument prototype would still apply. */
9805+
#ifdef __cplusplus
9806+
extern "C"
9807+
#endif
9808+
char flock ();
9809+
int
9810+
main ()
9811+
{
9812+
return flock ();
9813+
;
9814+
return 0;
9815+
}
9816+
_ACEOF
9817+
if ac_fn_c_try_link "$LINENO"; then :
9818+
ac_cv_lib_bsd_flock=yes
9819+
else
9820+
ac_cv_lib_bsd_flock=no
9821+
fi
9822+
rm -f core conftest.err conftest.$ac_objext \
9823+
conftest$ac_exeext conftest.$ac_ext
9824+
LIBS=$ac_check_lib_save_LIBS
9825+
fi
9826+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5
9827+
$as_echo "$ac_cv_lib_bsd_flock" >&6; }
9828+
if test "x$ac_cv_lib_bsd_flock" = x""yes; then :
9829+
9830+
9831+
$as_echo "#define FLOCK_NEEDS_LIBBSD 1" >>confdefs.h
9832+
9833+
9834+
fi
9835+
9836+
9837+
fi
9838+
rm -f core conftest.err conftest.$ac_objext \
9839+
conftest$ac_exeext conftest.$ac_ext
97689840
fi
9769-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
97709841
97719842
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpagesize" >&5
97729843
$as_echo_n "checking for getpagesize... " >&6; }

configure.in

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,13 +2775,27 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
27752775
])
27762776

27772777
AC_MSG_CHECKING(for flock)
2778+
have_flock=no
27782779
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
27792780
#include <sys/file.h>
27802781
]], [[void* p = flock]])],
27812782
[AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2782-
AC_MSG_RESULT(yes)],
2783-
[AC_MSG_RESULT(no)
2783+
have_flock=yes
27842784
])
2785+
AC_MSG_RESULT($have_flock)
2786+
2787+
if test "$have_flock" = yes ; then
2788+
AC_MSG_CHECKING(if flock requires additional libraries.)
2789+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2790+
#include <sys/file.h>
2791+
]], [[void *p = flock; flock(0, 0)]])],
2792+
[AC_MSG_RESULT(no)],
2793+
[AC_MSG_RESULT(yes)
2794+
AC_CHECK_LIB(bsd,flock, [
2795+
AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
2796+
])
2797+
])
2798+
fi
27852799

27862800
AC_MSG_CHECKING(for getpagesize)
27872801
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
/* Define if --enable-ipv6 is specified */
3737
#undef ENABLE_IPV6
3838

39+
/* Define if flock needs to be linked with bsd library */
40+
#undef FLOCK_NEEDS_LIBBSD
41+
3942
/* Define if getpgrp() must be called as getpgrp(0). */
4043
#undef GETPGRP_HAVE_ARG
4144

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,11 @@ def detect_modules(self):
529529
# supported...)
530530

531531
# fcntl(2) and ioctl(2)
532-
exts.append( Extension('fcntl', ['fcntlmodule.c']) )
532+
libs = []
533+
if (config_h_vars.get('FLOCK_NEEDS_LIBBSD', False)):
534+
# May be necessary on AIX for flock function
535+
libs = ['bsd']
536+
exts.append( Extension('fcntl', ['fcntlmodule.c'], libraries=libs) )
533537
# pwd(3)
534538
exts.append( Extension('pwd', ['pwdmodule.c']) )
535539
# grp(3)

0 commit comments

Comments
 (0)