Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9394d39

Browse files
committed
Add configure checks for strtoll, strtoull (or strto[u]q). Disable
'long long int' portions of ecpg if the type or these functions don't exist.
1 parent 2d248d6 commit 9394d39

File tree

7 files changed

+188
-34
lines changed

7 files changed

+188
-34
lines changed

configure

+138-26
Original file line numberDiff line numberDiff line change
@@ -7169,17 +7169,129 @@ EOF
71697169

71707170

71717171

7172+
for ac_func in strtoll strtoq
7173+
do
7174+
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
7175+
echo "configure:7176: checking for $ac_func" >&5
7176+
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
7177+
echo $ac_n "(cached) $ac_c" 1>&6
7178+
else
7179+
cat > conftest.$ac_ext <<EOF
7180+
#line 7181 "configure"
7181+
#include "confdefs.h"
7182+
/* System header to define __stub macros and hopefully few prototypes,
7183+
which can conflict with char $ac_func(); below. */
7184+
#include <assert.h>
7185+
/* Override any gcc2 internal prototype to avoid an error. */
7186+
/* We use char because int might match the return type of a gcc2
7187+
builtin and then its argument prototype would still apply. */
7188+
char $ac_func();
7189+
7190+
int main() {
7191+
7192+
/* The GNU C library defines this for functions which it implements
7193+
to always fail with ENOSYS. Some functions are actually named
7194+
something starting with __ and the normal name is an alias. */
7195+
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
7196+
choke me
7197+
#else
7198+
$ac_func();
7199+
#endif
7200+
7201+
; return 0; }
7202+
EOF
7203+
if { (eval echo configure:7204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
7204+
rm -rf conftest*
7205+
eval "ac_cv_func_$ac_func=yes"
7206+
else
7207+
echo "configure: failed program was:" >&5
7208+
cat conftest.$ac_ext >&5
7209+
rm -rf conftest*
7210+
eval "ac_cv_func_$ac_func=no"
7211+
fi
7212+
rm -f conftest*
7213+
fi
7214+
7215+
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
7216+
echo "$ac_t""yes" 1>&6
7217+
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7218+
cat >> confdefs.h <<EOF
7219+
#define $ac_tr_func 1
7220+
EOF
7221+
break
7222+
else
7223+
echo "$ac_t""no" 1>&6
7224+
fi
7225+
done
7226+
7227+
for ac_func in strtoull strtouq
7228+
do
7229+
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
7230+
echo "configure:7231: checking for $ac_func" >&5
7231+
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
7232+
echo $ac_n "(cached) $ac_c" 1>&6
7233+
else
7234+
cat > conftest.$ac_ext <<EOF
7235+
#line 7236 "configure"
7236+
#include "confdefs.h"
7237+
/* System header to define __stub macros and hopefully few prototypes,
7238+
which can conflict with char $ac_func(); below. */
7239+
#include <assert.h>
7240+
/* Override any gcc2 internal prototype to avoid an error. */
7241+
/* We use char because int might match the return type of a gcc2
7242+
builtin and then its argument prototype would still apply. */
7243+
char $ac_func();
7244+
7245+
int main() {
7246+
7247+
/* The GNU C library defines this for functions which it implements
7248+
to always fail with ENOSYS. Some functions are actually named
7249+
something starting with __ and the normal name is an alias. */
7250+
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
7251+
choke me
7252+
#else
7253+
$ac_func();
7254+
#endif
7255+
7256+
; return 0; }
7257+
EOF
7258+
if { (eval echo configure:7259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
7259+
rm -rf conftest*
7260+
eval "ac_cv_func_$ac_func=yes"
7261+
else
7262+
echo "configure: failed program was:" >&5
7263+
cat conftest.$ac_ext >&5
7264+
rm -rf conftest*
7265+
eval "ac_cv_func_$ac_func=no"
7266+
fi
7267+
rm -f conftest*
7268+
fi
7269+
7270+
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
7271+
echo "$ac_t""yes" 1>&6
7272+
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
7273+
cat >> confdefs.h <<EOF
7274+
#define $ac_tr_func 1
7275+
EOF
7276+
break
7277+
else
7278+
echo "$ac_t""no" 1>&6
7279+
fi
7280+
done
7281+
7282+
7283+
71727284

71737285
echo $ac_n "checking alignment of short""... $ac_c" 1>&6
7174-
echo "configure:7175: checking alignment of short" >&5
7286+
echo "configure:7287: checking alignment of short" >&5
71757287
if eval "test \"`echo '$''{'pgac_cv_alignof_short'+set}'`\" = set"; then
71767288
echo $ac_n "(cached) $ac_c" 1>&6
71777289
else
71787290
if test "$cross_compiling" = yes; then
71797291
pgac_cv_alignof_short='sizeof(short)'
71807292
else
71817293
cat > conftest.$ac_ext <<EOF
7182-
#line 7183 "configure"
7294+
#line 7295 "configure"
71837295
#include "confdefs.h"
71847296
#include <stdio.h>
71857297
struct { char filler; short field; } mystruct;
@@ -7191,7 +7303,7 @@ main()
71917303
exit(0);
71927304
}
71937305
EOF
7194-
if { (eval echo configure:7195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
7306+
if { (eval echo configure:7307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
71957307
then
71967308
pgac_cv_alignof_short=`cat conftestval`
71977309
else
@@ -7211,15 +7323,15 @@ EOF
72117323

72127324

72137325
echo $ac_n "checking alignment of int""... $ac_c" 1>&6
7214-
echo "configure:7215: checking alignment of int" >&5
7326+
echo "configure:7327: checking alignment of int" >&5
72157327
if eval "test \"`echo '$''{'pgac_cv_alignof_int'+set}'`\" = set"; then
72167328
echo $ac_n "(cached) $ac_c" 1>&6
72177329
else
72187330
if test "$cross_compiling" = yes; then
72197331
pgac_cv_alignof_int='sizeof(int)'
72207332
else
72217333
cat > conftest.$ac_ext <<EOF
7222-
#line 7223 "configure"
7334+
#line 7335 "configure"
72237335
#include "confdefs.h"
72247336
#include <stdio.h>
72257337
struct { char filler; int field; } mystruct;
@@ -7231,7 +7343,7 @@ main()
72317343
exit(0);
72327344
}
72337345
EOF
7234-
if { (eval echo configure:7235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
7346+
if { (eval echo configure:7347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
72357347
then
72367348
pgac_cv_alignof_int=`cat conftestval`
72377349
else
@@ -7251,15 +7363,15 @@ EOF
72517363

72527364

72537365
echo $ac_n "checking alignment of long""... $ac_c" 1>&6
7254-
echo "configure:7255: checking alignment of long" >&5
7366+
echo "configure:7367: checking alignment of long" >&5
72557367
if eval "test \"`echo '$''{'pgac_cv_alignof_long'+set}'`\" = set"; then
72567368
echo $ac_n "(cached) $ac_c" 1>&6
72577369
else
72587370
if test "$cross_compiling" = yes; then
72597371
pgac_cv_alignof_long='sizeof(long)'
72607372
else
72617373
cat > conftest.$ac_ext <<EOF
7262-
#line 7263 "configure"
7374+
#line 7375 "configure"
72637375
#include "confdefs.h"
72647376
#include <stdio.h>
72657377
struct { char filler; long field; } mystruct;
@@ -7271,7 +7383,7 @@ main()
72717383
exit(0);
72727384
}
72737385
EOF
7274-
if { (eval echo configure:7275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
7386+
if { (eval echo configure:7387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
72757387
then
72767388
pgac_cv_alignof_long=`cat conftestval`
72777389
else
@@ -7292,15 +7404,15 @@ EOF
72927404

72937405
if [ x"$HAVE_LONG_LONG_INT_64" = xyes ] ; then
72947406
echo $ac_n "checking alignment of long long int""... $ac_c" 1>&6
7295-
echo "configure:7296: checking alignment of long long int" >&5
7407+
echo "configure:7408: checking alignment of long long int" >&5
72967408
if eval "test \"`echo '$''{'pgac_cv_alignof_long_long_int'+set}'`\" = set"; then
72977409
echo $ac_n "(cached) $ac_c" 1>&6
72987410
else
72997411
if test "$cross_compiling" = yes; then
73007412
pgac_cv_alignof_long_long_int='sizeof(long long int)'
73017413
else
73027414
cat > conftest.$ac_ext <<EOF
7303-
#line 7304 "configure"
7415+
#line 7416 "configure"
73047416
#include "confdefs.h"
73057417
#include <stdio.h>
73067418
struct { char filler; long long int field; } mystruct;
@@ -7312,7 +7424,7 @@ main()
73127424
exit(0);
73137425
}
73147426
EOF
7315-
if { (eval echo configure:7316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
7427+
if { (eval echo configure:7428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
73167428
then
73177429
pgac_cv_alignof_long_long_int=`cat conftestval`
73187430
else
@@ -7333,15 +7445,15 @@ EOF
73337445

73347446
fi
73357447
echo $ac_n "checking alignment of double""... $ac_c" 1>&6
7336-
echo "configure:7337: checking alignment of double" >&5
7448+
echo "configure:7449: checking alignment of double" >&5
73377449
if eval "test \"`echo '$''{'pgac_cv_alignof_double'+set}'`\" = set"; then
73387450
echo $ac_n "(cached) $ac_c" 1>&6
73397451
else
73407452
if test "$cross_compiling" = yes; then
73417453
pgac_cv_alignof_double='sizeof(double)'
73427454
else
73437455
cat > conftest.$ac_ext <<EOF
7344-
#line 7345 "configure"
7456+
#line 7457 "configure"
73457457
#include "confdefs.h"
73467458
#include <stdio.h>
73477459
struct { char filler; double field; } mystruct;
@@ -7353,7 +7465,7 @@ main()
73537465
exit(0);
73547466
}
73557467
EOF
7356-
if { (eval echo configure:7357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
7468+
if { (eval echo configure:7469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
73577469
then
73587470
pgac_cv_alignof_double=`cat conftestval`
73597471
else
@@ -7391,12 +7503,12 @@ EOF
73917503

73927504

73937505
echo $ac_n "checking for POSIX signal interface""... $ac_c" 1>&6
7394-
echo "configure:7395: checking for POSIX signal interface" >&5
7506+
echo "configure:7507: checking for POSIX signal interface" >&5
73957507
if eval "test \"`echo '$''{'pgac_cv_func_posix_signals'+set}'`\" = set"; then
73967508
echo $ac_n "(cached) $ac_c" 1>&6
73977509
else
73987510
cat > conftest.$ac_ext <<EOF
7399-
#line 7400 "configure"
7511+
#line 7512 "configure"
74007512
#include "confdefs.h"
74017513
#include <signal.h>
74027514
@@ -7407,7 +7519,7 @@ act.sa_flags = SA_RESTART;
74077519
sigaction(0, &act, &oact);
74087520
; return 0; }
74097521
EOF
7410-
if { (eval echo configure:7411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
7522+
if { (eval echo configure:7523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
74117523
rm -rf conftest*
74127524
pgac_cv_func_posix_signals=yes
74137525
else
@@ -7437,7 +7549,7 @@ do
74377549
# Extract the first word of "$ac_prog", so it can be a program name with args.
74387550
set dummy $ac_prog; ac_word=$2
74397551
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
7440-
echo "configure:7441: checking for $ac_word" >&5
7552+
echo "configure:7553: checking for $ac_word" >&5
74417553
if eval "test \"`echo '$''{'ac_cv_path_TCLSH'+set}'`\" = set"; then
74427554
echo $ac_n "(cached) $ac_c" 1>&6
74437555
else
@@ -7473,7 +7585,7 @@ test -n "$TCLSH" && break
74737585
done
74747586

74757587
echo $ac_n "checking for tclConfig.sh""... $ac_c" 1>&6
7476-
echo "configure:7477: checking for tclConfig.sh" >&5
7588+
echo "configure:7589: checking for tclConfig.sh" >&5
74777589
# Let user override test
74787590
if test -z "$TCL_CONFIG_SH"; then
74797591
pgac_test_dirs="$with_tclconfig"
@@ -7506,7 +7618,7 @@ fi
75067618
# Check for Tk configuration script tkConfig.sh
75077619
if test "$with_tk" = yes; then
75087620
echo $ac_n "checking for tkConfig.sh""... $ac_c" 1>&6
7509-
echo "configure:7510: checking for tkConfig.sh" >&5
7621+
echo "configure:7622: checking for tkConfig.sh" >&5
75107622
# Let user override test
75117623
if test -z "$TK_CONFIG_SH"; then
75127624
pgac_test_dirs="$with_tkconfig $with_tclconfig"
@@ -7545,7 +7657,7 @@ do
75457657
# Extract the first word of "$ac_prog", so it can be a program name with args.
75467658
set dummy $ac_prog; ac_word=$2
75477659
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
7548-
echo "configure:7549: checking for $ac_word" >&5
7660+
echo "configure:7661: checking for $ac_word" >&5
75497661
if eval "test \"`echo '$''{'ac_cv_prog_NSGMLS'+set}'`\" = set"; then
75507662
echo $ac_n "(cached) $ac_c" 1>&6
75517663
else
@@ -7581,7 +7693,7 @@ do
75817693
# Extract the first word of "$ac_prog", so it can be a program name with args.
75827694
set dummy $ac_prog; ac_word=$2
75837695
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
7584-
echo "configure:7585: checking for $ac_word" >&5
7696+
echo "configure:7697: checking for $ac_word" >&5
75857697
if eval "test \"`echo '$''{'ac_cv_prog_JADE'+set}'`\" = set"; then
75867698
echo $ac_n "(cached) $ac_c" 1>&6
75877699
else
@@ -7612,7 +7724,7 @@ done
76127724

76137725

76147726
echo $ac_n "checking for DocBook V3.1""... $ac_c" 1>&6
7615-
echo "configure:7616: checking for DocBook V3.1" >&5
7727+
echo "configure:7728: checking for DocBook V3.1" >&5
76167728
if eval "test \"`echo '$''{'pgac_cv_check_docbook'+set}'`\" = set"; then
76177729
echo $ac_n "(cached) $ac_c" 1>&6
76187730
else
@@ -7645,7 +7757,7 @@ have_docbook=$pgac_cv_check_docbook
76457757

76467758

76477759
echo $ac_n "checking for DocBook stylesheets""... $ac_c" 1>&6
7648-
echo "configure:7649: checking for DocBook stylesheets" >&5
7760+
echo "configure:7761: checking for DocBook stylesheets" >&5
76497761
if eval "test \"`echo '$''{'pgac_cv_path_stylesheets'+set}'`\" = set"; then
76507762
echo $ac_n "(cached) $ac_c" 1>&6
76517763
else
@@ -7684,7 +7796,7 @@ do
76847796
# Extract the first word of "$ac_prog", so it can be a program name with args.
76857797
set dummy $ac_prog; ac_word=$2
76867798
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
7687-
echo "configure:7688: checking for $ac_word" >&5
7799+
echo "configure:7800: checking for $ac_word" >&5
76887800
if eval "test \"`echo '$''{'ac_cv_prog_SGMLSPL'+set}'`\" = set"; then
76897801
echo $ac_n "(cached) $ac_c" 1>&6
76907802
else

configure.in

+4
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,10 @@ fi
10721072
AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
10731073

10741074

1075+
AC_CHECK_FUNCS([strtoll strtoq], [break])
1076+
AC_CHECK_FUNCS([strtoull strtouq], [break])
1077+
1078+
10751079
dnl Determine memory alignment requirements for the basic C datatypes.
10761080

10771081
PGAC_CHECK_ALIGNOF(short)

src/include/config.h.in

+19-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.147 2000/11/06 22:18:10 petere Exp $
11+
* $Id: config.h.in,v 1.148 2000/11/20 15:56:13 petere Exp $
1212
*/
1313

1414
#ifndef CONFIG_H
@@ -601,12 +601,29 @@ extern void srandom(unsigned int seed);
601601
/* Define if C++ compiler accepts "#include <string>" */
602602
#undef HAVE_CXX_STRING_HEADER
603603

604-
/* Define if a system lib (-ldl) has dlopen() (needed for AIX) */
604+
/* Define if you have the dlopen function */
605605
#undef HAVE_DLOPEN
606606

607607
/* Define if you have the optreset variable */
608608
#undef HAVE_INT_OPTRESET
609609

610+
#undef HAVE_STRTOLL
611+
#undef HAVE_STRTOQ
612+
613+
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
614+
# define strtoll strtoq
615+
# define HAVE_STRTOLL 1
616+
#endif
617+
618+
#undef HAVE_STRTOULL
619+
#undef HAVE_STRTOUQ
620+
621+
#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
622+
# define strtoull strtouq
623+
# define HAVE_STRTOULL 1
624+
#endif
625+
626+
610627
/*
611628
*------------------------------------------------------------------------
612629
* Part 4: pull in system-specific declarations.

0 commit comments

Comments
 (0)