Skip to content

Commit 555a02f

Browse files
author
Michael Meskes
committed
Added a configure test for "long long" datatypes. So far this is only used in ecpg and replaces the old test that was kind of hackish.
1 parent f4e9436 commit 555a02f

File tree

7 files changed

+85
-15
lines changed

7 files changed

+85
-15
lines changed

config/c-compiler.m4

+17-1
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.20 2010/02/13 02:34:08 tgl Exp $
2+
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.21 2010/05/25 14:32:55 meskes Exp $
33

44

55
# PGAC_C_SIGNED
@@ -155,3 +155,19 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])],
155155
[LDFLAGS="$pgac_save_LDFLAGS"
156156
AC_MSG_RESULT(assuming no)])
157157
])# PGAC_PROG_CC_LDFLAGS_OPT
158+
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

+57-1
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
20082008

20092009

20102010

2011-
20122011
ac_aux_dir=
20132012
for ac_dir in config "$srcdir"/config; do
20142013
if test -f "$ac_dir/install-sh"; then
@@ -14694,6 +14693,63 @@ cat >>confdefs.h <<\_ACEOF
1469414693
#define signed /**/
1469514694
_ACEOF
1469614695

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+
1469714753
fi
1469814754
{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5
1469914755
$as_echo_n "checking for working volatile... " >&6; }

configure.in

+2-1
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.627 2010/05/13 22:07:42 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.628 2010/05/25 14:32:54 meskes Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1090,6 +1090,7 @@ AC_C_CONST
10901090
PGAC_C_INLINE
10911091
AC_C_STRINGIZE
10921092
PGAC_C_SIGNED
1093+
PGAC_C_LONG_LONG
10931094
AC_C_VOLATILE
10941095
PGAC_C_FUNCNAME_SUPPORT
10951096
PGAC_STRUCT_TIMEZONE

src/include/pg_config.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@
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
335+
333336
/* Define to 1 if `long long int' works and is 64 bits. */
334337
#undef HAVE_LONG_LONG_INT_64
335338

src/interfaces/ecpg/ecpglib/extern.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.40 2010/05/20 22:10:45 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.41 2010/05/25 14:32:55 meskes Exp $ */
22

33
#ifndef _ECPG_LIB_EXTERN_H
44
#define _ECPG_LIB_EXTERN_H
@@ -13,11 +13,6 @@
1313
#include <limits.h>
1414
#endif
1515

16-
/* Do we know the C99 data type "long long"? */
17-
#if defined(LLONG_MIN) || defined(LONGLONG_MIN) || defined(HAVE_LONG_LONG_INT_64)
18-
#define HAVE_LONG_LONG 1
19-
#endif
20-
2116
enum COMPAT_MODE
2217
{
2318
ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE

src/interfaces/ecpg/include/ecpg_config.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515
* (--enable-thread-safety) */
1616
#undef ENABLE_THREAD_SAFETY
1717

18+
/* Define to 1 if the C compiler does understand long long type. */
19+
#undef HAVE_LONG_LONG
20+

src/interfaces/ecpg/preproc/ecpg.header

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.15 2010/05/20 22:10:46 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.16 2010/05/25 14:32:55 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
55
#include "postgres_fe.h"
66

77
#include "extern.h"
8+
#include "ecpg_config.h"
89
#include <unistd.h>
910

10-
/* Do we know the C99 datatype "long long"? */
11-
#if defined(LLONG_MIN) || defined(LONGLONG_MIN) || defined(HAVE_LONG_LONG_INT_64)
12-
#define HAVE_LONG_LONG 1
13-
#endif
14-
1511
/* Location tracking support --- simpler than bison's default */
1612
#define YYLLOC_DEFAULT(Current, Rhs, N) \
1713
do { \

0 commit comments

Comments
 (0)