diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 144 |
1 files changed, 79 insertions, 65 deletions
diff --git a/configure.ac b/configure.ac index d0569df60..afcd8aff0 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.302 2005/10/17 13:29:23 dtucker Exp $ | 1 | # $Id: configure.ac,v 1.303 2005/10/25 08:38:34 dtucker Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -106,70 +106,6 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then | |||
106 | fi | 106 | fi |
107 | fi | 107 | fi |
108 | 108 | ||
109 | if test -z "$have_llong_max"; then | ||
110 | AC_MSG_CHECKING([for max value of long long]) | ||
111 | AC_RUN_IFELSE( | ||
112 | [AC_LANG_SOURCE([[ | ||
113 | #include <stdio.h> | ||
114 | /* Why is this so damn hard? */ | ||
115 | #ifdef __GNUC__ | ||
116 | # undef __GNUC__ | ||
117 | #endif | ||
118 | #define __USE_ISOC99 | ||
119 | #include <limits.h> | ||
120 | #define DATA "conftest.llminmax" | ||
121 | int main(void) { | ||
122 | FILE *f; | ||
123 | long long i, llmin, llmax = 0; | ||
124 | |||
125 | if((f = fopen(DATA,"w")) == NULL) | ||
126 | exit(1); | ||
127 | |||
128 | #if defined(LLONG_MIN) && defined(LLONG_MAX) | ||
129 | fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n"); | ||
130 | llmin = LLONG_MIN; | ||
131 | llmax = LLONG_MAX; | ||
132 | #else | ||
133 | fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n"); | ||
134 | /* This will work on one's complement and two's complement */ | ||
135 | for (i = 1; i > llmax; i <<= 1, i++) | ||
136 | llmax = i; | ||
137 | llmin = llmax + 1LL; /* wrap */ | ||
138 | #endif | ||
139 | |||
140 | /* Sanity check */ | ||
141 | if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax | ||
142 | || llmax - 1 > llmax) { | ||
143 | fprintf(f, "unknown unknown\n"); | ||
144 | exit(2); | ||
145 | } | ||
146 | |||
147 | if (fprintf(f ,"%lld %lld", llmin, llmax) < 0) | ||
148 | exit(3); | ||
149 | |||
150 | exit(0); | ||
151 | } | ||
152 | ]])], | ||
153 | [ | ||
154 | llong_min=`$AWK '{print $1}' conftest.llminmax` | ||
155 | llong_max=`$AWK '{print $2}' conftest.llminmax` | ||
156 | AC_MSG_RESULT($llong_max) | ||
157 | AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL], | ||
158 | [max value of long long calculated by configure]) | ||
159 | AC_MSG_CHECKING([for min value of long long]) | ||
160 | AC_MSG_RESULT($llong_min) | ||
161 | AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL], | ||
162 | [min value of long long calculated by configure]) | ||
163 | ], | ||
164 | [ | ||
165 | AC_MSG_RESULT(not found) | ||
166 | ], | ||
167 | [ | ||
168 | AC_MSG_WARN([cross compiling: not checking]) | ||
169 | ] | ||
170 | ) | ||
171 | fi | ||
172 | |||
173 | AC_ARG_WITH(rpath, | 109 | AC_ARG_WITH(rpath, |
174 | [ --without-rpath Disable auto-added -R linker paths], | 110 | [ --without-rpath Disable auto-added -R linker paths], |
175 | [ | 111 | [ |
@@ -2053,6 +1989,84 @@ if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then | |||
2053 | ac_cv_sizeof_long_long_int=0 | 1989 | ac_cv_sizeof_long_long_int=0 |
2054 | fi | 1990 | fi |
2055 | 1991 | ||
1992 | # compute LLONG_MIN and LLONG_MAX if we don't know them. | ||
1993 | if test -z "$have_llong_max"; then | ||
1994 | AC_MSG_CHECKING([for max value of long long]) | ||
1995 | AC_RUN_IFELSE( | ||
1996 | [AC_LANG_SOURCE([[ | ||
1997 | #include <stdio.h> | ||
1998 | /* Why is this so damn hard? */ | ||
1999 | #ifdef __GNUC__ | ||
2000 | # undef __GNUC__ | ||
2001 | #endif | ||
2002 | #define __USE_ISOC99 | ||
2003 | #include <limits.h> | ||
2004 | #define DATA "conftest.llminmax" | ||
2005 | int main(void) { | ||
2006 | FILE *f; | ||
2007 | long long i, llmin, llmax = 0; | ||
2008 | |||
2009 | if((f = fopen(DATA,"w")) == NULL) | ||
2010 | exit(1); | ||
2011 | |||
2012 | #if defined(LLONG_MIN) && defined(LLONG_MAX) | ||
2013 | fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n"); | ||
2014 | llmin = LLONG_MIN; | ||
2015 | llmax = LLONG_MAX; | ||
2016 | #else | ||
2017 | fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n"); | ||
2018 | /* This will work on one's complement and two's complement */ | ||
2019 | for (i = 1; i > llmax; i <<= 1, i++) | ||
2020 | llmax = i; | ||
2021 | llmin = llmax + 1LL; /* wrap */ | ||
2022 | #endif | ||
2023 | |||
2024 | /* Sanity check */ | ||
2025 | if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax | ||
2026 | || llmax - 1 > llmax) { | ||
2027 | fprintf(f, "unknown unknown\n"); | ||
2028 | exit(2); | ||
2029 | } | ||
2030 | |||
2031 | if (fprintf(f ,"%lld %lld", llmin, llmax) < 0) | ||
2032 | exit(3); | ||
2033 | |||
2034 | exit(0); | ||
2035 | } | ||
2036 | ]])], | ||
2037 | [ | ||
2038 | llong_min=`$AWK '{print $1}' conftest.llminmax` | ||
2039 | llong_max=`$AWK '{print $2}' conftest.llminmax` | ||
2040 | |||
2041 | # snprintf on some Tru64s doesn't understand "%lld" | ||
2042 | case "$host" in | ||
2043 | alpha-dec-osf*) | ||
2044 | if test "x$ac_cv_sizeof_long_long_int" = "x8" && | ||
2045 | test "x$llong_max" = "xld"; then | ||
2046 | llong_min="-9223372036854775808" | ||
2047 | llong_max="9223372036854775807" | ||
2048 | fi | ||
2049 | ;; | ||
2050 | esac | ||
2051 | |||
2052 | AC_MSG_RESULT($llong_max) | ||
2053 | AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL], | ||
2054 | [max value of long long calculated by configure]) | ||
2055 | AC_MSG_CHECKING([for min value of long long]) | ||
2056 | AC_MSG_RESULT($llong_min) | ||
2057 | AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL], | ||
2058 | [min value of long long calculated by configure]) | ||
2059 | ], | ||
2060 | [ | ||
2061 | AC_MSG_RESULT(not found) | ||
2062 | ], | ||
2063 | [ | ||
2064 | AC_MSG_WARN([cross compiling: not checking]) | ||
2065 | ] | ||
2066 | ) | ||
2067 | fi | ||
2068 | |||
2069 | |||
2056 | # More checks for data types | 2070 | # More checks for data types |
2057 | AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ | 2071 | AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ |
2058 | AC_TRY_COMPILE( | 2072 | AC_TRY_COMPILE( |