diff --git a/build/openldap.m4 b/build/openldap.m4 index 9b4b8ea22597aec6ac122583f4783a12d619f5c8..14731edda2f66629fb75176a39e86a81bf912565 100644 --- a/build/openldap.m4 +++ b/build/openldap.m4 @@ -394,6 +394,28 @@ fi ]) dnl dnl ==================================================================== +dnl Check if system uses EBCDIC instead of ASCII +AC_DEFUN([OL_SYS_EBCDIC], +[ +AC_MSG_CHECKING([for EBCDIC]) +AC_CACHE_VAL(ol_cv_sys_ebcdic,[ + AC_TRY_RUN([ +main() +{ + if ('M' == 0xd4) + exit(1); + else + exit(0); +}], + [ol_cv_sys_ebcdic=no], + [ol_cv_sys_ebcdic=yes])]) +AC_MSG_RESULT($ol_cv_sys_ebcdic) +if test $ol_cv_sys_ebcdic != no ; then + AC_DEFINE(HAVE_EBCDIC,1, [define if system uses EBCDIC instead of ASCII]) +fi +]) +dnl +dnl ==================================================================== 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 Reported by Keith Bostic. diff --git a/configure b/configure index f3d4220f0993edd80f53735312a9359c2f9ef132..2e1441554c0ed2178d1ea8b8695fc08e6b0cec14 100755 --- a/configure +++ b/configure @@ -10016,14 +10016,58 @@ done # Check Configuration +echo $ac_n "checking for EBCDIC""... $ac_c" 1>&6 +echo "configure:10021: checking for EBCDIC" >&5 +if eval "test \"`echo '$''{'ol_cv_sys_ebcdic'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 10030 "configure" +#include "confdefs.h" + +main() +{ + if ('M' == 0xd4) + exit(1); + else + exit(0); +} +EOF +if { (eval echo configure:10041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ol_cv_sys_ebcdic=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ol_cv_sys_ebcdic=yes +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ol_cv_sys_ebcdic" 1>&6 +if test $ol_cv_sys_ebcdic != no ; then + cat >> confdefs.h <<\EOF +#define HAVE_EBCDIC 1 +EOF + +fi + + echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 -echo "configure:10021: checking declaration of sys_errlist" >&5 +echo "configure:10065: checking declaration of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10027 "configure" +#line 10071 "configure" #include "confdefs.h" #include <stdio.h> @@ -10033,7 +10077,7 @@ int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:10037: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_sys_errlist=yes else @@ -10053,20 +10097,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then EOF echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 -echo "configure:10057: checking existence of sys_errlist" >&5 +echo "configure:10101: checking existence of sys_errlist" >&5 if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10063 "configure" +#line 10107 "configure" #include "confdefs.h" #include <errno.h> int main() { char *c = (char *) *sys_errlist ; return 0; } EOF -if { (eval echo configure:10070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ol_cv_have_sys_errlist=yes else @@ -10090,13 +10134,13 @@ fi echo $ac_n "checking strdup declaration""... $ac_c" 1>&6 -echo "configure:10094: checking strdup declaration" >&5 +echo "configure:10138: checking strdup declaration" >&5 if eval "test \"`echo '$''{'ol_cv_dcl_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10100 "configure" +#line 10144 "configure" #include "confdefs.h" #include <string.h> @@ -10104,7 +10148,7 @@ int main() { extern char *strdup(); ; return 0; } EOF -if { (eval echo configure:10108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10152: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ol_cv_dcl_strdup=yes else diff --git a/configure.in b/configure.in index 38ad26b0d7ff26fa9350b8c2ef52170082ec604e..0fdab25cf3d75b2c30c295404c5ffeb270109085 100644 --- a/configure.in +++ b/configure.in @@ -1669,6 +1669,7 @@ AC_REPLACE_FUNCS(getopt tempnam) dnl ---------------------------------------------------------------- # Check Configuration +OL_SYS_EBCDIC OL_SYS_ERRLIST dnl ---------------------------------------------------------------- diff --git a/include/portable.h.in b/include/portable.h.in index 90a92f1e169197f32da99d99bd97fb5193aa8deb..6b5c8c1d41b2735faef99495ee1b56e56bb589e3 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -663,6 +663,9 @@ /* define if cross compiling */ #undef CROSS_COMPILING +/* define if system uses EBCDIC instead of ASCII */ +#undef HAVE_EBCDIC + /* define if sys_errlist is not declared in stdio.h or errno.h */ #undef DECL_SYS_ERRLIST