]> jfr.im git - irc/blitzed-org/bopm.git/commitdiff
configure.in:
authorandy <redacted>
Wed, 13 Feb 2002 23:52:47 +0000 (23:52 +0000)
committerandy <redacted>
Wed, 13 Feb 2002 23:52:47 +0000 (23:52 +0000)
Add a check for bigendian systems.
dnsbl.c:
If we're on a bigendian system this'll be backwards.

configure
configure.in
dnsbl.c
setup.h.in

index e92712aa59bd04caf5e852c546e27ebf58ed48a7..83d3fd9620df981df433445c530024ed442b313d 100755 (executable)
--- a/configure
+++ b/configure
@@ -1344,6 +1344,97 @@ fi
 done
 
 
+echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:1349: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 1356 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 1371 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_c_bigendian=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+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 1402 "configure"
+#include "confdefs.h"
+main () {
+  /* Are we little or big endian?  From Harbison&Steele.  */
+  union
+  {
+    long l;
+    char c[sizeof (long)];
+  } u;
+  u.l = 1;
+  exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_bigendian=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+  cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+
 trap '' 1 2 15
 cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
index 6008438babcea0445cad35df0b94fef5998bbe44..7ebc0a3eb7b5f2fd70c231b83f1036cb564b62ee 100644 (file)
@@ -23,4 +23,7 @@ AC_TYPE_SIGNAL
 AC_FUNC_STRFTIME
 AC_CHECK_FUNCS(select socket strdup strstr)
 
+dnl AIX fun
+AC_C_BIGENDIAN
+
 AC_OUTPUT(Makefile)
diff --git a/dnsbl.c b/dnsbl.c
index a8132a162e23068d8f347f59090e43bcd504f80d..a633abe06c49f6cede97eec7177b2fb0dba106de 100644 (file)
--- a/dnsbl.c
+++ b/dnsbl.c
@@ -73,8 +73,12 @@ int dnsbl_check(const char *addr, const char *irc_nick,
    buflen = 18 + strlen(CONF_DNSBL_ZONE);
    buf = malloc(buflen * sizeof(char));
 
+#ifdef WORDS_BIGENDIAN
+   snprintf(buf, buflen, "%d.%d.%d.%d.%s.", a, b, c, d, CONF_DNSBL_ZONE);
+#else
    snprintf(buf, buflen, "%d.%d.%d.%d.%s.", d, c, b, a, CONF_DNSBL_ZONE);
-  
+#endif
+
    if(OPT_DEBUG)
       log("DNSBL -> Checking %s", buf);
    
index adeff75e0cdde6ddc520c8becd62b4b7b4933aa6..ba9831176e3992e65cddd015d7f150fb1210d91d 100644 (file)
 /* Define if your <sys/time.h> declares struct tm.  */
 #undef TM_IN_SYS_TIME
 
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+#undef WORDS_BIGENDIAN
+
 /* Define if you have the select function.  */
 #undef HAVE_SELECT