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

Skip to content

Commit a4e4ae2

Browse files
committed
Followup to #4026: better patch for flock detection.
1 parent 66d00ad commit a4e4ae2

2 files changed

Lines changed: 42 additions & 56 deletions

File tree

configure

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 84512 .
2+
# From configure.in Revision: 84584 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.65 for python 3.2.
55
#
@@ -9586,56 +9586,45 @@ $as_echo "no" >&6; }
95869586
fi
95879587
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
95889588
9589-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock" >&5
9590-
$as_echo_n "checking for flock... " >&6; }
9591-
have_flock=no
9592-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9589+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock declaration" >&5
9590+
$as_echo_n "checking for flock declaration... " >&6; }
9591+
if test "${ac_cv_flock_decl+set}" = set; then :
9592+
$as_echo_n "(cached) " >&6
9593+
else
9594+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
95939595
/* end confdefs.h. */
9594-
95959596
#include <sys/file.h>
9596-
95979597
int
95989598
main ()
95999599
{
96009600
void* p = flock
9601+
96019602
;
96029603
return 0;
96039604
}
96049605
_ACEOF
96059606
if ac_fn_c_try_compile "$LINENO"; then :
9606-
9607-
$as_echo "#define HAVE_FLOCK 1" >>confdefs.h
9608-
9609-
have_flock=yes
9607+
ac_cv_flock_decl=yes
9608+
else
9609+
ac_cv_flock_decl=no
96109610
96119611
fi
96129612
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. */
96219613
9622-
#include <sys/file.h>
9623-
9624-
int
9625-
main ()
9626-
{
9627-
void *p = flock; flock(0, 0)
9628-
;
9629-
return 0;
9630-
}
9614+
fi
9615+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_flock_decl" >&5
9616+
$as_echo "$ac_cv_flock_decl" >&6; }
9617+
if test "x${ac_cv_flock_decl}" = xyes; then
9618+
for ac_func in flock
9619+
do :
9620+
ac_fn_c_check_func "$LINENO" "flock" "ac_cv_func_flock"
9621+
if test "x$ac_cv_func_flock" = x""yes; then :
9622+
cat >>confdefs.h <<_ACEOF
9623+
#define HAVE_FLOCK 1
96319624
_ACEOF
9632-
if ac_fn_c_try_link "$LINENO"; then :
9633-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
9634-
$as_echo "no" >&6; }
9625+
96359626
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
9627+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock in -lbsd" >&5
96399628
$as_echo_n "checking for flock in -lbsd... " >&6; }
96409629
if test "${ac_cv_lib_bsd_flock+set}" = set; then :
96419630
$as_echo_n "(cached) " >&6
@@ -9672,6 +9661,7 @@ fi
96729661
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_flock" >&5
96739662
$as_echo "$ac_cv_lib_bsd_flock" >&6; }
96749663
if test "x$ac_cv_lib_bsd_flock" = x""yes; then :
9664+
$as_echo "#define HAVE_FLOCK 1" >>confdefs.h
96759665
96769666
96779667
$as_echo "#define FLOCK_NEEDS_LIBBSD 1" >>confdefs.h
@@ -9681,8 +9671,8 @@ fi
96819671
96829672
96839673
fi
9684-
rm -f core conftest.err conftest.$ac_objext \
9685-
conftest$ac_exeext conftest.$ac_ext
9674+
done
9675+
96869676
fi
96879677
96889678
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpagesize" >&5

configure.in

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2641,27 +2641,23 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
26412641
[AC_MSG_RESULT(no)
26422642
])
26432643

2644-
AC_MSG_CHECKING(for flock)
2645-
have_flock=no
2646-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2647-
#include <sys/file.h>
2648-
]], [[void* p = flock]])],
2649-
[AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2650-
have_flock=yes
2644+
AC_CACHE_CHECK([for flock declaration], [ac_cv_flock_decl],
2645+
[AC_COMPILE_IFELSE(
2646+
[AC_LANG_PROGRAM(
2647+
[#include <sys/file.h>],
2648+
[void* p = flock]
2649+
)],
2650+
[ac_cv_flock_decl=yes],
2651+
[ac_cv_flock_decl=no]
2652+
)
26512653
])
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-
])
2654+
if test "x${ac_cv_flock_decl}" = xyes; then
2655+
AC_CHECK_FUNCS(flock,,
2656+
AC_CHECK_LIB(bsd,flock,
2657+
[AC_DEFINE(HAVE_FLOCK)
2658+
AC_DEFINE(FLOCK_NEEDS_LIBBSD, 1, Define if flock needs to be linked with bsd library.)
2659+
])
2660+
)
26652661
fi
26662662

26672663
AC_MSG_CHECKING(for getpagesize)

0 commit comments

Comments
 (0)