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.

This commit is contained in:
Michael Meskes 2010-05-25 14:32:55 +00:00
parent f4e9436026
commit 555a02f910
7 changed files with 85 additions and 15 deletions

View File

@ -1,5 +1,5 @@
# Macros to detect C compiler features
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.20 2010/02/13 02:34:08 tgl Exp $
# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.21 2010/05/25 14:32:55 meskes Exp $
# PGAC_C_SIGNED
@ -155,3 +155,19 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])],
[LDFLAGS="$pgac_save_LDFLAGS"
AC_MSG_RESULT(assuming no)])
])# PGAC_PROG_CC_LDFLAGS_OPT
# PGAC_C_LONG_LONG
# ----------------
# Check if the C compiler understands long long type.
AC_DEFUN([PGAC_C_LONG_LONG],
[AC_CACHE_CHECK(for long long type, pgac_cv_c_long_long,
[AC_TRY_COMPILE([],
[long long l;],
[pgac_cv_c_long_long=yes],
[pgac_cv_c_long_long=no])])
if test x"$pgac_cv_c_long_long" = xyes ; then
AC_DEFINE(HAVE_LONG_LONG, 1, [Define to 1 if the C compiler does understand long long type.])
fi])# PGAC_C_LONG_LONG

58
configure vendored
View File

@ -2008,7 +2008,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
for ac_dir in config "$srcdir"/config; do
if test -f "$ac_dir/install-sh"; then
@ -14694,6 +14693,63 @@ cat >>confdefs.h <<\_ACEOF
#define signed /**/
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking for long long type" >&5
$as_echo_n "checking for long long type... " >&6; }
if test "${pgac_cv_c_long_long+set}" = set; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
long long l;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
pgac_cv_c_long_long=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
pgac_cv_c_long_long=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_c_long_long" >&5
$as_echo "$pgac_cv_c_long_long" >&6; }
if test x"$pgac_cv_c_long_long" = xyes ; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_LONG_LONG 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5
$as_echo_n "checking for working volatile... " >&6; }

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.627 2010/05/13 22:07:42 tgl Exp $
dnl $PostgreSQL: pgsql/configure.in,v 1.628 2010/05/25 14:32:54 meskes Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@ -1090,6 +1090,7 @@ AC_C_CONST
PGAC_C_INLINE
AC_C_STRINGIZE
PGAC_C_SIGNED
PGAC_C_LONG_LONG
AC_C_VOLATILE
PGAC_C_FUNCNAME_SUPPORT
PGAC_STRUCT_TIMEZONE

View File

@ -330,6 +330,9 @@
/* Define to 1 if `long int' works and is 64 bits. */
#undef HAVE_LONG_INT_64
/* Define to 1 if the C compiler does understand long long type. */
#undef HAVE_LONG_LONG
/* Define to 1 if `long long int' works and is 64 bits. */
#undef HAVE_LONG_LONG_INT_64

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.40 2010/05/20 22:10:45 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.41 2010/05/25 14:32:55 meskes Exp $ */
#ifndef _ECPG_LIB_EXTERN_H
#define _ECPG_LIB_EXTERN_H
@ -13,11 +13,6 @@
#include <limits.h>
#endif
/* Do we know the C99 data type "long long"? */
#if defined(LLONG_MIN) || defined(LONGLONG_MIN) || defined(HAVE_LONG_LONG_INT_64)
#define HAVE_LONG_LONG 1
#endif
enum COMPAT_MODE
{
ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE

View File

@ -15,3 +15,6 @@
* (--enable-thread-safety) */
#undef ENABLE_THREAD_SAFETY
/* Define to 1 if the C compiler does understand long long type. */
#undef HAVE_LONG_LONG

View File

@ -1,17 +1,13 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.15 2010/05/20 22:10:46 meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.16 2010/05/25 14:32:55 meskes Exp $ */
/* Copyright comment */
%{
#include "postgres_fe.h"
#include "extern.h"
#include "ecpg_config.h"
#include <unistd.h>
/* Do we know the C99 datatype "long long"? */
#if defined(LLONG_MIN) || defined(LONGLONG_MIN) || defined(HAVE_LONG_LONG_INT_64)
#define HAVE_LONG_LONG 1
#endif
/* Location tracking support --- simpler than bison's default */
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \