Skip to content

Commit 2925953

Browse files
author
Michael Meskes
committed
Replace self written 'long long int' configure test by standard 'AC_TYPE_LONG_LONG_INT' macro call.
1 parent 9b6dba1 commit 2925953

File tree

10 files changed

+201
-119
lines changed

10 files changed

+201
-119
lines changed

config/c-compiler.m4

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Macros to detect C compiler features
2-
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.21 2010/05/25 14:32:55 meskes Exp $
2+
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.22 2010/05/25 17:28:20 meskes Exp $
33

44

55
# PGAC_C_SIGNED
@@ -156,18 +156,3 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])],
156156
AC_MSG_RESULT(assuming no)])
157157
])# PGAC_PROG_CC_LDFLAGS_OPT
158158

159-
160-
161-
# PGAC_C_LONG_LONG
162-
# ----------------
163-
# Check if the C compiler understands long long type.
164-
AC_DEFUN([PGAC_C_LONG_LONG],
165-
[AC_CACHE_CHECK(for long long type, pgac_cv_c_long_long,
166-
[AC_TRY_COMPILE([],
167-
[long long l;],
168-
[pgac_cv_c_long_long=yes],
169-
[pgac_cv_c_long_long=no])])
170-
if test x"$pgac_cv_c_long_long" = xyes ; then
171-
AC_DEFINE(HAVE_LONG_LONG, 1, [Define to 1 if the C compiler does understand long long type.])
172-
fi])# PGAC_C_LONG_LONG
173-

configure

Lines changed: 154 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
20082008

20092009

20102010

2011+
20112012
ac_aux_dir=
20122013
for ac_dir in config "$srcdir"/config; do
20132014
if test -f "$ac_dir/install-sh"; then
@@ -14693,63 +14694,6 @@ cat >>confdefs.h <<\_ACEOF
1469314694
#define signed /**/
1469414695
_ACEOF
1469514696

14696-
fi
14697-
{ $as_echo "$as_me:$LINENO: checking for long long type" >&5
14698-
$as_echo_n "checking for long long type... " >&6; }
14699-
if test "${pgac_cv_c_long_long+set}" = set; then
14700-
$as_echo_n "(cached) " >&6
14701-
else
14702-
cat >conftest.$ac_ext <<_ACEOF
14703-
/* confdefs.h. */
14704-
_ACEOF
14705-
cat confdefs.h >>conftest.$ac_ext
14706-
cat >>conftest.$ac_ext <<_ACEOF
14707-
/* end confdefs.h. */
14708-
14709-
int
14710-
main ()
14711-
{
14712-
long long l;
14713-
;
14714-
return 0;
14715-
}
14716-
_ACEOF
14717-
rm -f conftest.$ac_objext
14718-
if { (ac_try="$ac_compile"
14719-
case "(($ac_try" in
14720-
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
14721-
*) ac_try_echo=$ac_try;;
14722-
esac
14723-
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
14724-
$as_echo "$ac_try_echo") >&5
14725-
(eval "$ac_compile") 2>conftest.er1
14726-
ac_status=$?
14727-
grep -v '^ *+' conftest.er1 >conftest.err
14728-
rm -f conftest.er1
14729-
cat conftest.err >&5
14730-
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
14731-
(exit $ac_status); } && {
14732-
test -z "$ac_c_werror_flag" ||
14733-
test ! -s conftest.err
14734-
} && test -s conftest.$ac_objext; then
14735-
pgac_cv_c_long_long=yes
14736-
else
14737-
$as_echo "$as_me: failed program was:" >&5
14738-
sed 's/^/| /' conftest.$ac_ext >&5
14739-
14740-
pgac_cv_c_long_long=no
14741-
fi
14742-
14743-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14744-
fi
14745-
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_c_long_long" >&5
14746-
$as_echo "$pgac_cv_c_long_long" >&6; }
14747-
if test x"$pgac_cv_c_long_long" = xyes ; then
14748-
14749-
cat >>confdefs.h <<\_ACEOF
14750-
#define HAVE_LONG_LONG 1
14751-
_ACEOF
14752-
1475314697
fi
1475414698
{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5
1475514699
$as_echo_n "checking for working volatile... " >&6; }
@@ -16505,6 +16449,159 @@ fi
1650516449

1650616450

1650716451

16452+
{ $as_echo "$as_me:$LINENO: checking for long long int" >&5
16453+
$as_echo_n "checking for long long int... " >&6; }
16454+
if test "${ac_cv_type_long_long_int+set}" = set; then
16455+
$as_echo_n "(cached) " >&6
16456+
else
16457+
cat >conftest.$ac_ext <<_ACEOF
16458+
16459+
/* confdefs.h. */
16460+
_ACEOF
16461+
cat confdefs.h >>conftest.$ac_ext
16462+
cat >>conftest.$ac_ext <<_ACEOF
16463+
/* end confdefs.h. */
16464+
/* For now, do not test the preprocessor; as of 2007 there are too many
16465+
implementations with broken preprocessors. Perhaps this can
16466+
be revisited in 2012. In the meantime, code should not expect
16467+
#if to work with literals wider than 32 bits. */
16468+
/* Test literals. */
16469+
long long int ll = 9223372036854775807ll;
16470+
long long int nll = -9223372036854775807LL;
16471+
unsigned long long int ull = 18446744073709551615ULL;
16472+
/* Test constant expressions. */
16473+
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
16474+
? 1 : -1)];
16475+
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
16476+
? 1 : -1)];
16477+
int i = 63;
16478+
int
16479+
main ()
16480+
{
16481+
/* Test availability of runtime routines for shift and division. */
16482+
long long int llmax = 9223372036854775807ll;
16483+
unsigned long long int ullmax = 18446744073709551615ull;
16484+
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
16485+
| (llmax / ll) | (llmax % ll)
16486+
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
16487+
| (ullmax / ull) | (ullmax % ull));
16488+
;
16489+
return 0;
16490+
}
16491+
16492+
_ACEOF
16493+
rm -f conftest.$ac_objext conftest$ac_exeext
16494+
if { (ac_try="$ac_link"
16495+
case "(($ac_try" in
16496+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16497+
*) ac_try_echo=$ac_try;;
16498+
esac
16499+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
16500+
$as_echo "$ac_try_echo") >&5
16501+
(eval "$ac_link") 2>conftest.er1
16502+
ac_status=$?
16503+
grep -v '^ *+' conftest.er1 >conftest.err
16504+
rm -f conftest.er1
16505+
cat conftest.err >&5
16506+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
16507+
(exit $ac_status); } && {
16508+
test -z "$ac_c_werror_flag" ||
16509+
test ! -s conftest.err
16510+
} && test -s conftest$ac_exeext && {
16511+
test "$cross_compiling" = yes ||
16512+
$as_test_x conftest$ac_exeext
16513+
}; then
16514+
if test "$cross_compiling" = yes; then
16515+
ac_cv_type_long_long_int=yes
16516+
else
16517+
cat >conftest.$ac_ext <<_ACEOF
16518+
/* confdefs.h. */
16519+
_ACEOF
16520+
cat confdefs.h >>conftest.$ac_ext
16521+
cat >>conftest.$ac_ext <<_ACEOF
16522+
/* end confdefs.h. */
16523+
#include <limits.h>
16524+
#ifndef LLONG_MAX
16525+
# define HALF \
16526+
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
16527+
# define LLONG_MAX (HALF - 1 + HALF)
16528+
#endif
16529+
int
16530+
main ()
16531+
{
16532+
long long int n = 1;
16533+
int i;
16534+
for (i = 0; ; i++)
16535+
{
16536+
long long int m = n << i;
16537+
if (m >> i != n)
16538+
return 1;
16539+
if (LLONG_MAX / 2 < m)
16540+
break;
16541+
}
16542+
return 0;
16543+
;
16544+
return 0;
16545+
}
16546+
_ACEOF
16547+
rm -f conftest$ac_exeext
16548+
if { (ac_try="$ac_link"
16549+
case "(($ac_try" in
16550+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16551+
*) ac_try_echo=$ac_try;;
16552+
esac
16553+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
16554+
$as_echo "$ac_try_echo") >&5
16555+
(eval "$ac_link") 2>&5
16556+
ac_status=$?
16557+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
16558+
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
16559+
{ (case "(($ac_try" in
16560+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
16561+
*) ac_try_echo=$ac_try;;
16562+
esac
16563+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
16564+
$as_echo "$ac_try_echo") >&5
16565+
(eval "$ac_try") 2>&5
16566+
ac_status=$?
16567+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
16568+
(exit $ac_status); }; }; then
16569+
ac_cv_type_long_long_int=yes
16570+
else
16571+
$as_echo "$as_me: program exited with status $ac_status" >&5
16572+
$as_echo "$as_me: failed program was:" >&5
16573+
sed 's/^/| /' conftest.$ac_ext >&5
16574+
16575+
( exit $ac_status )
16576+
ac_cv_type_long_long_int=no
16577+
fi
16578+
rm -rf conftest.dSYM
16579+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
16580+
fi
16581+
16582+
16583+
else
16584+
$as_echo "$as_me: failed program was:" >&5
16585+
sed 's/^/| /' conftest.$ac_ext >&5
16586+
16587+
ac_cv_type_long_long_int=no
16588+
fi
16589+
16590+
rm -rf conftest.dSYM
16591+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
16592+
conftest$ac_exeext conftest.$ac_ext
16593+
fi
16594+
{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
16595+
$as_echo "$ac_cv_type_long_long_int" >&6; }
16596+
if test $ac_cv_type_long_long_int = yes; then
16597+
16598+
cat >>confdefs.h <<\_ACEOF
16599+
#define HAVE_LONG_LONG_INT 1
16600+
_ACEOF
16601+
16602+
fi
16603+
16604+
1650816605
{ $as_echo "$as_me:$LINENO: checking for struct cmsgcred" >&5
1650916606
$as_echo_n "checking for struct cmsgcred... " >&6; }
1651016607
if test "${ac_cv_type_struct_cmsgcred+set}" = set; then

configure.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.628 2010/05/25 14:32:54 meskes Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.629 2010/05/25 17:28:20 meskes Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1090,7 +1090,6 @@ AC_C_CONST
10901090
PGAC_C_INLINE
10911091
AC_C_STRINGIZE
10921092
PGAC_C_SIGNED
1093-
PGAC_C_LONG_LONG
10941093
AC_C_VOLATILE
10951094
PGAC_C_FUNCNAME_SUPPORT
10961095
PGAC_STRUCT_TIMEZONE
@@ -1101,6 +1100,7 @@ PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
11011100
PGAC_STRUCT_ADDRINFO
11021101
AC_TYPE_INTPTR_T
11031102
AC_TYPE_UINTPTR_T
1103+
AC_TYPE_LONG_LONG_INT
11041104

11051105
AC_CHECK_TYPES([struct cmsgcred, struct fcred, struct sockcred], [], [],
11061106
[#include <sys/param.h>

src/include/pg_config.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@
330330
/* Define to 1 if `long int' works and is 64 bits. */
331331
#undef HAVE_LONG_INT_64
332332

333-
/* Define to 1 if the C compiler does understand long long type. */
334-
#undef HAVE_LONG_LONG
333+
/* Define to 1 if the system has the type `long long int'. */
334+
#undef HAVE_LONG_LONG_INT
335335

336336
/* Define to 1 if `long long int' works and is 64 bits. */
337337
#undef HAVE_LONG_LONG_INT_64

src/interfaces/ecpg/ecpglib/data.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.52 2010/05/20 22:10:45 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.53 2010/05/25 17:28:20 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -177,12 +177,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
177177
case ECPGt_unsigned_long:
178178
*((long *) (ind + ind_offset * act_tuple)) = value_for_indicator;
179179
break;
180-
#ifdef HAVE_LONG_LONG
180+
#ifdef HAVE_LONG_LONG_INT
181181
case ECPGt_long_long:
182182
case ECPGt_unsigned_long_long:
183183
*((long long int *) (ind + ind_offset * act_tuple)) = value_for_indicator;
184184
break;
185-
#endif /* HAVE_LONG_LONG */
185+
#endif /* HAVE_LONG_LONG_INT */
186186
case ECPGt_NO_INDICATOR:
187187
if (value_for_indicator == -1)
188188
{
@@ -265,12 +265,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
265265
case ECPGt_unsigned_long:
266266
*((long *) (ind + ind_offset * act_tuple)) = size;
267267
break;
268-
#ifdef HAVE_LONG_LONG
268+
#ifdef HAVE_LONG_LONG_INT
269269
case ECPGt_long_long:
270270
case ECPGt_unsigned_long_long:
271271
*((long long int *) (ind + ind_offset * act_tuple)) = size;
272272
break;
273-
#endif /* HAVE_LONG_LONG */
273+
#endif /* HAVE_LONG_LONG_INT */
274274
default:
275275
break;
276276
}
@@ -350,7 +350,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
350350
}
351351
break;
352352

353-
#ifdef HAVE_LONG_LONG
353+
#ifdef HAVE_LONG_LONG_INT
354354
#ifdef HAVE_STRTOLL
355355
case ECPGt_long_long:
356356
*((long long int *) (var + offset * act_tuple)) = strtoll(pval, &scan_length, 10);
@@ -376,7 +376,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
376376

377377
break;
378378
#endif /* HAVE_STRTOULL */
379-
#endif /* HAVE_LONG_LONG */
379+
#endif /* HAVE_LONG_LONG_INT */
380380

381381
case ECPGt_float:
382382
case ECPGt_double:
@@ -489,12 +489,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
489489
case ECPGt_unsigned_long:
490490
*((long *) (ind + ind_offset * act_tuple)) = size;
491491
break;
492-
#ifdef HAVE_LONG_LONG
492+
#ifdef HAVE_LONG_LONG_INT
493493
case ECPGt_long_long:
494494
case ECPGt_unsigned_long_long:
495495
*((long long int *) (ind + ind_offset * act_tuple)) = size;
496496
break;
497-
#endif /* HAVE_LONG_LONG */
497+
#endif /* HAVE_LONG_LONG_INT */
498498
default:
499499
break;
500500
}
@@ -534,12 +534,12 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
534534
case ECPGt_unsigned_long:
535535
*((long *) (ind + offset * act_tuple)) = variable->len;
536536
break;
537-
#ifdef HAVE_LONG_LONG
537+
#ifdef HAVE_LONG_LONG_INT
538538
case ECPGt_long_long:
539539
case ECPGt_unsigned_long_long:
540540
*((long long int *) (ind + ind_offset * act_tuple)) = variable->len;
541541
break;
542-
#endif /* HAVE_LONG_LONG */
542+
#endif /* HAVE_LONG_LONG_INT */
543543
default:
544544
break;
545545
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy