Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a300007

Browse files
committed
Issue #4026: Make the fcntl extension build under AIX.
Patch by Sébastien Sablé.
1 parent 1965136 commit a300007

5 files changed

Lines changed: 108 additions & 10 deletions

File tree

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ Library
5252
guaranteed to exist in all Python implementations and the names of hash
5353
algorithms available in the current process.
5454

55+
Build
56+
-----
57+
58+
- Issue #4026: Make the fcntl extension build under AIX. Patch by Sébastien
59+
Sablé.
60+
5561

5662
What's New in Python 3.2 Alpha 2?
5763
=================================

configure

Lines changed: 78 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 84477 .
2+
# From configure.in Revision: 84512 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.65 for python 3.2.
55
#
@@ -9588,6 +9588,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
95889588
95899589
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock" >&5
95909590
$as_echo_n "checking for flock... " >&6; }
9591+
have_flock=no
95919592
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
95929593
/* end confdefs.h. */
95939594
@@ -9605,14 +9606,84 @@ if ac_fn_c_try_compile "$LINENO"; then :
96059606
96069607
$as_echo "#define HAVE_FLOCK 1" >>confdefs.h
96079608
9608-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9609-
$as_echo "yes" >&6; }
9610-
else
9609+
have_flock=yes
9610+
9611+
fi
9612+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
9613+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_flock" >&5
9614+
$as_echo "$have_flock" >&6; }
9615+
9616+
if test "$have_flock" = yes ; then
9617+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if flock requires additional libraries." >&5
9618+
$as_echo_n "checking if flock requires additional libraries.... " >&6; }
9619+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9620+
/* end confdefs.h. */
9621+
9622+
#include <sys/file.h>
9623+
9624+
int
9625+
main ()
9626+
{
9627+
void *p = flock; flock(0, 0)
9628+
;
9629+
return 0;
9630+
}
9631+
_ACEOF
9632+
if ac_fn_c_try_link "$LINENO"; then :
96119633
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
96129634
$as_echo "no" >&6; }
9635+
else
9636+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
9637+
$as_echo "yes" >&6; }
9638+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5
9639+
$as_echo_n "checking for flock in -lbsd... " >&6; }
9640+
if test "${ac_cv_lib_bsd_flock+set}" = set; then :
9641+
$as_echo_n "(cached) " >&6
9642+
else
9643+
ac_check_lib_save_LIBS=$LIBS
9644+
LIBS="-lbsd $LIBS"
9645+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9646+
/* end confdefs.h. */
96139647
9648+
/* Override any GCC internal prototype to avoid an error.
9649+
Use char because int might match the return type of a GCC
9650+
builtin and then its argument prototype would still apply. */
9651+
#ifdef __cplusplus
9652+
extern "C"
9653+
#endif
9654+
char flock ();
9655+
int
9656+
main ()
9657+
{
9658+
return flock ();
9659+
;
9660+
return 0;
9661+
}
9662+
_ACEOF
9663+
if ac_fn_c_try_link "$LINENO"; then :
9664+
ac_cv_lib_bsd_flock=yes
9665+
else
9666+
ac_cv_lib_bsd_flock=no
9667+
fi
9668+
rm -f core conftest.err conftest.$ac_objext \
9669+
conftest$ac_exeext conftest.$ac_ext
9670+
LIBS=$ac_check_lib_save_LIBS
9671+
fi
9672+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5
9673+
$as_echo "$ac_cv_lib_bsd_flock" >&6; }
9674+
if test "x$ac_cv_lib_bsd_flock" = x""yes; then :
9675+
9676+
9677+
$as_echo "#define FLOCK_NEEDS_LIBBSD 1" >>confdefs.h
9678+
9679+
9680+
fi
9681+
9682+
9683+
fi
9684+
rm -f core conftest.err conftest.$ac_objext \
9685+
conftest$ac_exeext conftest.$ac_ext
96149686
fi
9615-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
96169687
96179688
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpagesize" >&5
96189689
$as_echo_n "checking for getpagesize... " >&6; }
@@ -14226,8 +14297,8 @@ esac
1422614297
1422714298
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1422814299
# Files that config.status was made for.
14229-
config_files="$ac_config_files"
14230-
config_headers="$ac_config_headers"
14300+
config_files="`echo $ac_config_files`"
14301+
config_headers="`echo $ac_config_headers`"
1423114302
1423214303
_ACEOF
1423314304

configure.in

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

26442644
AC_MSG_CHECKING(for flock)
2645+
have_flock=no
26452646
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
26462647
#include <sys/file.h>
26472648
]], [[void* p = flock]])],
26482649
[AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2649-
AC_MSG_RESULT(yes)],
2650-
[AC_MSG_RESULT(no)
2650+
have_flock=yes
26512651
])
2652+
AC_MSG_RESULT($have_flock)
2653+
2654+
if test "$have_flock" = yes ; then
2655+
AC_MSG_CHECKING(if flock requires additional libraries.)
2656+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2657+
#include <sys/file.h>
2658+
]], [[void *p = flock; flock(0, 0)]])],
2659+
[AC_MSG_RESULT(no)],
2660+
[AC_MSG_RESULT(yes)
2661+
AC_CHECK_LIB(bsd,flock, [
2662+
AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
2663+
])
2664+
])
2665+
fi
26522666

26532667
AC_MSG_CHECKING(for getpagesize)
26542668
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
/* Define if --enable-ipv6 is specified */
3131
#undef ENABLE_IPV6
3232

33+
/* Define if flock needs to be linked with bsd library */
34+
#undef FLOCK_NEEDS_LIBBSD
35+
3336
/* Define if getpgrp() must be called as getpgrp(0). */
3437
#undef GETPGRP_HAVE_ARG
3538

setup.py

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

501501
# fcntl(2) and ioctl(2)
502-
exts.append( Extension('fcntl', ['fcntlmodule.c']) )
502+
libs = []
503+
if (config_h_vars.get('FLOCK_NEEDS_LIBBSD', False)):
504+
# May be necessary on AIX for flock function
505+
libs = ['bsd']
506+
exts.append( Extension('fcntl', ['fcntlmodule.c'], libraries=libs) )
503507
# pwd(3)
504508
exts.append( Extension('pwd', ['pwdmodule.c']) )
505509
# grp(3)

0 commit comments

Comments
 (0)