Changeset 10848 for trunk/mgpp


Ignore:
Timestamp:
2005-11-07T13:13:45+13:00 (18 years ago)
Author:
kjdon
Message:

changed to use WORDS_BIGENDIAN instead of _LITTLE_ENDIAN to test for endianness

Location:
trunk/mgpp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/mgpp/config.h.in

    r7945 r10848  
    204204#undef ENABLE_NLS
    205205
     206/* Define if big endian */
     207#undef WORDS_BIGENDIAN
     208
    206209#endif /* _MGPP_CONFIG_H */
  • trunk/mgpp/configure

    r10192 r10848  
    310310#endif"
    311311
    312 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT AWK YACC CC CFLAGS ac_ct_CC INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP U ANSI2KNR ALLOCA LIBOBJS JNIINC JNISUFFIX JNIFLAGS LIBOBJS LTLIBOBJS'
     312ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PACKAGE VERSION CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT AWK YACC CC CFLAGS ac_ct_CC INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP U ANSI2KNR ALLOCA LIBOBJS JNIINC JNISUFFIX JNIFLAGS LTLIBOBJS'
    313313ac_subst_files=''
    314314
     
    64276427_ACEOF
    64286428
    6429   LIBOBJS="$LIBOBJS regex.o"
     6429  case $LIBOBJS in
     6430    "regex.$ac_objext"   | \
     6431  *" regex.$ac_objext"   | \
     6432    "regex.$ac_objext "* | \
     6433  *" regex.$ac_objext "* ) ;;
     6434  *) LIBOBJS="$LIBOBJS regex.$ac_objext" ;;
     6435esac
     6436
    64306437fi
    64316438fi;
     
    69486955        find a local rx library and the one included with this
    69496956        distribution doesn't work on 64-bit machines like yours" >&2;}
    6950       LIBOBJS="$LIBOBJS regex.o"
     6957      case $LIBOBJS in
     6958    "regex.$ac_objext"   | \
     6959  *" regex.$ac_objext"   | \
     6960    "regex.$ac_objext "* | \
     6961  *" regex.$ac_objext "* ) ;;
     6962  *) LIBOBJS="$LIBOBJS regex.$ac_objext" ;;
     6963esac
     6964
    69516965    else
    6952       LIBOBJS="$LIBOBJS rx.o"
     6966      case $LIBOBJS in
     6967    "rx.$ac_objext"   | \
     6968  *" rx.$ac_objext"   | \
     6969    "rx.$ac_objext "* | \
     6970  *" rx.$ac_objext "* ) ;;
     6971  *) LIBOBJS="$LIBOBJS rx.$ac_objext" ;;
     6972esac
     6973
    69536974    fi
    69546975
     
    72727293
    72737294
     7295# text for endianness
     7296echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
     7297echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
     7298if test "${ac_cv_c_bigendian+set}" = set; then
     7299  echo $ECHO_N "(cached) $ECHO_C" >&6
     7300else
     7301  # See if sys/param.h defines the BYTE_ORDER macro.
     7302cat >conftest.$ac_ext <<_ACEOF
     7303/* confdefs.h.  */
     7304_ACEOF
     7305cat confdefs.h >>conftest.$ac_ext
     7306cat >>conftest.$ac_ext <<_ACEOF
     7307/* end confdefs.h.  */
     7308#include <sys/types.h>
     7309#include <sys/param.h>
     7310
     7311int
     7312main ()
     7313{
     7314#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
     7315 bogus endian macros
     7316#endif
     7317
     7318  ;
     7319  return 0;
     7320}
     7321_ACEOF
     7322rm -f conftest.$ac_objext
     7323if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
     7324  (eval $ac_compile) 2>conftest.er1
     7325  ac_status=$?
     7326  grep -v '^ *+' conftest.er1 >conftest.err
     7327  rm -f conftest.er1
     7328  cat conftest.err >&5
     7329  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7330  (exit $ac_status); } &&
     7331     { ac_try='test -z "$ac_c_werror_flag"
     7332             || test ! -s conftest.err'
     7333  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     7334  (eval $ac_try) 2>&5
     7335  ac_status=$?
     7336  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7337  (exit $ac_status); }; } &&
     7338     { ac_try='test -s conftest.$ac_objext'
     7339  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     7340  (eval $ac_try) 2>&5
     7341  ac_status=$?
     7342  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7343  (exit $ac_status); }; }; then
     7344  # It does; now see whether it defined to BIG_ENDIAN or not.
     7345cat >conftest.$ac_ext <<_ACEOF
     7346/* confdefs.h.  */
     7347_ACEOF
     7348cat confdefs.h >>conftest.$ac_ext
     7349cat >>conftest.$ac_ext <<_ACEOF
     7350/* end confdefs.h.  */
     7351#include <sys/types.h>
     7352#include <sys/param.h>
     7353
     7354int
     7355main ()
     7356{
     7357#if BYTE_ORDER != BIG_ENDIAN
     7358 not big endian
     7359#endif
     7360
     7361  ;
     7362  return 0;
     7363}
     7364_ACEOF
     7365rm -f conftest.$ac_objext
     7366if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
     7367  (eval $ac_compile) 2>conftest.er1
     7368  ac_status=$?
     7369  grep -v '^ *+' conftest.er1 >conftest.err
     7370  rm -f conftest.er1
     7371  cat conftest.err >&5
     7372  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7373  (exit $ac_status); } &&
     7374     { ac_try='test -z "$ac_c_werror_flag"
     7375             || test ! -s conftest.err'
     7376  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     7377  (eval $ac_try) 2>&5
     7378  ac_status=$?
     7379  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7380  (exit $ac_status); }; } &&
     7381     { ac_try='test -s conftest.$ac_objext'
     7382  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     7383  (eval $ac_try) 2>&5
     7384  ac_status=$?
     7385  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7386  (exit $ac_status); }; }; then
     7387  ac_cv_c_bigendian=yes
     7388else
     7389  echo "$as_me: failed program was:" >&5
     7390sed 's/^/| /' conftest.$ac_ext >&5
     7391
     7392ac_cv_c_bigendian=no
     7393fi
     7394rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
     7395else
     7396  echo "$as_me: failed program was:" >&5
     7397sed 's/^/| /' conftest.$ac_ext >&5
     7398
     7399# It does not; compile a test program.
     7400if test "$cross_compiling" = yes; then
     7401  # try to guess the endianness by grepping values into an object file
     7402  ac_cv_c_bigendian=unknown
     7403  cat >conftest.$ac_ext <<_ACEOF
     7404/* confdefs.h.  */
     7405_ACEOF
     7406cat confdefs.h >>conftest.$ac_ext
     7407cat >>conftest.$ac_ext <<_ACEOF
     7408/* end confdefs.h.  */
     7409short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
     7410short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
     7411void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
     7412short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
     7413short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
     7414void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
     7415int
     7416main ()
     7417{
     7418 _ascii (); _ebcdic ();
     7419  ;
     7420  return 0;
     7421}
     7422_ACEOF
     7423rm -f conftest.$ac_objext
     7424if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
     7425  (eval $ac_compile) 2>conftest.er1
     7426  ac_status=$?
     7427  grep -v '^ *+' conftest.er1 >conftest.err
     7428  rm -f conftest.er1
     7429  cat conftest.err >&5
     7430  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7431  (exit $ac_status); } &&
     7432     { ac_try='test -z "$ac_c_werror_flag"
     7433             || test ! -s conftest.err'
     7434  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     7435  (eval $ac_try) 2>&5
     7436  ac_status=$?
     7437  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7438  (exit $ac_status); }; } &&
     7439     { ac_try='test -s conftest.$ac_objext'
     7440  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     7441  (eval $ac_try) 2>&5
     7442  ac_status=$?
     7443  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7444  (exit $ac_status); }; }; then
     7445  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
     7446  ac_cv_c_bigendian=yes
     7447fi
     7448if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
     7449  if test "$ac_cv_c_bigendian" = unknown; then
     7450    ac_cv_c_bigendian=no
     7451  else
     7452    # finding both strings is unlikely to happen, but who knows?
     7453    ac_cv_c_bigendian=unknown
     7454  fi
     7455fi
     7456else
     7457  echo "$as_me: failed program was:" >&5
     7458sed 's/^/| /' conftest.$ac_ext >&5
     7459
     7460fi
     7461rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
     7462else
     7463  cat >conftest.$ac_ext <<_ACEOF
     7464/* confdefs.h.  */
     7465_ACEOF
     7466cat confdefs.h >>conftest.$ac_ext
     7467cat >>conftest.$ac_ext <<_ACEOF
     7468/* end confdefs.h.  */
     7469int
     7470main ()
     7471{
     7472  /* Are we little or big endian?  From Harbison&Steele.  */
     7473  union
     7474  {
     7475    long l;
     7476    char c[sizeof (long)];
     7477  } u;
     7478  u.l = 1;
     7479  exit (u.c[sizeof (long) - 1] == 1);
     7480}
     7481_ACEOF
     7482rm -f conftest$ac_exeext
     7483if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
     7484  (eval $ac_link) 2>&5
     7485  ac_status=$?
     7486  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7487  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
     7488  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
     7489  (eval $ac_try) 2>&5
     7490  ac_status=$?
     7491  echo "$as_me:$LINENO: \$? = $ac_status" >&5
     7492  (exit $ac_status); }; }; then
     7493  ac_cv_c_bigendian=no
     7494else
     7495  echo "$as_me: program exited with status $ac_status" >&5
     7496echo "$as_me: failed program was:" >&5
     7497sed 's/^/| /' conftest.$ac_ext >&5
     7498
     7499( exit $ac_status )
     7500ac_cv_c_bigendian=yes
     7501fi
     7502rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
     7503fi
     7504fi
     7505rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
     7506fi
     7507echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
     7508echo "${ECHO_T}$ac_cv_c_bigendian" >&6
     7509case $ac_cv_c_bigendian in
     7510  yes)
     7511
     7512cat >>confdefs.h <<\_ACEOF
     7513#define WORDS_BIGENDIAN 1
     7514_ACEOF
     7515 ;;
     7516  no)
     7517     ;;
     7518  *)
     7519    { { echo "$as_me:$LINENO: error: unknown endianness
     7520presetting ac_cv_c_bigendian=no (or yes) will help" >&5
     7521echo "$as_me: error: unknown endianness
     7522presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
     7523   { (exit 1); exit 1; }; } ;;
     7524esac
     7525
     7526
    72747527# ---------------------------------------------------------------------------
    72757528if test "$ac_cv_func_alloca" = 'no'; then
     
    73037556
    73047557fi;
     7558
    73057559
    73067560# ---------------------------------------------------------------------------
     
    79588212s,@JNISUFFIX@,$JNISUFFIX,;t t
    79598213s,@JNIFLAGS@,$JNIFLAGS,;t t
    7960 s,@LIBOBJS@,$LIBOBJS,;t t
    79618214s,@LTLIBOBJS@,$LTLIBOBJS,;t t
    79628215CEOF
  • trunk/mgpp/configure.in

    r10192 r10848  
    117117fp_WITH_GNU_READLINE
    118118
     119# text for endianness
     120AC_C_BIGENDIAN
     121
    119122# ---------------------------------------------------------------------------
    120123if test "$ac_cv_func_alloca" = 'no'; then
     
    132135  AC_DEFINE(DISABLE_LONG_LONG))
    133136
     137
    134138# ---------------------------------------------------------------------------
    135139
  • trunk/mgpp/lib/netorder.h

    r3365 r10848  
    1111#endif
    1212
    13 #if defined (_BIG_ENDIAN) || (defined (BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN) || (defined (__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN)
    14 # ifndef _BIG_ENDIAN
    15 #  define _BIG_ENDIAN
    16 # endif
    17 #endif
    18 
    19 #if defined (_LITTLE_ENDIAN) || (defined (BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN) || (defined (__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN)
    20 # ifndef _LITTLE_ENDIAN
    21 #  define _LITTLE_ENDIAN
    22 # endif
    23 #endif
    24 
    25 #ifdef _LITTLE_ENDIAN
     13#ifndef WORDS_BIGENDIAN
    2614
    2715/* double */
     
    133121#define NTOHUS2(ns, hs)   ((hs) = ntohs((ns)))
    134122
    135 #else   /* _BIG_ENDIAN */
     123#else   /* WORDS_BIGENDIAN */
    136124
    137125/* double */
Note: See TracChangeset for help on using the changeset viewer.