#! /bin/sh
# $OpenLDAP$
-# from OpenLDAP: pkg/ldap/configure.in,v 1.280 1999/11/25 16:10:51 kdz Exp
+# from OpenLDAP: pkg/ldap/configure.in,v 1.279 1999/11/17 01:26:55 kdz Exp
# Copyright 1998,1999 The OpenLDAP Foundation. All Rights Reserved.
#
-if test "$ac_cv_sizeof_long" -lt 4 ; then
- { echo "configure: error: sizeof(long) < 4" 1>&2; exit 1; }
-fi
+if test "$ac_cv_sizeof_int" -lt 4 ; then
+ echo "configure: warning: OpenLDAP requires 'int' to be 32 bits or greater." 1>&2
-cat >> confdefs.h <<\EOF
+ cat >> confdefs.h <<\EOF
#define LBER_INT_T long
EOF
+else
+ cat >> confdefs.h <<\EOF
+#define LBER_INT_T int
+EOF
+
+fi
+
cat >> confdefs.h <<\EOF
#define LBER_LEN_T long
EOF
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:14078: checking for 8-bit clean memcmp" >&5
+echo "configure:14084: checking for 8-bit clean memcmp" >&5
if eval "test \"\${ac_cv_func_memcmp_clean+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 14086 "configure"
+#line 14092 "configure"
#include "confdefs.h"
main()
}
EOF
-if { (eval echo configure:14096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
echo $ac_n "checking for strftime""... $ac_c" 1>&6
-echo "configure:14114: checking for strftime" >&5
+echo "configure:14120: checking for strftime" >&5
if eval "test \"\${ac_cv_func_strftime+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14119 "configure"
+#line 14125 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strftime(); below. */
; return 0; }
EOF
-if { (eval echo configure:14143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strftime=yes"
else
echo "$ac_t""no" 1>&6
# strftime is in -lintl on SCO UNIX.
echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6
-echo "configure:14165: checking for strftime in -lintl" >&5
+echo "configure:14171: checking for strftime in -lintl" >&5
ac_lib_var=`echo intl'_'strftime | sed 'y%./+-:%__p__%'`
if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 14173 "configure"
+#line 14179 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
strftime()
; return 0; }
EOF
-if { (eval echo configure:14184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
echo $ac_n "checking for inet_aton()""... $ac_c" 1>&6
-echo "configure:14212: checking for inet_aton()" >&5
+echo "configure:14218: checking for inet_aton()" >&5
if eval "test \"\${ol_cv_func_inet_aton+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14217 "configure"
+#line 14223 "configure"
#include "confdefs.h"
#ifdef HAVE_SYS_TYPES_H
int rc = inet_aton( "255.255.255.255", &in );
; return 0; }
EOF
-if { (eval echo configure:14239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ol_cv_func_inet_aton=yes
else
echo $ac_n "checking for _spawnlp""... $ac_c" 1>&6
-echo "configure:14261: checking for _spawnlp" >&5
+echo "configure:14267: checking for _spawnlp" >&5
if eval "test \"\${ac_cv_func__spawnlp+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14266 "configure"
+#line 14272 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _spawnlp(); below. */
; return 0; }
EOF
-if { (eval echo configure:14290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__spawnlp=yes"
else
echo $ac_n "checking for _snprintf""... $ac_c" 1>&6
-echo "configure:14314: checking for _snprintf" >&5
+echo "configure:14320: checking for _snprintf" >&5
if eval "test \"\${ac_cv_func__snprintf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14319 "configure"
+#line 14325 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _snprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:14343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__snprintf=yes"
else
echo $ac_n "checking for _vsnprintf""... $ac_c" 1>&6
-echo "configure:14369: checking for _vsnprintf" >&5
+echo "configure:14375: checking for _vsnprintf" >&5
if eval "test \"\${ac_cv_func__vsnprintf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14374 "configure"
+#line 14380 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _vsnprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:14398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__vsnprintf=yes"
else
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:14424: checking for vprintf" >&5
+echo "configure:14430: checking for vprintf" >&5
if eval "test \"\${ac_cv_func_vprintf+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14429 "configure"
+#line 14435 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:14453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:14477: checking for _doprnt" >&5
+echo "configure:14483: checking for _doprnt" >&5
if eval "test \"\${ac_cv_func__doprnt+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14482 "configure"
+#line 14488 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:14506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
for ac_func in vsnprintf vsprintf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14535: checking for $ac_func" >&5
+echo "configure:14541: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14540 "configure"
+#line 14546 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14641: checking for $ac_func" >&5
+echo "configure:14647: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14646 "configure"
+#line 14652 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in getopt tempnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14698: checking for $ac_func" >&5
+echo "configure:14704: checking for $ac_func" >&5
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14703 "configure"
+#line 14709 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:14727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
# Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:14764: checking declaration of sys_errlist" >&5
+echo "configure:14770: checking declaration of sys_errlist" >&5
if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14770 "configure"
+#line 14776 "configure"
#include "confdefs.h"
#include <stdio.h>
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:14783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:14789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
ol_cv_have_sys_errlist=yes
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:14806: checking existence of sys_errlist" >&5
+echo "configure:14812: checking existence of sys_errlist" >&5
if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 14812 "configure"
+#line 14818 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:14819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14825: \"$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
{
int rc;
ber_len_t taglen;
- ber_tag_t ntag;
+ ber_len_t i;
+ unsigned char nettag[sizeof(ber_tag_t)];
+ ber_tag_t xtag;
assert( ber != NULL );
assert( BER_VALID( ber ) );
taglen = ber_calc_taglen( tag );
- ntag = LBER_TAG_HTON( tag );
+ for( i=0; i<taglen; i++ ) {
+ nettag[(sizeof(ber_tag_t)-1) - i] = tag & 0xffU;
+ tag >>= 8;
+ }
rc = ber_write( ber,
- ((char *) &ntag) + sizeof(ber_tag_t) - taglen,
+ &nettag[sizeof(ber_tag_t) - taglen],
taglen, nosos );
return rc;
static int
ber_put_len( BerElement *ber, ber_len_t len, int nosos )
{
- int i;
+ int rc;
+ int i,j;
char lenlen;
ber_len_t mask;
- ber_len_t netlen;
+ unsigned char netlen[sizeof(ber_len_t)];
+ ber_len_t xlen;
assert( ber != NULL );
assert( BER_VALID( ber ) );
lenlen = (unsigned char) ++i;
if ( lenlen > 4 )
return( -1 );
+
lenlen |= 0x80UL;
/* write the length of the length */
if ( ber_write( ber, &lenlen, 1, nosos ) != 1 )
return( -1 );
+ for( j=0; j<i; j++) {
+ netlen[(sizeof(ber_len_t)-1) - j] = len & 0xffU;
+ len >>= 8;
+ }
+
/* write the length itself */
- netlen = LBER_LEN_HTON( len );
- if ( ber_write( ber, (char *) &netlen + (sizeof(ber_len_t) - i), i, nosos )
- != i )
- return( -1 );
+ rc = ber_write( ber,
+ &netlen[sizeof(ber_len_t)-i],
+ i, nosos );
- return( i + 1 );
+ return rc == i ? i+1 : -1;
}
static int
ber_int_t num,
ber_tag_t tag )
{
- int i, sign;
+ int rc;
+ int i, j, sign;
ber_len_t len, lenlen, taglen;
- ber_uint_t unum, netnum, mask;
+ ber_uint_t unum, xnum, mask;
+ unsigned char netnum[sizeof(ber_uint_t)];
assert( ber != NULL );
assert( BER_VALID( ber ) );
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 )
return( -1 );
i++;
- netnum = LBER_INT_HTON( unum );
- if ( ber_write( ber, (char *) &netnum + (sizeof(ber_int_t) - i), i, 0 )
- != i )
- return( -1 );
+
+ for( j=0; j<i; j++ ) {
+ netnum[(sizeof(ber_int_t)-1) - j] = unum & 0xffU;
+ unum >>= 8;
+ }
+
+ rc = ber_write( ber,
+ &netnum[sizeof(ber_int_t) - i],
+ i, 0 );
/* length of tag + length + contents */
- return( taglen + lenlen + i );
+ return rc == i ? taglen + lenlen + i : -1;
}
int
static int
ber_put_seqorset( BerElement *ber )
{
- ber_len_t len, netlen;
+ int rc, i;
+ ber_len_t len;
+ unsigned char netlen[sizeof(ber_len_t)];
ber_len_t taglen, lenlen;
unsigned char ltag = 0x80U + FOUR_BYTE_LEN - 1;
Seqorset *next;
*/
len = (*sos)->sos_clen;
- netlen = LBER_LEN_HTON( len );
+
if ( sizeof(ber_len_t) > 4 && len > 0xffffffffUL )
return( -1 );
if ( ber->ber_options & LBER_USE_DER ) {
lenlen = ber_calc_lenlen( len );
+
} else {
lenlen = FOUR_BYTE_LEN;
}
+ if( lenlen > 1 ) {
+ for( i=0; i < lenlen-1; i++ ) {
+ netlen[(sizeof(ber_len_t)-1) - i] = (len >> i*8) & 0xffU;
+ }
+ } else {
+ netlen[sizeof(ber_len_t)-1] = len & 0x7fU;
+ }
+
if ( (next = (*sos)->sos_next) == NULL ) {
/* write the tag */
if ( (taglen = ber_put_tag( ber, (*sos)->sos_tag, 1 )) == -1 )
return( -1 );
/* the length itself */
- if ( ber_write( ber, (char *) (&netlen + 1)
- - (FOUR_BYTE_LEN - 1), FOUR_BYTE_LEN - 1, 1 )
- != FOUR_BYTE_LEN - 1 )
+ rc = ber_write( ber,
+ &netlen[sizeof(ber_len_t) - (FOUR_BYTE_LEN-1)],
+ FOUR_BYTE_LEN-1, 1 );
+
+ if( rc != FOUR_BYTE_LEN - 1 ) {
return( -1 );
+ }
}
/* The ber_ptr is at the set/seq start - move it to the end */
(*sos)->sos_ber->ber_ptr += len;
+
} else {
- ber_tag_t ntag;
+ int i;
+ unsigned char nettag[sizeof(ber_tag_t)];
+ ber_tag_t tmptag = (*sos)->sos_tag;
/* the tag */
- taglen = ber_calc_taglen( (*sos)->sos_tag );
- ntag = LBER_TAG_HTON( (*sos)->sos_tag );
- SAFEMEMCPY( (*sos)->sos_first, (char *) &ntag +
- sizeof(ber_tag_t) - taglen, taglen );
+ taglen = ber_calc_taglen( tmptag );
+
+ for( i = 0; i < taglen; i++ ) {
+ nettag[(sizeof(ber_tag_t)-1) - i] = tmptag & 0xffU;
+ tmptag >>= 8;
+ }
+
+ SAFEMEMCPY( (*sos)->sos_first,
+ &nettag[sizeof(ber_tag_t) - taglen],
+ taglen );
if ( ber->ber_options & LBER_USE_DER ) {
ltag = (lenlen == 1)
if (lenlen > 1) {
/* Write the length itself */
SAFEMEMCPY( (*sos)->sos_first + 2,
- (char *)&netlen + sizeof(ber_len_t) -
- (lenlen - 1),
- lenlen - 1 );
+ &netlen[sizeof(ber_len_t) - (lenlen - 1)],
+ lenlen - 1 );
}
if (lenlen != FOUR_BYTE_LEN) {
/*
} else {
/* the length itself */
SAFEMEMCPY( (*sos)->sos_first + taglen + 1,
- (char *) &netlen + sizeof(ber_len_t) -
- (FOUR_BYTE_LEN - 1), FOUR_BYTE_LEN - 1 );
+ &netlen[sizeof(ber_len_t) - (FOUR_BYTE_LEN - 1)],
+ FOUR_BYTE_LEN - 1 );
}
next->sos_clen += (taglen + lenlen + len);