mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
Use AC_CACHE_CHECK instead of AC_CACHE_VAR.
Rework sys_errlist detection to set HAVE_SYS_ERRLIST if sys_errlist exists. If it declaration is needed, DECL_SYS_ERRLIST is also set.
This commit is contained in:
parent
de67e6d327
commit
095f78b392
4 changed files with 359 additions and 367 deletions
|
|
@ -120,8 +120,7 @@ dnl
|
||||||
dnl ====================================================================
|
dnl ====================================================================
|
||||||
dnl Check if system uses EBCDIC instead of ASCII
|
dnl Check if system uses EBCDIC instead of ASCII
|
||||||
AC_DEFUN([OL_CPP_EBCDIC], [# test for EBCDIC
|
AC_DEFUN([OL_CPP_EBCDIC], [# test for EBCDIC
|
||||||
AC_MSG_CHECKING([for EBCDIC])
|
AC_CACHE_CHECK([for EBCDIC],ol_cv_cpp_ebcdic,[
|
||||||
AC_CACHE_VAL(ol_cv_cpp_ebcdic,[
|
|
||||||
AC_TRY_CPP([
|
AC_TRY_CPP([
|
||||||
#if !('M' == 0xd4)
|
#if !('M' == 0xd4)
|
||||||
#include <__ASCII__/generate_error.h>
|
#include <__ASCII__/generate_error.h>
|
||||||
|
|
@ -129,7 +128,6 @@ AC_CACHE_VAL(ol_cv_cpp_ebcdic,[
|
||||||
],
|
],
|
||||||
[ol_cv_cpp_ebcdic=yes],
|
[ol_cv_cpp_ebcdic=yes],
|
||||||
[ol_cv_cpp_ebcdic=no])])
|
[ol_cv_cpp_ebcdic=no])])
|
||||||
AC_MSG_RESULT($ol_cv_cpp_ebcdic)
|
|
||||||
if test $ol_cv_cpp_ebcdic = yes ; then
|
if test $ol_cv_cpp_ebcdic = yes ; then
|
||||||
AC_DEFINE(HAVE_EBCDIC,1, [define if system uses EBCDIC instead of ASCII])
|
AC_DEFINE(HAVE_EBCDIC,1, [define if system uses EBCDIC instead of ASCII])
|
||||||
fi
|
fi
|
||||||
|
|
@ -183,15 +181,13 @@ dnl
|
||||||
dnl ====================================================================
|
dnl ====================================================================
|
||||||
dnl Check if struct passwd has pw_gecos
|
dnl Check if struct passwd has pw_gecos
|
||||||
AC_DEFUN([OL_STRUCT_PASSWD_PW_GECOS], [# test for pw_gecos in struct passwd
|
AC_DEFUN([OL_STRUCT_PASSWD_PW_GECOS], [# test for pw_gecos in struct passwd
|
||||||
AC_MSG_CHECKING([struct passwd for pw_gecos])
|
AC_CACHE_CHECK([struct passwd for pw_gecos],ol_cv_struct_passwd_pw_gecos,[
|
||||||
AC_CACHE_VAL(ol_cv_struct_passwd_pw_gecos,[
|
|
||||||
AC_TRY_COMPILE([#include <pwd.h>],[
|
AC_TRY_COMPILE([#include <pwd.h>],[
|
||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
pwd.pw_gecos = pwd.pw_name;
|
pwd.pw_gecos = pwd.pw_name;
|
||||||
],
|
],
|
||||||
[ol_cv_struct_passwd_pw_gecos=yes],
|
[ol_cv_struct_passwd_pw_gecos=yes],
|
||||||
[ol_cv_struct_passwd_pw_gecos=no])])
|
[ol_cv_struct_passwd_pw_gecos=no])])
|
||||||
AC_MSG_RESULT($ol_cv_struct_passwd_pw_gecos)
|
|
||||||
if test $ol_cv_struct_passwd_pw_gecos = yes ; then
|
if test $ol_cv_struct_passwd_pw_gecos = yes ; then
|
||||||
AC_DEFINE(HAVE_PW_GECOS,1, [define if struct passwd has pw_gecos])
|
AC_DEFINE(HAVE_PW_GECOS,1, [define if struct passwd has pw_gecos])
|
||||||
fi
|
fi
|
||||||
|
|
@ -200,15 +196,13 @@ dnl
|
||||||
dnl --------------------------------------------------------------------
|
dnl --------------------------------------------------------------------
|
||||||
dnl Check if struct passwd has pw_passwd
|
dnl Check if struct passwd has pw_passwd
|
||||||
AC_DEFUN([OL_STRUCT_PASSWD_PW_PASSWD], [# test for pw_passwd in struct passwd
|
AC_DEFUN([OL_STRUCT_PASSWD_PW_PASSWD], [# test for pw_passwd in struct passwd
|
||||||
AC_MSG_CHECKING([struct passwd for pw_passwd])
|
AC_CACHE_CHECK([struct passwd for pw_passwd],ol_cv_struct_passwd_pw_passwd,[
|
||||||
AC_CACHE_VAL(ol_cv_struct_passwd_pw_passwd,[
|
|
||||||
AC_TRY_COMPILE([#include <pwd.h>],[
|
AC_TRY_COMPILE([#include <pwd.h>],[
|
||||||
struct passwd pwd;
|
struct passwd pwd;
|
||||||
pwd.pw_passwd = pwd.pw_name;
|
pwd.pw_passwd = pwd.pw_name;
|
||||||
],
|
],
|
||||||
[ol_cv_struct_passwd_pw_passwd=yes],
|
[ol_cv_struct_passwd_pw_passwd=yes],
|
||||||
[ol_cv_struct_passwd_pw_passwd=no])])
|
[ol_cv_struct_passwd_pw_passwd=no])])
|
||||||
AC_MSG_RESULT($ol_cv_struct_passwd_pw_passwd)
|
|
||||||
if test $ol_cv_struct_passwd_pw_passwd = yes ; then
|
if test $ol_cv_struct_passwd_pw_passwd = yes ; then
|
||||||
AC_DEFINE(HAVE_PW_PASSWD,1, [define if struct passwd has pw_passwd])
|
AC_DEFINE(HAVE_PW_PASSWD,1, [define if struct passwd has pw_passwd])
|
||||||
fi
|
fi
|
||||||
|
|
@ -627,8 +621,7 @@ dnl
|
||||||
dnl ====================================================================
|
dnl ====================================================================
|
||||||
dnl Check for POSIX Regex
|
dnl Check for POSIX Regex
|
||||||
AC_DEFUN([OL_POSIX_REGEX], [
|
AC_DEFUN([OL_POSIX_REGEX], [
|
||||||
AC_MSG_CHECKING([for compatible POSIX regex])
|
AC_CACHE_CHECK([for compatible POSIX regex],ol_cv_c_posix_regex,[
|
||||||
AC_CACHE_VAL(ol_cv_c_posix_regex,[
|
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
|
|
@ -655,15 +648,12 @@ main()
|
||||||
[ol_cv_c_posix_regex=yes],
|
[ol_cv_c_posix_regex=yes],
|
||||||
[ol_cv_c_posix_regex=no],
|
[ol_cv_c_posix_regex=no],
|
||||||
[ol_cv_c_posix_regex=cross])])
|
[ol_cv_c_posix_regex=cross])])
|
||||||
AC_MSG_RESULT($ol_cv_c_posix_regex)
|
|
||||||
])
|
])
|
||||||
dnl
|
dnl
|
||||||
dnl ====================================================================
|
dnl ====================================================================
|
||||||
dnl Check if toupper() requires islower() to be called first
|
dnl Check if toupper() requires islower() to be called first
|
||||||
AC_DEFUN([OL_C_UPPER_LOWER],
|
AC_DEFUN([OL_C_UPPER_LOWER],
|
||||||
[
|
[AC_CACHE_CHECK([if toupper() requires islower()],ol_cv_c_upper_lower,[
|
||||||
AC_MSG_CHECKING([if toupper() requires islower()])
|
|
||||||
AC_CACHE_VAL(ol_cv_c_upper_lower,[
|
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
main()
|
main()
|
||||||
|
|
@ -676,7 +666,6 @@ main()
|
||||||
[ol_cv_c_upper_lower=no],
|
[ol_cv_c_upper_lower=no],
|
||||||
[ol_cv_c_upper_lower=yes],
|
[ol_cv_c_upper_lower=yes],
|
||||||
[ol_cv_c_upper_lower=safe])])
|
[ol_cv_c_upper_lower=safe])])
|
||||||
AC_MSG_RESULT($ol_cv_c_upper_lower)
|
|
||||||
if test $ol_cv_c_upper_lower != no ; then
|
if test $ol_cv_c_upper_lower != no ; then
|
||||||
AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
|
AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
|
||||||
fi
|
fi
|
||||||
|
|
@ -687,33 +676,31 @@ dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
|
||||||
dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
|
dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
|
||||||
dnl Reported by Keith Bostic.
|
dnl Reported by Keith Bostic.
|
||||||
AC_DEFUN([OL_SYS_ERRLIST],
|
AC_DEFUN([OL_SYS_ERRLIST],
|
||||||
[
|
[AC_CACHE_CHECK([declaration of sys_errlist],ol_cv_dcl_sys_errlist,[
|
||||||
AC_MSG_CHECKING([declaration of sys_errlist])
|
|
||||||
AC_CACHE_VAL(ol_cv_dcl_sys_errlist,[
|
|
||||||
AC_TRY_COMPILE([
|
AC_TRY_COMPILE([
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <errno.h> ],
|
#include <errno.h> ],
|
||||||
[char *c = (char *) *sys_errlist],
|
[char *c = (char *) *sys_errlist],
|
||||||
[ol_cv_dcl_sys_errlist=yes],
|
[ol_cv_dcl_sys_errlist=yes
|
||||||
|
ol_cv_have_sys_errlist=yes],
|
||||||
[ol_cv_dcl_sys_errlist=no])])
|
[ol_cv_dcl_sys_errlist=no])])
|
||||||
AC_MSG_RESULT($ol_cv_dcl_sys_errlist)
|
#
|
||||||
# It's possible (for near-UNIX clones) that sys_errlist doesn't exist
|
# It's possible (for near-UNIX clones) that sys_errlist doesn't exist
|
||||||
if test $ol_cv_dcl_sys_errlist = no ; then
|
if test $ol_cv_dcl_sys_errlist = no ; then
|
||||||
AC_DEFINE(DECL_SYS_ERRLIST,1,
|
AC_DEFINE(DECL_SYS_ERRLIST,1,
|
||||||
[define if sys_errlist is not declared in stdio.h or errno.h])
|
[define if sys_errlist is not declared in stdio.h or errno.h])
|
||||||
AC_MSG_CHECKING([existence of sys_errlist])
|
|
||||||
AC_CACHE_VAL(ol_cv_have_sys_errlist,[
|
AC_CACHE_CHECK([existence of sys_errlist],ol_cv_have_sys_errlist,[
|
||||||
AC_TRY_LINK([#include <errno.h>],
|
AC_TRY_LINK([#include <errno.h>],
|
||||||
[char *c = (char *) *sys_errlist],
|
[char *c = (char *) *sys_errlist],
|
||||||
[ol_cv_have_sys_errlist=yes],
|
[ol_cv_have_sys_errlist=yes],
|
||||||
[ol_cv_have_sys_errlist=no])])
|
[ol_cv_have_sys_errlist=no])])
|
||||||
AC_MSG_RESULT($ol_cv_have_sys_errlist)
|
fi
|
||||||
if test $ol_cv_have_sys_errlist = yes ; then
|
if test $ol_cv_have_sys_errlist = yes ; then
|
||||||
AC_DEFINE(HAVE_SYS_ERRLIST,1,
|
AC_DEFINE(HAVE_SYS_ERRLIST,1,
|
||||||
[define if you actually have sys_errlist in your libs])
|
[define if you actually have sys_errlist in your libs])
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
])dnl
|
])dnl
|
||||||
dnl
|
dnl
|
||||||
dnl ====================================================================
|
dnl ====================================================================
|
||||||
|
|
|
||||||
23
configure.in
23
configure.in
|
|
@ -827,8 +827,8 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
dnl pthread_create in $LIBS
|
dnl pthread_create in $LIBS
|
||||||
AC_MSG_CHECKING([for pthread_create in default libraries])
|
AC_CACHE_CHECK([for pthread_create in default libraries],
|
||||||
AC_CACHE_VAL(ol_cv_pthread_create,[
|
ol_cv_pthread_create,[
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
|
|
@ -873,7 +873,6 @@ int main(argc, argv)
|
||||||
[ol_cv_pthread_create=no],
|
[ol_cv_pthread_create=no],
|
||||||
[dnl assume yes
|
[dnl assume yes
|
||||||
ol_cv_pthread_create=yes])])
|
ol_cv_pthread_create=yes])])
|
||||||
AC_MSG_RESULT($ol_cv_pthread_create)
|
|
||||||
|
|
||||||
if test $ol_cv_pthread_create != no ; then
|
if test $ol_cv_pthread_create != no ; then
|
||||||
ol_link_threads=posix
|
ol_link_threads=posix
|
||||||
|
|
@ -990,8 +989,8 @@ dnl [ol_cv_pthread_lpthread_lexc])
|
||||||
AC_MSG_ERROR([LinuxThreads header/library mismatch]);
|
AC_MSG_ERROR([LinuxThreads header/library mismatch]);
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([if pthread_create() works])
|
AC_CACHE_CHECK([if pthread_create() works],
|
||||||
AC_CACHE_VAL(ol_cv_pthread_create_works,[
|
ol_cv_pthread_create_works,[
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
|
|
@ -1020,7 +1019,6 @@ int main(argc, argv)
|
||||||
[ol_cv_pthread_create_works=no],
|
[ol_cv_pthread_create_works=no],
|
||||||
[dnl assume yes
|
[dnl assume yes
|
||||||
ol_cv_pthread_create_works=yes])])
|
ol_cv_pthread_create_works=yes])])
|
||||||
AC_MSG_RESULT($ol_cv_pthread_create_works)
|
|
||||||
|
|
||||||
if test $ol_cv_pthread_create_works = no ; then
|
if test $ol_cv_pthread_create_works = no ; then
|
||||||
AC_MSG_ERROR([pthread_create is not usable, check environment settings])
|
AC_MSG_ERROR([pthread_create is not usable, check environment settings])
|
||||||
|
|
@ -1028,8 +1026,8 @@ int main(argc, argv)
|
||||||
|
|
||||||
dnl Check if select causes an yield
|
dnl Check if select causes an yield
|
||||||
if test $ol_with_yielding_select = auto ; then
|
if test $ol_with_yielding_select = auto ; then
|
||||||
AC_MSG_CHECKING([if select yields when using pthreads])
|
AC_CACHE_CHECK([if select yields when using pthreads],
|
||||||
AC_CACHE_VAL(ol_cv_pthread_select_yields,[
|
ol_cv_pthread_select_yields,[
|
||||||
AC_TRY_RUN([
|
AC_TRY_RUN([
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
@ -1104,9 +1102,12 @@ int main(argc, argv)
|
||||||
exit(2);
|
exit(2);
|
||||||
}],
|
}],
|
||||||
[ol_cv_pthread_select_yields=no],
|
[ol_cv_pthread_select_yields=no],
|
||||||
[ol_cv_pthread_select_yields=yes], [
|
[ol_cv_pthread_select_yields=yes],
|
||||||
AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])])
|
[ol_cv_pthread_select_yields=cross])])
|
||||||
AC_MSG_RESULT($ol_cv_pthread_select_yields)
|
|
||||||
|
if test $ol_cv_pthread_select_yields = cross ; then
|
||||||
|
AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])
|
||||||
|
fi
|
||||||
|
|
||||||
if test $ol_cv_pthread_select_yields = yes ; then
|
if test $ol_cv_pthread_select_yields = yes ; then
|
||||||
ol_with_yielding_select=yes
|
ol_with_yielding_select=yes
|
||||||
|
|
|
||||||
|
|
@ -18,15 +18,15 @@
|
||||||
# include <sys/errno.h>
|
# include <sys/errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DECL_SYS_ERRLIST
|
|
||||||
#ifndef HAVE_SYS_ERRLIST
|
#ifndef HAVE_SYS_ERRLIST
|
||||||
|
/* no sys_errlist */
|
||||||
# define sys_nerr 0
|
# define sys_nerr 0
|
||||||
# define sys_errlist ((char **)0)
|
# define sys_errlist ((char **)0)
|
||||||
#else
|
#elif DECL_SYS_ERRLIST
|
||||||
|
/* have sys_errlist but need declaration */
|
||||||
extern int sys_nerr;
|
extern int sys_nerr;
|
||||||
extern char *sys_errlist[];
|
extern char *sys_errlist[];
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char* strerror_r();
|
extern char* strerror_r();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue