~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to m4/longlong.m4

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-10-19 00:00:09 UTC
  • mfrom: (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20111019000009-8p33w3wz4b1rdri0
Tags: 1.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
  - Depend on libssl-dev 0.9.8k-7ubuntu4 (LP: #503339)
* Dropped changes, superseded in Debian:
  - Keep build dependencies in main:
    + debian/control: remove info2man build-dep
    + debian/patches/series: disable wget-infopod_generated_manpage
  - Mark wget Multi-Arch: foreign, so packages that aren't of the same arch
    can depend on it.
* Pass --with-ssl=openssl; we don't want to use gnutls, there's no udeb for
  it.
* Add a second build pass for the udeb, so we can build without libidn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# longlong.m4 serial 14
2
 
dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc.
 
1
# longlong.m4 serial 16
 
2
dnl Copyright (C) 1999-2007, 2009-2011 Free Software Foundation, Inc.
3
3
dnl This file is free software; the Free Software Foundation
4
4
dnl gives unlimited permission to copy and/or distribute it,
5
5
dnl with or without modifications, as long as this notice is preserved.
7
7
dnl From Paul Eggert.
8
8
 
9
9
# Define HAVE_LONG_LONG_INT if 'long long int' works.
10
 
# This fixes a bug in Autoconf 2.61, but can be removed once we
11
 
# assume 2.62 everywhere.
 
10
# This fixes a bug in Autoconf 2.61, and can be faster
 
11
# than what's in Autoconf 2.62 through 2.68.
12
12
 
13
13
# Note: If the type 'long long int' exists but is only 32 bits large
14
14
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
16
16
 
17
17
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
18
18
[
 
19
  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
19
20
  AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
20
 
    [AC_LINK_IFELSE(
21
 
       [_AC_TYPE_LONG_LONG_SNIPPET],
22
 
       [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
23
 
        dnl If cross compiling, assume the bug isn't important, since
24
 
        dnl nobody cross compiles for this platform as far as we know.
25
 
        AC_RUN_IFELSE(
26
 
          [AC_LANG_PROGRAM(
27
 
             [[@%:@include <limits.h>
28
 
               @%:@ifndef LLONG_MAX
29
 
               @%:@ define HALF \
30
 
                        (1LL << (sizeof (long long int) * CHAR_BIT - 2))
31
 
               @%:@ define LLONG_MAX (HALF - 1 + HALF)
32
 
               @%:@endif]],
33
 
             [[long long int n = 1;
34
 
               int i;
35
 
               for (i = 0; ; i++)
36
 
                 {
37
 
                   long long int m = n << i;
38
 
                   if (m >> i != n)
39
 
                     return 1;
40
 
                   if (LLONG_MAX / 2 < m)
41
 
                     break;
42
 
                 }
43
 
               return 0;]])],
44
 
          [ac_cv_type_long_long_int=yes],
45
 
          [ac_cv_type_long_long_int=no],
46
 
          [ac_cv_type_long_long_int=yes])],
47
 
       [ac_cv_type_long_long_int=no])])
 
21
     [ac_cv_type_long_long_int=yes
 
22
      if test "x${ac_cv_prog_cc_c99-no}" = xno; then
 
23
        ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
 
24
        if test $ac_cv_type_long_long_int = yes; then
 
25
          dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
 
26
          dnl If cross compiling, assume the bug is not important, since
 
27
          dnl nobody cross compiles for this platform as far as we know.
 
28
          AC_RUN_IFELSE(
 
29
            [AC_LANG_PROGRAM(
 
30
               [[@%:@include <limits.h>
 
31
                 @%:@ifndef LLONG_MAX
 
32
                 @%:@ define HALF \
 
33
                          (1LL << (sizeof (long long int) * CHAR_BIT - 2))
 
34
                 @%:@ define LLONG_MAX (HALF - 1 + HALF)
 
35
                 @%:@endif]],
 
36
               [[long long int n = 1;
 
37
                 int i;
 
38
                 for (i = 0; ; i++)
 
39
                   {
 
40
                     long long int m = n << i;
 
41
                     if (m >> i != n)
 
42
                       return 1;
 
43
                     if (LLONG_MAX / 2 < m)
 
44
                       break;
 
45
                   }
 
46
                 return 0;]])],
 
47
            [],
 
48
            [ac_cv_type_long_long_int=no],
 
49
            [:])
 
50
        fi
 
51
      fi])
48
52
  if test $ac_cv_type_long_long_int = yes; then
49
53
    AC_DEFINE([HAVE_LONG_LONG_INT], [1],
50
54
      [Define to 1 if the system has the type `long long int'.])
52
56
])
53
57
 
54
58
# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
55
 
# This fixes a bug in Autoconf 2.61, but can be removed once we
56
 
# assume 2.62 everywhere.
 
59
# This fixes a bug in Autoconf 2.61, and can be faster
 
60
# than what's in Autoconf 2.62 through 2.68.
57
61
 
58
62
# Note: If the type 'unsigned long long int' exists but is only 32 bits
59
63
# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
64
68
[
65
69
  AC_CACHE_CHECK([for unsigned long long int],
66
70
    [ac_cv_type_unsigned_long_long_int],
67
 
    [AC_LINK_IFELSE(
68
 
       [_AC_TYPE_LONG_LONG_SNIPPET],
69
 
       [ac_cv_type_unsigned_long_long_int=yes],
70
 
       [ac_cv_type_unsigned_long_long_int=no])])
 
71
    [ac_cv_type_unsigned_long_long_int=yes
 
72
     if test "x${ac_cv_prog_cc_c99-no}" = xno; then
 
73
       AC_LINK_IFELSE(
 
74
         [_AC_TYPE_LONG_LONG_SNIPPET],
 
75
         [],
 
76
         [ac_cv_type_unsigned_long_long_int=no])
 
77
     fi])
71
78
  if test $ac_cv_type_unsigned_long_long_int = yes; then
72
79
    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
73
80
      [Define to 1 if the system has the type `unsigned long long int'.])
83
90
[
84
91
  AC_LANG_PROGRAM(
85
92
    [[/* For now, do not test the preprocessor; as of 2007 there are too many
86
 
         implementations with broken preprocessors.  Perhaps this can
87
 
         be revisited in 2012.  In the meantime, code should not expect
88
 
         #if to work with literals wider than 32 bits.  */
 
93
         implementations with broken preprocessors.  Perhaps this can
 
94
         be revisited in 2012.  In the meantime, code should not expect
 
95
         #if to work with literals wider than 32 bits.  */
89
96
      /* Test literals.  */
90
97
      long long int ll = 9223372036854775807ll;
91
98
      long long int nll = -9223372036854775807LL;
92
99
      unsigned long long int ull = 18446744073709551615ULL;
93
100
      /* Test constant expressions.   */
94
101
      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
95
 
                     ? 1 : -1)];
 
102
                     ? 1 : -1)];
96
103
      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
97
 
                     ? 1 : -1)];
 
104
                     ? 1 : -1)];
98
105
      int i = 63;]],
99
106
    [[/* Test availability of runtime routines for shift and division.  */
100
107
      long long int llmax = 9223372036854775807ll;
101
108
      unsigned long long int ullmax = 18446744073709551615ull;
102
109
      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
103
 
              | (llmax / ll) | (llmax % ll)
104
 
              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
105
 
              | (ullmax / ull) | (ullmax % ull));]])
 
110
              | (llmax / ll) | (llmax % ll)
 
111
              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
 
112
              | (ullmax / ull) | (ullmax % ull));]])
106
113
])