mirror of
https://github.com/znc/znc.git
synced 2026-08-06 17:03:14 +02:00
Check if lstat() is available and use stat() instead if it isn't
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1339 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifndef HAVE_LSTAT
|
||||
# define lstat(a, b) stat(a, b)
|
||||
#endif
|
||||
|
||||
CFile::CFile() {
|
||||
m_iFD = -1;
|
||||
m_bClose = false;
|
||||
|
||||
@@ -2605,16 +2605,9 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in stat lstat chmod open
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
|
||||
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
{ echo "$as_me:$LINENO: checking for lstat" >&5
|
||||
echo $ECHO_N "checking for lstat... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_func_lstat+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
@@ -2623,12 +2616,12 @@ _ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
||||
/* Define lstat to an innocuous variant, in case <limits.h> declares lstat.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define $ac_func innocuous_$ac_func
|
||||
#define lstat innocuous_lstat
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func (); below.
|
||||
which can conflict with char lstat (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
@@ -2638,7 +2631,7 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef $ac_func
|
||||
#undef lstat
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
@@ -2646,18 +2639,18 @@ cat >>conftest.$ac_ext <<_ACEOF
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char $ac_func ();
|
||||
char lstat ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined __stub_$ac_func || defined __stub___$ac_func
|
||||
#if defined __stub_lstat || defined __stub___lstat
|
||||
choke me
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return $ac_func ();
|
||||
return lstat ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -2680,31 +2673,22 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
eval "$as_ac_var=yes"
|
||||
ac_cv_func_lstat=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_var=no"
|
||||
ac_cv_func_lstat=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
ac_res=`eval echo '${'$as_ac_var'}'`
|
||||
{ echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
echo "${ECHO_T}$ac_res" >&6; }
|
||||
if test `eval echo '${'$as_ac_var'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
{ { echo "$as_me:$LINENO: error: missing required libc feature" >&5
|
||||
echo "$as_me: error: missing required libc feature" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_func_lstat" >&5
|
||||
echo "${ECHO_T}$ac_cv_func_lstat" >&6; }
|
||||
if test $ac_cv_func_lstat = yes; then
|
||||
appendCXX -DHAVE_LSTAT
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if test -z "$NOSSL"; then
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ if test "x$GXX" = "xyes"; then
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB( gnugetopt, getopt_long,)
|
||||
AC_CHECK_FUNCS( stat lstat chmod open, , AC_MSG_ERROR([missing required libc feature]))
|
||||
AC_CHECK_FUNC([lstat], [appendCXX -DHAVE_LSTAT])
|
||||
|
||||
if test -z "$NOSSL"; then
|
||||
if test -n "$OPENSSL"; then
|
||||
|
||||
Reference in New Issue
Block a user