Branch: master

6716d0df 2019-01-25 07:01:05 OBATA Akio
Convert GETMNTINFO_USES_STATVFS check to CMake

Fix to build on such platforms, it is used but not checked with CMake.
M CMakeLists.txt
M config.h.cmake

CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3291a70..adf408e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -352,6 +352,17 @@
 endif( )
 
 check_function_exists( getmntinfo HAVE_GETMNTINFO )
+if( HAVE_GETMNTINFO )
+  check_cxx_source_compiles("
+    #include <sys/types.h>
+    #include <sys/statvfs.h>
+    int main(){
+      struct statvfs *mntbufp;
+      int flags;
+      return getmntinfo(&mntbufp, flags);
+    }"
+    GETMNTINFO_USES_STATVFS )
+endif( HAVE_GETMNTINFO )
 check_function_exists( getnameinfo HAVE_GETNAMEINFO )
 check_function_exists( getpagesize HAVE_GETPAGESIZE )
 check_function_exists( getpeereid HAVE_GETPEEREID )

config.h.cmake

diff --git a/config.h.cmake b/config.h.cmake
index 900f32b..668ecdb 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -24,7 +24,7 @@
 #undef GETADDRINFO_RETURNS_UNIX
 
 /* getmntinfo() uses struct statvfs */
-#undef GETMNTINFO_USES_STATVFS
+#cmakedefine GETMNTINFO_USES_STATVFS
 
 /* Define if you have the MIT Kerberos libraries */
 #undef GSSAPI_MIT
9e6c8828 2019-01-25 13:20:41 OBATA Akio
Change to define __STDC_LIMIT_MACROS first

<stdint.h> (or other system headers handling the macro) may be included
indirectly from other header files (<sys/types.h> is a reasonable one).
M kimgio/jp2.cpp

kimgio/jp2.cpp

diff --git a/kimgio/jp2.cpp b/kimgio/jp2.cpp
index a8acb10..9ae7d3a 100644
--- a/kimgio/jp2.cpp
+++ b/kimgio/jp2.cpp
@@ -1,18 +1,18 @@
 // This library is distributed under the conditions of the GNU LGPL.
 #include "config.h"
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
 #ifdef HAVE_JASPER
 
 #include "jp2.h"
 
-#ifdef HAVE_STDINT_H
 #if !defined(__STDC_LIMIT_MACROS)
 #define __STDC_LIMIT_MACROS
 #endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_STDINT_H
 #include <stdint.h>
 #endif
 #include <tdetempfile.h>

Branch: r14.0.x

222736b5 2019-01-25 13:22:30 OBATA Akio
Change to define __STDC_LIMIT_MACROS first

<stdint.h> (or other system headers handling the macro) may be included
indirectly from other header files (<sys/types.h> is a reasonable one).

(cherry picked from commit 9e6c88287f250f75fb8bfc72e5e0c9371d73ed1f)
M kimgio/jp2.cpp

kimgio/jp2.cpp

diff --git a/kimgio/jp2.cpp b/kimgio/jp2.cpp
index a8acb10..9ae7d3a 100644
--- a/kimgio/jp2.cpp
+++ b/kimgio/jp2.cpp
@@ -1,18 +1,18 @@
 // This library is distributed under the conditions of the GNU LGPL.
 #include "config.h"
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
 #ifdef HAVE_JASPER
 
 #include "jp2.h"
 
-#ifdef HAVE_STDINT_H
 #if !defined(__STDC_LIMIT_MACROS)
 #define __STDC_LIMIT_MACROS
 #endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_STDINT_H
 #include <stdint.h>
 #endif
 #include <tdetempfile.h>

Branch: v3.5.13-sru

ee4a2949 2019-01-25 13:23:16 OBATA Akio
Change to define __STDC_LIMIT_MACROS first

<stdint.h> (or other system headers handling the macro) may be included
indirectly from other header files (<sys/types.h> is a reasonable one).

(cherry picked from commit 9e6c88287f250f75fb8bfc72e5e0c9371d73ed1f)
M kimgio/jp2.cpp

kimgio/jp2.cpp

diff --git a/kimgio/jp2.cpp b/kimgio/jp2.cpp
index c3c36f2..2be5253 100644
--- a/kimgio/jp2.cpp
+++ b/kimgio/jp2.cpp
@@ -1,18 +1,18 @@
 // This library is distributed under the conditions of the GNU LGPL.
 #include "config.h"
 
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
 #ifdef HAVE_JASPER
 
 #include "jp2.h"
 
-#ifdef HAVE_STDINT_H
 #if !defined(__STDC_LIMIT_MACROS)
 #define __STDC_LIMIT_MACROS
 #endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_STDINT_H
 #include <stdint.h>
 #endif
 #include <ktempfile.h>