Patch 8.2.1570
Problem:    Configure check for dirfd() does not work on HPUX. (Michael Osipov)
Solution:   Use AC_TRY_LINK instead of AC_TRY_COMPILE. (closes #6838)
Files:      src/configure.ac, src/auto/configure, src/fileio.c, src/globals.h


*** ../vim-8.2.1569/src/configure.ac    2020-08-13 21:05:31.785361610 +0200
--- src/configure.ac    2020-09-02 13:23:42.487757844 +0200
***************
*** 4013,4019 ****
  
  dnl check for dirfd()
  AC_MSG_CHECKING(for dirfd)
! AC_TRY_COMPILE(
  [#include <sys/types.h>
  #include <dirent.h>],
  [DIR * dir=opendir("dirname"); dirfd(dir);],
--- 4013,4019 ----
  
  dnl check for dirfd()
  AC_MSG_CHECKING(for dirfd)
! AC_TRY_LINK(
  [#include <sys/types.h>
  #include <dirent.h>],
  [DIR * dir=opendir("dirname"); dirfd(dir);],
***************
*** 4021,4027 ****
  
  dnl check for flock()
  AC_MSG_CHECKING(for flock)
! AC_TRY_COMPILE(
  [#include <sys/file.h>],
  [flock(10, LOCK_SH);],
  AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOCK), AC_MSG_RESULT(not usable))
--- 4021,4027 ----
  
  dnl check for flock()
  AC_MSG_CHECKING(for flock)
! AC_TRY_LINK(
  [#include <sys/file.h>],
  [flock(10, LOCK_SH);],
  AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOCK), AC_MSG_RESULT(not usable))
*** ../vim-8.2.1569/src/auto/configure  2020-08-13 21:05:31.785361610 +0200
--- src/auto/configure  2020-09-02 21:20:56.620918692 +0200
***************
*** 13771,13777 ****
    return 0;
  }
  _ACEOF
! if ac_fn_c_try_compile "$LINENO"; then :
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  $as_echo "yes" >&6; }; $as_echo "#define HAVE_DIRFD 1" >>confdefs.h
  
--- 13771,13777 ----
    return 0;
  }
  _ACEOF
! if ac_fn_c_try_link "$LINENO"; then :
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  $as_echo "yes" >&6; }; $as_echo "#define HAVE_DIRFD 1" >>confdefs.h
  
***************
*** 13779,13785 ****
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5
  $as_echo "not usable" >&6; }
  fi
! rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock" >&5
  $as_echo_n "checking for flock... " >&6; }
--- 13779,13786 ----
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5
  $as_echo "not usable" >&6; }
  fi
! rm -f core conftest.err conftest.$ac_objext \
!     conftest$ac_exeext conftest.$ac_ext
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flock" >&5
  $as_echo_n "checking for flock... " >&6; }
***************
*** 13794,13800 ****
    return 0;
  }
  _ACEOF
! if ac_fn_c_try_compile "$LINENO"; then :
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  $as_echo "yes" >&6; }; $as_echo "#define HAVE_FLOCK 1" >>confdefs.h
  
--- 13795,13801 ----
    return 0;
  }
  _ACEOF
! if ac_fn_c_try_link "$LINENO"; then :
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  $as_echo "yes" >&6; }; $as_echo "#define HAVE_FLOCK 1" >>confdefs.h
  
***************
*** 13802,13808 ****
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5
  $as_echo "not usable" >&6; }
  fi
! rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysctl" >&5
  $as_echo_n "checking for sysctl... " >&6; }
--- 13803,13810 ----
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable" >&5
  $as_echo "not usable" >&6; }
  fi
! rm -f core conftest.err conftest.$ac_objext \
!     conftest$ac_exeext conftest.$ac_ext
  
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysctl" >&5
  $as_echo_n "checking for sysctl... " >&6; }
*** ../vim-8.2.1569/src/fileio.c        2020-08-11 21:58:12.581968226 +0200
--- src/fileio.c        2020-09-02 21:16:24.441831818 +0200
***************
*** 24,29 ****
--- 24,34 ----
  // Is there any system that doesn't have access()?
  #define USE_MCH_ACCESS
  
+ #if defined(__hpux) && !defined(HAVE_DIRFD)
+ # define dirfd(x) ((x)->__dd_fd)
+ # define HAVE_DIRFD
+ #endif
+ 
  static char_u *next_fenc(char_u **pp, int *alloced);
  #ifdef FEAT_EVAL
  static char_u *readfile_charconvert(char_u *fname, char_u *fenc, int *fdp);
*** ../vim-8.2.1569/src/globals.h       2020-08-29 13:39:12.578557657 +0200
--- src/globals.h       2020-09-02 21:17:12.677695945 +0200
***************
*** 773,779 ****
  EXTERN int    sc_col;         // column for shown command
  
  #ifdef TEMPDIRNAMES
! # if defined(UNIX) && defined(HAVE_FLOCK) && defined(HAVE_DIRFD)
  EXTERN DIR    *vim_tempdir_dp INIT(= NULL); // File descriptor of temp dir
  # endif
  EXTERN char_u *vim_tempdir INIT(= NULL); // Name of Vim's own temp dir.
--- 773,780 ----
  EXTERN int    sc_col;         // column for shown command
  
  #ifdef TEMPDIRNAMES
! # if defined(UNIX) && defined(HAVE_FLOCK) \
!       && (defined(HAVE_DIRFD) || defined(__hpux))
  EXTERN DIR    *vim_tempdir_dp INIT(= NULL); // File descriptor of temp dir
  # endif
  EXTERN char_u *vim_tempdir INIT(= NULL); // Name of Vim's own temp dir.
*** ../vim-8.2.1569/src/version.c       2020-09-02 21:02:32.304208489 +0200
--- src/version.c       2020-09-02 21:21:14.088858059 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     1570,
  /**/

-- 
ARTHUR:    Well, it doesn't matter.  Will you go and tell your master that
           Arthur from the Court of Camelot is here.
GUARD #1:  Listen, in order to maintain air-speed velocity, a swallow
           needs to beat its wings 43 times every second, right?
ARTHUR:    Please!
                                  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202009021922.082JMSjs3676256%40masaka.moolenaar.net.

Raspunde prin e-mail lui