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>
This commit is contained in:
Theodore Ts'o 2008-06-07 08:55:21 -04:00
parent 9aa109c95d
commit 488c75a6a6
3 changed files with 47 additions and 6 deletions

32
configure vendored
View File

@ -779,7 +779,8 @@ MAKEFILE_BSDLIB
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 @@ esac
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 @@ STATIC_LIB_EXT!$STATIC_LIB_EXT$ac_delim
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 @@ d
r $ASM_TYPES_HEADER
d
}
/^[ ]*@PUBLIC_CONFIG_HEADER@[ ]*$/{
r $PUBLIC_CONFIG_HEADER
d
}
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
@ -16153,6 +16170,9 @@ _ACEOF
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 @@ LIBOBJS!$LIBOBJS$ac_delim
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

View File

@ -700,6 +700,25 @@ BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
ASM_TYPES_HEADER=./asm_types.h
AC_SUBST_FILE(ASM_TYPES_HEADER)
dnl
dnl Save the configuration #defines needed for the public ext2fs.h
dnl header file
dnl
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
AC_SUBST_FILE(PUBLIC_CONFIG_HEADER)
dnl
dnl See if we have inttypes.h and if intptr_t is defined
dnl
AC_CHECK_HEADERS([inttypes.h])

View File

@ -132,3 +132,5 @@ typedef signed long long __s64;
#undef __U64_TYPEDEF
#endif /* _*_TYPES_H */
@PUBLIC_CONFIG_HEADER@