aboutsummaryrefslogtreecommitdiffstats
path: root/main/lftp/stdc-limit-macros.patch
blob: 3124fdede86515005fd8e5a8bd70380329895d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/configure.ac b/configure.ac
index 5d52f1a..2f4142d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,6 +127,7 @@ CXX_DYNAMIC_INITIALIZERS
 LFTP_CXX_BOOL
 LFTP_CXX__BOOL
 LFTP_CXX_ANSI_SCOPE
+LFTP_CXX_STDC_LIMIT_MACROS
 
 AC_ISC_POSIX
 
diff --git a/m4/lftp.m4 b/m4/lftp.m4
index 1aae69e..72d594a 100644
--- a/m4/lftp.m4
+++ b/m4/lftp.m4
@@ -311,3 +311,23 @@ AC_DEFUN([LFTP_POSIX_FADVISE_CHECK],[
       AC_DEFINE(HAVE_POSIX_FADVISE, 1, [Define if posix_fadvise() is available])
    fi
 ])
+
+AC_DEFUN([LFTP_CXX_STDC_LIMIT_MACROS],[
+   dnl * Old glibcs requires that __STDC_LIMIT_MACROS is defined for using
+   dnl * stdint.h in c++ mode
+   AC_MSG_CHECKING(whether stdint.h needs __STDC_LIMIT_MACROS in C++ mode)
+   AC_CACHE_VAL(lftp_cv_cxx_stdc_limit_macros,
+   [
+      AC_LANG_PUSH(C++)
+      AC_TRY_COMPILE([
+         #include <stdint.h>
+	 int i = INT_MIN==INT32_MIN && INT_MAX == INT32_MAX;],[],
+	 [lftp_cv_cxx_stdc_limit_macros=no],[lftp_cv_cxx_stdc_limit_macros=yes])
+      AC_LANG_POP(C++)
+   ])
+   AC_MSG_RESULT($lftp_cv_cxx_stdc_limit_macros)
+   if test x$lftp_cv_cxx_stdc_limit_macros = xyes; then
+      AC_DEFINE(__STDC_LIMIT_MACROS, 1, [Use STDC Limit Macros in C++])
+   fi
+])
+