Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
b01f7499
Commit
b01f7499
authored
Jul 01, 2009
by
Uwe Schulzweida
Browse files
change C compiler to ANSI C99
parent
c4c52231
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
b01f7499
2009-??-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.3.1
* using GRIB library version 1.4.0
* change C compiler to ANSI C99
* changed time format from hhmm to hhmmss
* changed encode/decode_time to seconds
* Version 1.4.0 released
...
...
config/default
View file @
b01f7499
...
...
@@ -25,7 +25,7 @@ case "${HOSTNAME}" in
--with-grib_api
=
$HOME
/local
\
--with-netcdf
=
$HOME
/local
\
--with-szlib
=
$HOME
/local
\
CC
=
gcc
CFLAGS
=
"-g -O2 -Wall -W -Wfloat-equal
-ansi
-pedantic"
CFINT
=
-Df2cFortran
CC
=
gcc
CFLAGS
=
"-g -O2 -Wall -W -Wfloat-equal -pedantic"
CFINT
=
-Df2cFortran
;;
gata
)
./configure
--prefix
=
$HOME
/local/etch-ia32
\
...
...
@@ -33,7 +33,7 @@ case "${HOSTNAME}" in
--with-grib_api
=
/scratch/local2/m214003/local
\
--with-netcdf
=
/client
\
--with-szlib
=
$HOME
/local/etch-ia32
\
CC
=
gcc
CFLAGS
=
"-g -O2 -Wall -W -Wfloat-equal
-ansi
-pedantic"
CFINT
=
-Df2cFortran
CC
=
gcc
CFLAGS
=
"-g -O2 -Wall -W -Wfloat-equal -pedantic"
CFINT
=
-Df2cFortran
;;
# sparc-sun-solaris2.8
xxf
)
...
...
configure
View file @
b01f7499
...
...
@@ -2414,201 +2414,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link
=
'$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu
=
$ac_cv_c_compiler_gnu
if
test
-n
"
$ac_tool_prefix
"
;
then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set
dummy
${
ac_tool_prefix
}
gcc
;
ac_word
=
$2
{
echo
"
$as_me
:
$LINENO
: checking for
$ac_word
"
>
&5
echo
$ECHO_N
"checking for
$ac_word
...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ac_cv_prog_CC
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
if
test
-n
"
$CC
"
;
then
ac_cv_prog_CC
=
"
$CC
"
# Let the user override the test.
else
as_save_IFS
=
$IFS
;
IFS
=
$PATH_SEPARATOR
for
as_dir
in
$PATH
do
IFS
=
$as_save_IFS
test
-z
"
$as_dir
"
&&
as_dir
=
.
for
ac_exec_ext
in
''
$ac_executable_extensions
;
do
if
{
test
-f
"
$as_dir
/
$ac_word$ac_exec_ext
"
&&
$as_test_x
"
$as_dir
/
$ac_word$ac_exec_ext
"
;
}
;
then
ac_cv_prog_CC
=
"
${
ac_tool_prefix
}
gcc"
echo
"
$as_me
:
$LINENO
: found
$as_dir
/
$ac_word$ac_exec_ext
"
>
&5
break
2
fi
done
done
IFS
=
$as_save_IFS
fi
fi
CC
=
$ac_cv_prog_CC
if
test
-n
"
$CC
"
;
then
{
echo
"
$as_me
:
$LINENO
: result:
$CC
"
>
&5
echo
"
${
ECHO_T
}
$CC
"
>
&6
;
}
else
{
echo
"
$as_me
:
$LINENO
: result: no"
>
&5
echo
"
${
ECHO_T
}
no"
>
&6
;
}
fi
fi
if
test
-z
"
$ac_cv_prog_CC
"
;
then
ac_ct_CC
=
$CC
# Extract the first word of "gcc", so it can be a program name with args.
set
dummy gcc
;
ac_word
=
$2
{
echo
"
$as_me
:
$LINENO
: checking for
$ac_word
"
>
&5
echo
$ECHO_N
"checking for
$ac_word
...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ac_cv_prog_ac_ct_CC
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
if
test
-n
"
$ac_ct_CC
"
;
then
ac_cv_prog_ac_ct_CC
=
"
$ac_ct_CC
"
# Let the user override the test.
else
as_save_IFS
=
$IFS
;
IFS
=
$PATH_SEPARATOR
for
as_dir
in
$PATH
do
IFS
=
$as_save_IFS
test
-z
"
$as_dir
"
&&
as_dir
=
.
for
ac_exec_ext
in
''
$ac_executable_extensions
;
do
if
{
test
-f
"
$as_dir
/
$ac_word$ac_exec_ext
"
&&
$as_test_x
"
$as_dir
/
$ac_word$ac_exec_ext
"
;
}
;
then
ac_cv_prog_ac_ct_CC
=
"gcc"
echo
"
$as_me
:
$LINENO
: found
$as_dir
/
$ac_word$ac_exec_ext
"
>
&5
break
2
fi
done
done
IFS
=
$as_save_IFS
fi
fi
ac_ct_CC
=
$ac_cv_prog_ac_ct_CC
if
test
-n
"
$ac_ct_CC
"
;
then
{
echo
"
$as_me
:
$LINENO
: result:
$ac_ct_CC
"
>
&5
echo
"
${
ECHO_T
}
$ac_ct_CC
"
>
&6
;
}
else
{
echo
"
$as_me
:
$LINENO
: result: no"
>
&5
echo
"
${
ECHO_T
}
no"
>
&6
;
}
fi
if
test
"x
$ac_ct_CC
"
=
x
;
then
CC
=
""
else
case
$cross_compiling
:
$ac_tool_warned
in
yes
:
)
{
echo
"
$as_me
:
$LINENO
: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org."
>
&5
echo
"
$as_me
: WARNING: In the future, Autoconf will not detect cross-tools
whose name does not start with the host triplet. If you think this
configuration is useful to you, please write to autoconf@gnu.org."
>
&2
;
}
ac_tool_warned
=
yes
;;
esac
CC
=
$ac_ct_CC
fi
else
CC
=
"
$ac_cv_prog_CC
"
fi
if
test
-z
"
$CC
"
;
then
if
test
-n
"
$ac_tool_prefix
"
;
then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set
dummy
${
ac_tool_prefix
}
cc
;
ac_word
=
$2
{
echo
"
$as_me
:
$LINENO
: checking for
$ac_word
"
>
&5
echo
$ECHO_N
"checking for
$ac_word
...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ac_cv_prog_CC
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
if
test
-n
"
$CC
"
;
then
ac_cv_prog_CC
=
"
$CC
"
# Let the user override the test.
else
as_save_IFS
=
$IFS
;
IFS
=
$PATH_SEPARATOR
for
as_dir
in
$PATH
do
IFS
=
$as_save_IFS
test
-z
"
$as_dir
"
&&
as_dir
=
.
for
ac_exec_ext
in
''
$ac_executable_extensions
;
do
if
{
test
-f
"
$as_dir
/
$ac_word$ac_exec_ext
"
&&
$as_test_x
"
$as_dir
/
$ac_word$ac_exec_ext
"
;
}
;
then
ac_cv_prog_CC
=
"
${
ac_tool_prefix
}
cc"
echo
"
$as_me
:
$LINENO
: found
$as_dir
/
$ac_word$ac_exec_ext
"
>
&5
break
2
fi
done
done
IFS
=
$as_save_IFS
fi
fi
CC
=
$ac_cv_prog_CC
if
test
-n
"
$CC
"
;
then
{
echo
"
$as_me
:
$LINENO
: result:
$CC
"
>
&5
echo
"
${
ECHO_T
}
$CC
"
>
&6
;
}
else
{
echo
"
$as_me
:
$LINENO
: result: no"
>
&5
echo
"
${
ECHO_T
}
no"
>
&6
;
}
fi
fi
fi
if
test
-z
"
$CC
"
;
then
# Extract the first word of "cc", so it can be a program name with args.
set
dummy cc
;
ac_word
=
$2
{
echo
"
$as_me
:
$LINENO
: checking for
$ac_word
"
>
&5
echo
$ECHO_N
"checking for
$ac_word
...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ac_cv_prog_CC
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
if
test
-n
"
$CC
"
;
then
ac_cv_prog_CC
=
"
$CC
"
# Let the user override the test.
else
ac_prog_rejected
=
no
as_save_IFS
=
$IFS
;
IFS
=
$PATH_SEPARATOR
for
as_dir
in
$PATH
do
IFS
=
$as_save_IFS
test
-z
"
$as_dir
"
&&
as_dir
=
.
for
ac_exec_ext
in
''
$ac_executable_extensions
;
do
if
{
test
-f
"
$as_dir
/
$ac_word$ac_exec_ext
"
&&
$as_test_x
"
$as_dir
/
$ac_word$ac_exec_ext
"
;
}
;
then
if
test
"
$as_dir
/
$ac_word$ac_exec_ext
"
=
"/usr/ucb/cc"
;
then
ac_prog_rejected
=
yes
continue
fi
ac_cv_prog_CC
=
"cc"
echo
"
$as_me
:
$LINENO
: found
$as_dir
/
$ac_word$ac_exec_ext
"
>
&5
break
2
fi
done
done
IFS
=
$as_save_IFS
if
test
$ac_prog_rejected
=
yes
;
then
# We found a bogon in the path, so make sure we never use it.
set
dummy
$ac_cv_prog_CC
shift
if
test
$#
!=
0
;
then
# We chose a different compiler from the bogus one.
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
ac_cv_prog_CC
=
"
$as_dir
/
$ac_word
${
1
+
' '
}
$@
"
fi
fi
fi
fi
CC
=
$ac_cv_prog_CC
if
test
-n
"
$CC
"
;
then
{
echo
"
$as_me
:
$LINENO
: result:
$CC
"
>
&5
echo
"
${
ECHO_T
}
$CC
"
>
&6
;
}
else
{
echo
"
$as_me
:
$LINENO
: result: no"
>
&5
echo
"
${
ECHO_T
}
no"
>
&6
;
}
fi
fi
if
test
-z
"
$CC
"
;
then
if
test
-n
"
$ac_tool_prefix
"
;
then
for
ac_prog
in
cl.exe
for
ac_prog
in
gcc c99
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set
dummy
$ac_tool_prefix$ac_prog
;
ac_word
=
$2
...
...
@@ -2652,7 +2458,7 @@ fi
fi
if
test
-z
"
$CC
"
;
then
ac_ct_CC
=
$CC
for
ac_prog
in
cl.exe
for
ac_prog
in
gcc c99
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set
dummy
$ac_prog
;
ac_word
=
$2
...
...
@@ -2711,8 +2517,6 @@ esac
fi
fi
fi
test
-z
"
$CC
"
&&
{
{
echo
"
$as_me
:
$LINENO
: error: no acceptable C compiler found in
\$
PATH
See
\`
config.log' for more details."
>
&5
...
...
@@ -3497,6 +3301,207 @@ else
fi
{
echo
"
$as_me
:
$LINENO
: checking for
$CC
option to accept ISO C99"
>
&5
echo
$ECHO_N
"checking for
$CC
option to accept ISO C99...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ac_cv_prog_cc_c99
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
ac_cv_prog_cc_c99
=
no
ac_save_CC
=
$CC
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wchar.h>
#include <stdio.h>
// Check varargs macros. These examples are taken from C99 6.10.3.5.
#define debug(...) fprintf (stderr, __VA_ARGS__)
#define showlist(...) puts (#__VA_ARGS__)
#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
static void
test_varargs_macros (void)
{
int x = 1234;
int y = 5678;
debug ("Flag");
debug ("X = %d
\n
", x);
showlist (The first, second, and third items.);
report (x>y, "x is %d but y is %d", x, y);
}
// Check long long types.
#define BIG64 18446744073709551615ull
#define BIG32 4294967295ul
#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
#if !BIG_OK
your preprocessor is broken;
#endif
#if BIG_OK
#else
your preprocessor is broken;
#endif
static long long int bignum = -9223372036854775807LL;
static unsigned long long int ubignum = BIG64;
struct incomplete_array
{
int datasize;
double data[];
};
struct named_init {
int number;
const wchar_t *name;
double average;
};
typedef const char *ccp;
static inline int
test_restrict (ccp restrict text)
{
// See if C++-style comments work.
// Iterate through items via the restricted pointer.
// Also check for declarations in for loops.
for (unsigned int i = 0; *(text+i) != '
\0
'; ++i)
continue;
return 0;
}
// Check varargs and va_copy.
static void
test_varargs (const char *format, ...)
{
va_list args;
va_start (args, format);
va_list args_copy;
va_copy (args_copy, args);
const char *str;
int number;
float fnumber;
while (*format)
{
switch (*format++)
{
case 's': // string
str = va_arg (args_copy, const char *);
break;
case 'd': // int
number = va_arg (args_copy, int);
break;
case 'f': // float
fnumber = va_arg (args_copy, double);
break;
default:
break;
}
}
va_end (args_copy);
va_end (args);
}
int
main ()
{
// Check bool.
_Bool success = false;
// Check restrict.
if (test_restrict ("String literal") == 0)
success = true;
char *restrict newvar = "Another string";
// Check varargs.
test_varargs ("s, d' f .", "string", 65, 34.234);
test_varargs_macros ();
// Check flexible array members.
struct incomplete_array *ia =
malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
ia->datasize = 10;
for (int i = 0; i < ia->datasize; ++i)
ia->data[i] = i * 1.234;
// Check named initializers.
struct named_init ni = {
.number = 34,
.name = L"Test wide string",
.average = 543.34343,
};
ni.number = 58;
int dynamic_array[ni.number];
dynamic_array[ni.number - 1] = 543;
// work around unused variable warnings
return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
|| dynamic_array[ni.number - 1] != 543);
;
return 0;
}
_ACEOF
for
ac_arg
in
''
-std
=
gnu99
-c99
-qlanglvl
=
extc99
do
CC
=
"
$ac_save_CC
$ac_arg
"
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
"echo
\"\$
as_me:
$LINENO
:
$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
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
ac_cv_prog_cc_c99
=
$ac_arg
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
fi
rm
-f
core conftest.err conftest.
$ac_objext
test
"x
$ac_cv_prog_cc_c99
"
!=
"xno"
&&
break
done
rm
-f
conftest.
$ac_ext
CC
=
$ac_save_CC
fi
# AC_CACHE_VAL
case
"x
$ac_cv_prog_cc_c99
"
in
x
)
{
echo
"
$as_me
:
$LINENO
: result: none needed"
>
&5
echo
"
${
ECHO_T
}
none needed"
>
&6
;
}
;;
xno
)
{
echo
"
$as_me
:
$LINENO
: result: unsupported"
>
&5
echo
"
${
ECHO_T
}
unsupported"
>
&6
;
}
;;
*
)
CC
=
"
$CC
$ac_cv_prog_cc_c99
"
{
echo
"
$as_me
:
$LINENO
: result:
$ac_cv_prog_cc_c99
"
>
&5
echo
"
${
ECHO_T
}
$ac_cv_prog_cc_c99
"
>
&6
;
}
;;
esac
ac_ext
=
f
ac_compile
=
'$F77 -c $FFLAGS conftest.$ac_ext >&5'
ac_link
=
'$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
...
...
@@ -8437,6 +8442,17 @@ if test "$no_create" != yes; then
fi
if
test
"
$ac_cv_prog_cc_c99
"
=
"no"
;
then
{
echo
"
$as_me
:
$LINENO
:
Warning: The C compiler does not accept ANSI C99 source code!
"
>
&5
echo
"
$as_me
:
Warning: The C compiler does not accept ANSI C99 source code!
"
>
&6
;
}
fi
{
echo
"
$as_me
:
$LINENO
:
Configuration completed.
...
...
configure.ac
View file @
b01f7499
...
...
@@ -16,7 +16,8 @@ AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CC
AC_PROG_CC([gcc c99])
AC_PROG_CC_C99
AC_PROG_F77
AC_PROG_RANLIB
AC_PROG_INSTALL
...
...
@@ -321,6 +322,13 @@ AC_SUBST([AR])
AC_OUTPUT(Makefile src/Makefile app/Makefile tests/Makefile examples/Makefile)
if test "$ac_cv_prog_cc_c99" = "no" ; then
AC_MSG_NOTICE([
Warning: The C compiler does not accept ANSI C99 source code!
])
fi
AC_MSG_NOTICE([
Configuration completed.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment