Add portability enhancements for Cygwin32 environment.
diff --git a/configure b/configure
index e22c3b8..9ebc5a1 100644
--- a/configure
+++ b/configure
@@ -4168,7 +4168,7 @@
done
fi
-for ac_hdr in stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h net/if.h netinet/in.h
+for ac_hdr in stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if.h netinet/in.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -4313,20 +4313,84 @@
fi
-echo $ac_n "checking whether llseek declared in unistd.h""... $ac_c" 1>&6
-echo "configure:4318: checking whether llseek declared in unistd.h" >&5
-if eval "test \"`echo '$''{'e2fsprogs_cv_have_llseek_prototype'+set}'`\" = set"; then
+echo $ac_n "checking whether d_reclen declared in dirent""... $ac_c" 1>&6
+echo "configure:4318: checking whether d_reclen declared in dirent" >&5
+if eval "test \"`echo '$''{'e2fsprogs_cv_have_d_reclen_dirent'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4323 "configure"
#include "confdefs.h"
+#include <dirent.h>
+int main() {
+struct dirent de; de.d_reclen = 0;
+; return 0; }
+EOF
+if { (eval echo configure:4330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ e2fsprogs_cv_have_d_reclen_dirent=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ e2fsprogs_cv_have_d_reclen_dirent=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$e2fsprogs_cv_have_d_reclen_dirent" 1>&6
+if test "$e2fsprogs_cv_have_d_reclen_dirent" = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_RECLEN_DIRENT 1
+EOF
+
+fi
+echo $ac_n "checking whether ssize_t declared""... $ac_c" 1>&6
+echo "configure:4350: checking whether ssize_t declared" >&5
+if eval "test \"`echo '$''{'e2fsprogs_cv_have_ssize_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4355 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+int main() {
+ssize_t a = 0;
+; return 0; }
+EOF
+if { (eval echo configure:4362: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ e2fsprogs_cv_have_ssize_t=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ e2fsprogs_cv_have_ssize_t=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$e2fsprogs_cv_have_ssize_t" 1>&6
+if test "$e2fsprogs_cv_have_ssize_t" = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_TYPE_SSIZE_T 1
+EOF
+
+fi
+echo $ac_n "checking whether llseek declared in unistd.h""... $ac_c" 1>&6
+echo "configure:4382: checking whether llseek declared in unistd.h" >&5
+if eval "test \"`echo '$''{'e2fsprogs_cv_have_llseek_prototype'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4387 "configure"
+#include "confdefs.h"
#include <unistd.h>
int main() {
extern int llseek(int);
; return 0; }
EOF
-if { (eval echo configure:4330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
e2fsprogs_cv_have_llseek_prototype=no
else
@@ -4346,12 +4410,12 @@
fi
echo $ac_n "checking whether lseek64 declared in unistd.h""... $ac_c" 1>&6
-echo "configure:4350: checking whether lseek64 declared in unistd.h" >&5
+echo "configure:4414: checking whether lseek64 declared in unistd.h" >&5
if eval "test \"`echo '$''{'e2fsprogs_cv_have_lseek64_prototype'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4355 "configure"
+#line 4419 "configure"
#include "confdefs.h"
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
@@ -4360,7 +4424,7 @@
extern int lseek64(int);
; return 0; }
EOF
-if { (eval echo configure:4364: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4428: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
e2fsprogs_cv_have_lseek64_prototype=no
else
@@ -4388,7 +4452,7 @@
echo "configure: warning: Cross-compiling, so cannot check type sizes; assuming short=2, int=4, long=4, long long=8" 1>&2
fi
echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:4392: checking size of short" >&5
+echo "configure:4456: checking size of short" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4396,7 +4460,7 @@
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4400 "configure"
+#line 4464 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
@@ -4408,7 +4472,7 @@
exit(0);
}
EOF
-if { (eval echo configure:4412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_short=`cat conftestval`
else
@@ -4428,7 +4492,7 @@
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:4432: checking size of int" >&5
+echo "configure:4496: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4436,7 +4500,7 @@
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4440 "configure"
+#line 4504 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
@@ -4448,7 +4512,7 @@
exit(0);
}
EOF
-if { (eval echo configure:4452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
@@ -4468,7 +4532,7 @@
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:4472: checking size of long" >&5
+echo "configure:4536: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4476,7 +4540,7 @@
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4480 "configure"
+#line 4544 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
@@ -4488,7 +4552,7 @@
exit(0);
}
EOF
-if { (eval echo configure:4492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
@@ -4508,7 +4572,7 @@
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:4512: checking size of long long" >&5
+echo "configure:4576: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4516,7 +4580,7 @@
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4520 "configure"
+#line 4584 "configure"
#include "confdefs.h"
#include <stdio.h>
#include <sys/types.h>
@@ -4528,7 +4592,7 @@
exit(0);
}
EOF
-if { (eval echo configure:4532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@@ -4556,14 +4620,14 @@
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:4560: checking whether byte ordering is bigendian" >&5
+echo "configure:4624: 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 4567 "configure"
+#line 4631 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -4574,11 +4638,11 @@
#endif
; return 0; }
EOF
-if { (eval echo configure:4578: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4642: \"$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 4582 "configure"
+#line 4646 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -4589,7 +4653,7 @@
#endif
; return 0; }
EOF
-if { (eval echo configure:4593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4657: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -4609,7 +4673,7 @@
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 4613 "configure"
+#line 4677 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -4622,7 +4686,7 @@
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:4626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4690: \"$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
@@ -4646,19 +4710,19 @@
fi
echo $ac_n "checking whether struct stat has a st_flags field""... $ac_c" 1>&6
-echo "configure:4650: checking whether struct stat has a st_flags field" >&5
+echo "configure:4714: checking whether struct stat has a st_flags field" >&5
if eval "test \"`echo '$''{'e2fsprogs_cv_struct_st_flags'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4655 "configure"
+#line 4719 "configure"
#include "confdefs.h"
#include <sys/stat.h>
int main() {
struct stat stat; stat.st_flags = 0;
; return 0; }
EOF
-if { (eval echo configure:4662: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
e2fsprogs_cv_struct_st_flags=yes
else
@@ -4673,19 +4737,19 @@
echo "$ac_t""$e2fsprogs_cv_struct_st_flags" 1>&6
if test "$e2fsprogs_cv_struct_st_flags" = yes; then
echo $ac_n "checking whether st_flags field is useful""... $ac_c" 1>&6
-echo "configure:4677: checking whether st_flags field is useful" >&5
+echo "configure:4741: checking whether st_flags field is useful" >&5
if eval "test \"`echo '$''{'e2fsprogs_cv_struct_st_flags_immut'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4682 "configure"
+#line 4746 "configure"
#include "confdefs.h"
#include <sys/stat.h>
int main() {
struct stat stat; stat.st_flags |= UF_IMMUTABLE;
; return 0; }
EOF
-if { (eval echo configure:4689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
e2fsprogs_cv_struct_st_flags_immut=yes
else
@@ -4708,12 +4772,12 @@
for ac_func in chflags getrusage llseek lseek64 open64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen sysconf pathconf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4712: checking for $ac_func" >&5
+echo "configure:4776: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4717 "configure"
+#line 4781 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4736,7 +4800,7 @@
; return 0; }
EOF
-if { (eval echo configure:4740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4804: \"$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
@@ -4762,7 +4826,7 @@
SOCKET_LIB=''
echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:4766: checking for socket in -lsocket" >&5
+echo "configure:4830: checking for socket in -lsocket" >&5
ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4770,7 +4834,7 @@
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4774 "configure"
+#line 4838 "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
@@ -4781,7 +4845,7 @@
socket()
; return 0; }
EOF
-if { (eval echo configure:4785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4849: \"$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
@@ -4804,7 +4868,7 @@
DLOPEN_LIB=''
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4808: checking for dlopen in -ldl" >&5
+echo "configure:4872: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4812,7 +4876,7 @@
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4816 "configure"
+#line 4880 "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
@@ -4823,7 +4887,7 @@
dlopen()
; return 0; }
EOF
-if { (eval echo configure:4827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4891: \"$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
@@ -4849,12 +4913,12 @@
echo $ac_n "checking for optreset""... $ac_c" 1>&6
-echo "configure:4853: checking for optreset" >&5
+echo "configure:4917: checking for optreset" >&5
if eval "test \"`echo '$''{'ac_cv_have_optreset'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4858 "configure"
+#line 4922 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -4885,12 +4949,24 @@
;;
esac
LINUX_CMT="#"
+CYGWIN_CMT="#"
+UNIX_CMT=
case "$host_os" in
linux*)
LINUX_CMT=
;;
+cygwin)
+ CYGWIN_CMT=
+ UNIX_CMT="#"
+ cat >> confdefs.h <<\EOF
+#define WIN32 1
+EOF
+
+ ;;
esac
+
+
case "$host_os" in
linux* | gnu*)
if test "$prefix" = NONE -a "$root_prefix" = NONE ; then
@@ -4933,20 +5009,20 @@
echo $ac_n "checking whether linker accepts -static""... $ac_c" 1>&6
-echo "configure:4937: checking whether linker accepts -static" >&5
+echo "configure:5013: checking whether linker accepts -static" >&5
if eval "test \"`echo '$''{'ac_cv_e2fsprogs_use_static'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
SAVE_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -static"
cat > conftest.$ac_ext <<EOF
-#line 4943 "configure"
+#line 5019 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
fflush(stdout);
; return 0; }
EOF
-if { (eval echo configure:4950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_e2fsprogs_use_static=yes
else
@@ -5241,6 +5317,8 @@
s%@SOCKET_LIB@%$SOCKET_LIB%g
s%@DLOPEN_LIB@%$DLOPEN_LIB%g
s%@LINUX_CMT@%$LINUX_CMT%g
+s%@CYGWIN_CMT@%$CYGWIN_CMT%g
+s%@UNIX_CMT@%$UNIX_CMT%g
s%@root_prefix@%$root_prefix%g
s%@root_bindir@%$root_bindir%g
s%@root_sbindir@%$root_sbindir%g