Add --disable-tls configure option

Add option to forcibly disable the use of thread local storage

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Theodore Ts'o 2007-12-31 10:45:01 -05:00
parent 3306861158
commit 3249394d43
2 changed files with 119 additions and 78 deletions

173
configure vendored
View File

@ -1376,13 +1376,14 @@ Optional Features:
--enable-fsck build fsck wrapper program
--enable-e2initrd-helper build e2initrd-helper program
--enable-blkid-devmapper build with device-mapper support
--disable-tls disable use of thread local support
--disable-nls do not use Native Language Support
--disable-rpath do not hardcode runtime library paths
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-diet-libc Use diet libc
--with-diet-libc use diet libc
--with-cc=COMPILER select compiler to use
--with-linker=LINKER select linker to use
--with-ccopts=CCOPTS select compiler command line options
@ -4166,6 +4167,101 @@ fi
# Check whether --enable-tls was given.
if test "${enable_tls+set}" = set; then
enableval=$enable_tls; if test "$enableval" = "no"
then
try_tls=""
echo "Disabling thread local support"
else
try_tls="yes"
echo "Enabling thread local support"
fi
else
try_tls="yes"
echo "Try using thread local support by default"
fi
if test "$try_tls" = "yes"
then
{ echo "$as_me:$LINENO: checking for thread local storage (TLS) class" >&5
echo $ECHO_N "checking for thread local storage (TLS) class... $ECHO_C" >&6; }
if test "${ac_cv_tls+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ax_tls_keywords="__thread __declspec(thread) none"
for ax_tls_keyword in $ax_tls_keywords; do
case $ax_tls_keyword in
none) ac_cv_tls=none ; break ;;
*)
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
static void
foo(void) {
static $ax_tls_keyword int bar;
exit(1);
}
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_cv_tls=$ax_tls_keyword ; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_tls=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
esac
done
fi
if test "$ac_cv_tls" != "none"; then
cat >>confdefs.h <<_ACEOF
#define TLS $ac_cv_tls
_ACEOF
fi
{ echo "$as_me:$LINENO: result: $ac_cv_tls" >&5
echo "${ECHO_T}$ac_cv_tls" >&6; }
fi
MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
GETTEXT_PACKAGE=e2fsprogs
@ -11434,81 +11530,6 @@ done
fi
{ echo "$as_me:$LINENO: checking for thread local storage (TLS) class" >&5
echo $ECHO_N "checking for thread local storage (TLS) class... $ECHO_C" >&6; }
if test "${ac_cv_tls+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ax_tls_keywords="__thread __declspec(thread) none"
for ax_tls_keyword in $ax_tls_keywords; do
case $ax_tls_keyword in
none) ac_cv_tls=none ; break ;;
*)
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
static void
foo(void) {
static $ax_tls_keyword int bar;
exit(1);
}
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
ac_cv_tls=$ax_tls_keyword ; break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_tls=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
esac
done
fi
if test "$ac_cv_tls" != "none"; then
cat >>confdefs.h <<_ACEOF
#define TLS $ac_cv_tls
_ACEOF
fi
{ echo "$as_me:$LINENO: result: $ac_cv_tls" >&5
echo "${ECHO_T}$ac_cv_tls" >&6; }

View File

@ -67,7 +67,7 @@ dnl
dnl Use diet libc
dnl
AC_ARG_WITH([diet-libc],
[ --with-diet-libc Use diet libc],
[ --with-diet-libc use diet libc],
CC="diet cc -nostdinc"
AC_MSG_RESULT(CC=$CC))dnl
dnl
@ -527,6 +527,27 @@ AC_SUBST(STATIC_DEVMAPPER_LIBS)
dnl
dnl
dnl
AC_ARG_ENABLE([tls],
[ --disable-tls disable use of thread local support],
[if test "$enableval" = "no"
then
try_tls=""
echo "Disabling thread local support"
else
try_tls="yes"
echo "Enabling thread local support"
fi]
,
try_tls="yes"
echo "Try using thread local support by default"
)
if test "$try_tls" = "yes"
then
AX_TLS
fi
dnl
dnl
dnl
MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
AC_SUBST_FILE(MAKEFILE_LIBRARY)
dnl
@ -570,7 +591,6 @@ if test $cross_compiling = no; then
else
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
AX_TLS
AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h stdint.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/mman.h sys/mkdev.h sys/prctl.h sys/queue.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_dl.h netinet/in.h utime.h)
AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,,
[[