summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-02 21:21:35 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-02 21:21:35 +0200
commit9d8bfae50fdaf5f5ec6307c60ebd1fad0927c6be (patch)
tree18088c1843a58322b1295a226ad60c8fef88190f
parenta5d3841177e0b3545381c875d0b4b442f38784bd (diff)
patch 8.2.1570: configure check for dirfd() does not work on HPUXv8.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)
-rwxr-xr-xsrc/auto/configure10
-rw-r--r--src/configure.ac4
-rw-r--r--src/fileio.c5
-rw-r--r--src/globals.h3
-rw-r--r--src/version.c2
5 files changed, 17 insertions, 7 deletions
diff --git a/src/auto/configure b/src/auto/configure
index c85dec9dac..e66162fd63 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -13771,7 +13771,7 @@ DIR * dir=opendir("dirname"); dirfd(dir);
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+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,7 +13779,8 @@ else
{ $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
+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,7 +13795,7 @@ flock(10, LOCK_SH);
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+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,7 +13803,8 @@ else
{ $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
+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; }
diff --git a/src/configure.ac b/src/configure.ac
index a2683a6b10..6176dc9ca5 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -4013,7 +4013,7 @@ AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
dnl check for dirfd()
AC_MSG_CHECKING(for dirfd)
-AC_TRY_COMPILE(
+AC_TRY_LINK(
[#include <sys/types.h>
#include <dirent.h>],
[DIR * dir=opendir("dirname"); dirfd(dir);],
@@ -4021,7 +4021,7 @@ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DIRFD), AC_MSG_RESULT(not usable))
dnl check for flock()
AC_MSG_CHECKING(for flock)
-AC_TRY_COMPILE(
+AC_TRY_LINK(
[#include <sys/file.h>],
[flock(10, LOCK_SH);],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOCK), AC_MSG_RESULT(not usable))
diff --git a/src/fileio.c b/src/fileio.c
index 361109313b..aa6596df64 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -24,6 +24,11 @@
// 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);
diff --git a/src/globals.h b/src/globals.h
index 1a764b5091..7dbc49e3ec 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -773,7 +773,8 @@ EXTERN int ru_wid; // 'rulerfmt' width of ruler when non-zero
EXTERN int sc_col; // column for shown command
#ifdef TEMPDIRNAMES
-# if defined(UNIX) && defined(HAVE_FLOCK) && defined(HAVE_DIRFD)
+# 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.
diff --git a/src/version.c b/src/version.c
index 6d97899c01..6b4c1cd273 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1570,
+/**/
1569,
/**/
1568,