diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 93 |
1 files changed, 57 insertions, 36 deletions
@@ -711,19 +711,61 @@ fi printf "Checking what C integer type can hold a pointer ... " +read_syms() +{ + print_into_config=${1-} + deferred_offset= + + while read symbol type offset size ; do + size=$(( 0$size + 0 )) + offset=$(( 0$offset + 0 )) + symbol=${symbol#_} + case "$type" in + C ) + size=$(( offset + 0 )) + ;; + S ) + if [ -n "$deferred_offset" ] ; then + size=$(( offset - deferred_offset )) + case "$deferred_sym" in + SIZEOF* ) + eval $(printf "%s=%d\n" "$deferred_sym" "$size") + if [ -n "$print_into_config" ] ; then + printf "#define %s %s\n" "$deferred_sym" "$size" >> config.h + fi + ;; + esac + fi + deferred_sym=$symbol + deferred_offset=$offset + continue + ;; + esac + case "$symbol" in + SIZEOF* ) + eval $(printf "%s=%d\n" "$symbol" "$size") + if [ -n "$print_into_config" ] ; then + printf "#define %s %s\n" "$symbol" "$size" >> config.h + fi + ;; + esac + done < conftest.syms +} + if [ -z "$intptr" ] ; then cat > conftest.c <<! #include "config.h" -char SIZEOF_PTR[sizeof (char *)]; -char SIZEOF_SHORT[sizeof (short)]; -char SIZEOF_INT[sizeof (int)]; -char SIZEOF_LONG[sizeof (long)]; -#ifdef HAVE_LONGLONG_T -char SIZEOF_LONGLONG_T[sizeof (longlong_t)]; -#endif #ifdef HAVE_SUPERLONG_T char SIZEOF_SUPERLONG_T[sizeof (superlong_t)]; #endif +#ifdef HAVE_LONGLONG_T +char SIZEOF_LONGLONG_T[sizeof (longlong_t)]; +#endif +char SIZEOF_PTR[sizeof (char *)]; +char SIZEOF_LONG[sizeof (long)]; +char SIZEOF_INT[sizeof (int)]; +char SIZEOF_SHORT[sizeof (short)]; +char DUMMY; ! rm -f conftest.o conftest.syms @@ -742,19 +784,7 @@ char SIZEOF_SUPERLONG_T[sizeof (superlong_t)]; SIZEOF_LONGLONG_T=0 SIZEOF_SUPERLONG_T=0 - while read symbol type offset size ; do - size=$(( 0$size + 0 )) - symbol=${symbol#_} - if [ "$type" = "C" ] ; then - size=$(( 0$offset + 0 )) - fi - case "$symbol" in - SIZEOF* ) - eval $(printf "%s=%d\n" "$symbol" "$size") - printf "#define %s %s\n" "$symbol" "$size" >> config.h - ;; - esac - done < conftest.syms + read_syms y rm -f conftest.syms conftest.o @@ -823,7 +853,8 @@ printf "Conservatively guessing the alignment of wide literals ... " if [ -z "$lit_align" ] ; then cat > conftest.c <<! #include <wchar.h> -char sizeof_wchar_t[sizeof (wchar_t)]; +char SIZEOF_WCHAR_T[sizeof (wchar_t)]; +char DUMMY; ! rm -f conftest.o conftest.syms @@ -835,29 +866,19 @@ char sizeof_wchar_t[sizeof (wchar_t)]; exit 1 fi - sizeof_wchar_t=0 + SIZEOF_WCHAR_T=0 + deferred_offset= - while read symbol type offset size ; do - size=$(( 0$size + 0 )) - symbol=${symbol#_} - if [ "$type" = "C" ] ; then - size=$(( 0$offset + 0 )) - fi - case "$symbol" in - sizeof* ) - eval $(printf "%s=%d\n" "$symbol" "$size") - ;; - esac - done < conftest.syms + read_syms rm -f conftest.syms conftest.o - if [ $sizeof_wchar_t -eq 0 ] ; then + if [ $SIZEOF_WCHAR_T -eq 0 ] ; then printf "failed\n" exit 1 fi - lit_align=$sizeof_wchar_t + lit_align=$SIZEOF_WCHAR_T fi printf "%d\n" "$lit_align" |