Fix ext2fs_swap{16,32,64} for external applications on big-endian machines

The public header files depend on the the autoconf defines
WORDS_BIGENDIAN and HAVE_SYS_TYPES_H, so we add them to ext2_types.h
so that external programs which try to use ext2fs_swap*() will work
correctly on big-endian systems.  Fortunately, few if any programs
need to use this libext2's byte-swap functions directly.

Addresses-Debian-Bug: #484879

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/configure b/configure
index 635a94f..bdef3cc 100755
--- a/configure
+++ b/configure
@@ -779,7 +779,8 @@
 MAKEFILE_PROFILE
 MAKEFILE_CHECKER
 MAKEFILE_LIBRARY
-ASM_TYPES_HEADER'
+ASM_TYPES_HEADER
+PUBLIC_CONFIG_HEADER'
       ac_precious_vars='build_alias
 host_alias
 target_alias
@@ -14443,6 +14444,21 @@
 BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
 ASM_TYPES_HEADER=./asm_types.h
 
+echo "/* These defines are needed for the public ext2fs.h header file */" \
+     > public_config.h
+if grep HAVE_SYS_TYPES_H confdefs.h > tmp_config.$$; then
+  uniq tmp_config.$$ >> public_config.h
+else
+  echo "#undef HAVE_SYS_TYPES_H" >> public_config.h
+fi
+if grep WORDS_BIGENDIAN confdefs.h > tmp_config.$$; then
+  uniq tmp_config.$$ >> public_config.h
+else
+  echo "#undef WORDS_BIGENDIAN" >> public_config.h
+fi
+rm -f tmp_config.$$
+PUBLIC_CONFIG_HEADER=./public_config.h
+
 
 for ac_header in inttypes.h
 do
@@ -16081,12 +16097,9 @@
 PROFILED_LIB_EXT!$PROFILED_LIB_EXT$ac_delim
 SWAPFS_CMT!$SWAPFS_CMT$ac_delim
 DEBUGFS_CMT!$DEBUGFS_CMT$ac_delim
-IMAGER_CMT!$IMAGER_CMT$ac_delim
-RESIZER_CMT!$RESIZER_CMT$ac_delim
-FSCK_PROG!$FSCK_PROG$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -16134,6 +16147,10 @@
 r $ASM_TYPES_HEADER
 d
 }
+/^[	 ]*@PUBLIC_CONFIG_HEADER@[	 ]*$/{
+r $PUBLIC_CONFIG_HEADER
+d
+}
 _ACEOF
 sed '
 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
@@ -16153,6 +16170,9 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+IMAGER_CMT!$IMAGER_CMT$ac_delim
+RESIZER_CMT!$RESIZER_CMT$ac_delim
+FSCK_PROG!$FSCK_PROG$ac_delim
 FSCK_MAN!$FSCK_MAN$ac_delim
 E2INITRD_PROG!$E2INITRD_PROG$ac_delim
 E2INITRD_MAN!$E2INITRD_MAN$ac_delim
@@ -16239,7 +16259,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 84; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 87; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5