2010-06-08 Jeff Johnston <jjohnstn@redhat.com>

* configure.in: Add test for enable-newlib-register-fini
        to set the _WANT_REGISTER_FINI flag.
        * configure: Regenerated.
        * Makefile.in: Ditto.
        * newlib.hin: Add _WANT_REGISTER_FINI flag.
        * libc/stdlib/__call_atexit.c: Add test for
        _WANT_REGISTER_FINI to enable the register_fini function.
This commit is contained in:
Jeff Johnston 2010-06-08 18:44:14 +00:00
parent b7d3e6d7d2
commit 58d6976a6e
5 changed files with 54 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2010-06-08 Jeff Johnston <jjohnstn@redhat.com>
* configure.in: Add test for enable-newlib-register-fini
to set the _WANT_REGISTER_FINI flag.
* configure: Regenerated.
* Makefile.in: Ditto.
* newlib.hin: Add _WANT_REGISTER_FINI flag.
* libc/stdlib/__call_atexit.c: Add test for
_WANT_REGISTER_FINI to enable the register_fini function.
2010-06-04 Mark Mitchell <mark@codesourcery.com> 2010-06-04 Mark Mitchell <mark@codesourcery.com>
* libc/stdlib/__call_atexit.c (__libc_fini): Declare. * libc/stdlib/__call_atexit.c (__libc_fini): Declare.

26
newlib/configure vendored
View File

@ -822,6 +822,7 @@ ac_user_opts='
enable_option_checking enable_option_checking
enable_newlib_io_pos_args enable_newlib_io_pos_args
enable_newlib_io_c99_formats enable_newlib_io_c99_formats
enable_newlib_register_fini
enable_newlib_io_long_long enable_newlib_io_long_long
enable_newlib_io_long_double enable_newlib_io_long_double
enable_newlib_mb enable_newlib_mb
@ -1495,6 +1496,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-newlib-io-pos-args enable printf-family positional arg support --enable-newlib-io-pos-args enable printf-family positional arg support
--enable-newlib-io-c99-formats enable C99 support in IO functions like printf/scanf --enable-newlib-io-c99-formats enable C99 support in IO functions like printf/scanf
--enable-newlib-register-fini enable finalization function registration using atexit
--enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf --enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf
--enable-newlib-io-long-double enable long double type support in IO functions printf/scanf --enable-newlib-io-long-double enable long double type support in IO functions printf/scanf
--enable-newlib-mb enable multibyte support --enable-newlib-mb enable multibyte support
@ -2051,6 +2053,19 @@ else
newlib_io_c99_formats= newlib_io_c99_formats=
fi fi
# Check whether --enable-newlib-register-fini was given.
if test "${enable_newlib_register_fini+set}" = set; then
enableval=$enable_newlib_register_fini; case "${enableval}" in
yes) newlib_register_fini=yes;;
no) newlib_register_fini=no ;;
*) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-register-fini option" >&5
$as_echo "$as_me: error: bad value ${enableval} for newlib-register-fini option" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
newlib_register_fini=
fi
# Check whether --enable-newlib-io-long-long was given. # Check whether --enable-newlib-io-long-long was given.
if test "${enable_newlib_io_long_long+set}" = set; then if test "${enable_newlib_io_long_long+set}" = set; then
enableval=$enable_newlib_io_long_long; case "${enableval}" in enableval=$enable_newlib_io_long_long; case "${enableval}" in
@ -12590,7 +12605,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 12593 "configure" #line 12608 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -12696,7 +12711,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 12699 "configure" #line 12714 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
@ -13083,6 +13098,13 @@ _ACEOF
fi fi
if test "${newlib_register_fini}" = "yes"; then
cat >>confdefs.h <<_ACEOF
#define _WANT_REGISTER_FINI 1
_ACEOF
fi
if test "${newlib_io_long_long}" = "yes"; then if test "${newlib_io_long_long}" = "yes"; then
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define _WANT_IO_LONG_LONG 1 #define _WANT_IO_LONG_LONG 1

View File

@ -29,6 +29,15 @@ AC_ARG_ENABLE(newlib-io-c99-formats,
*) AC_MSG_ERROR(bad value ${enableval} for newlib-io-c99-formats option) ;; *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-c99-formats option) ;;
esac], [newlib_io_c99_formats=])dnl esac], [newlib_io_c99_formats=])dnl
dnl Support --enable-newlib-register-fini
AC_ARG_ENABLE(newlib-register-fini,
[ --enable-newlib-register-fini enable finalization function registration using atexit],
[case "${enableval}" in
yes) newlib_register_fini=yes;;
no) newlib_register_fini=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-register-fini option) ;;
esac], [newlib_register_fini=])dnl
dnl Support --enable-newlib-io-long-long dnl Support --enable-newlib-io-long-long
AC_ARG_ENABLE(newlib-io-long-long, AC_ARG_ENABLE(newlib-io-long-long,
[ --enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf], [ --enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf],
@ -244,6 +253,10 @@ if test "${newlib_io_c99_formats}" = "yes"; then
AC_DEFINE_UNQUOTED(_WANT_IO_C99_FORMATS) AC_DEFINE_UNQUOTED(_WANT_IO_C99_FORMATS)
fi fi
if test "${newlib_register_fini}" = "yes"; then
AC_DEFINE_UNQUOTED(_WANT_REGISTER_FINI)
fi
if test "${newlib_io_long_long}" = "yes"; then if test "${newlib_io_long_long}" = "yes"; then
AC_DEFINE_UNQUOTED(_WANT_IO_LONG_LONG) AC_DEFINE_UNQUOTED(_WANT_IO_LONG_LONG)
fi fi

View File

@ -15,6 +15,8 @@ void free(void *) _ATTRIBUTE((__weak__));
extern _LOCK_RECURSIVE_T __atexit_lock; extern _LOCK_RECURSIVE_T __atexit_lock;
#endif #endif
#ifdef _WANT_REGISTER_FINI
/* If "__libc_fini" is defined, finalizers (either /* If "__libc_fini" is defined, finalizers (either
"__libc_fini_array", or "_fini", as appropriate) will be run after "__libc_fini_array", or "_fini", as appropriate) will be run after
all user-specified atexit handlers. For example, you can define all user-specified atexit handlers. For example, you can define
@ -51,6 +53,8 @@ register_fini(void)
} }
} }
#endif /* _WANT_REGISTER_FINI */
/* /*
* Call registered exit handlers. If D is null then all handlers are called, * Call registered exit handlers. If D is null then all handlers are called,
* otherwise only the handlers from that DSO are called. * otherwise only the handlers from that DSO are called.

View File

@ -19,6 +19,9 @@
/* long long type support in IO functions like printf/scanf enabled */ /* long long type support in IO functions like printf/scanf enabled */
#undef _WANT_IO_LONG_LONG #undef _WANT_IO_LONG_LONG
/* Register application finalization function using atexit. */
#undef _WANT_REGISTER_FINI
/* long double type support in IO functions like printf/scanf enabled */ /* long double type support in IO functions like printf/scanf enabled */
#undef _WANT_IO_LONG_DOUBLE #undef _WANT_IO_LONG_DOUBLE