Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
61 lines
1.7 KiB
Diff
61 lines
1.7 KiB
Diff
Avoid implicit ints and implicit function declarations, to prevent
|
|
build failures with future compilers.
|
|
|
|
It's not clear if old compilers really use <stdio.h> for the exit
|
|
function. Most of these checks would be better served by using
|
|
#error, so that they can use AC_TRY_LINK and be compatible with
|
|
cross-compilation.
|
|
|
|
Submitted upstream:
|
|
|
|
<https://lists.ibr.cs.tu-bs.de/hyperkitty/list/libsmi@ibr.cs.tu-bs.de/thread/MI6XPAR7JE2AY6UZIMXA3Q7JGD635JRR/>
|
|
|
|
diff --git a/configure.in b/configure.in
|
|
index 9b678e2d915a789d..c032538163bd05ab 100644
|
|
--- a/configure.in
|
|
+++ b/configure.in
|
|
@@ -42,8 +42,8 @@ AC_ARG_WITH(cc,
|
|
CC="$withval")
|
|
|
|
AC_MSG_CHECKING([for additional required compiler flags])
|
|
-AC_TRY_RUN([#include <stdio.h>
|
|
- main() {
|
|
+AC_TRY_RUN([#include <stdlib.h>
|
|
+ int main(void) {
|
|
#ifdef __SUNPRO_C
|
|
exit(0);
|
|
#else
|
|
@@ -100,8 +100,8 @@ dirseparator="$withval", dirseparator="")
|
|
|
|
AC_MSG_CHECKING([for path separator character])
|
|
if test "$pathseparator" = "" ; then
|
|
- AC_TRY_RUN([#include <stdio.h>
|
|
- main() {
|
|
+ AC_TRY_RUN([#include <stdlib.h>
|
|
+ int main(void) {
|
|
#ifdef _WIN32
|
|
exit(0);
|
|
#else
|
|
@@ -114,8 +114,8 @@ echo $pathseparator
|
|
|
|
AC_MSG_CHECKING([for dir separator character])
|
|
if test "$dirseparator" = "" ; then
|
|
- AC_TRY_RUN([#include <stdio.h>
|
|
- main() {
|
|
+ AC_TRY_RUN([#include <stdlib.h>
|
|
+ int main(void) {
|
|
#ifdef _WIN32
|
|
exit(0);
|
|
#else
|
|
@@ -140,8 +140,8 @@ AC_MSG_CHECKING([for 64 bit types])
|
|
# "warning: decimal constant is so large that it is unsigned"
|
|
# if used with the (correct) value -9223372036854775808LL.
|
|
#
|
|
-AC_TRY_RUN([#include <stdio.h>
|
|
- main() {
|
|
+AC_TRY_RUN([#include <stdlib.h>
|
|
+ int main(void) {
|
|
long long ll;
|
|
unsigned long long ull;
|
|
exit(0);
|