CheckStructMember to check for dirent.d_ino
authorPierre Habouzit <madcoder@debian.org>
Thu, 17 May 2007 20:41:40 +0000 (22:41 +0200)
committerPierre Habouzit <madcoder@debian.org>
Thu, 17 May 2007 20:41:40 +0000 (22:41 +0200)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
CMakeLists.txt
cmake/CheckStructMember.cmake [new file with mode: 0644]
config.h.cmake
lib-mx/mh.c
nntp/nntp.c

index 25ded1b..1fb93bc 100644 (file)
@@ -94,6 +94,13 @@ IF(NOT HAVE_ICONV_H)
     MESSAGE(FATAL_ERROR "inconv.h not found")
 ENDIF(NOT HAVE_ICONV_H)
 
     MESSAGE(FATAL_ERROR "inconv.h not found")
 ENDIF(NOT HAVE_ICONV_H)
 
+# }}}
+# types {{{
+
+INCLUDE(CheckStructMember)
+
+CHECK_STRUCT_MEMBER("struct dirent" "d_ino" "dirent.h" HAVE_DIRENT_D_INO)
+
 # }}}
 # functions {{{
 INCLUDE (CheckFunctionExists)
 # }}}
 # functions {{{
 INCLUDE (CheckFunctionExists)
diff --git a/cmake/CheckStructMember.cmake b/cmake/CheckStructMember.cmake
new file mode 100644 (file)
index 0000000..8419e84
--- /dev/null
@@ -0,0 +1,41 @@
+# - Check if the given struct or class has the specified member variable
+# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+#
+#  STRUCT - the name of the struct or class you are interested in
+#  MEMBER - the member which existence you want to check
+#  HEADER - the header(s) where the prototype should be declared
+#  VARIABLE - variable to store the result
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckCSourceCompiles)
+
+MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
+   SET(_INCLUDE_FILES)
+   FOREACH (it ${_HEADER})
+      SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+   ENDFOREACH (it)
+
+   SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
+${_INCLUDE_FILES}
+int main()
+{
+   ${_STRUCT} tmp;
+   tmp.${_MEMBER};
+   return 0;
+}
+")
+   CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+
+ENDMACRO (CHECK_STRUCT_MEMBER)
index 47b628a..3166c76 100644 (file)
@@ -1,21 +1,11 @@
-#cmakedefine SENDMAIL "${SENDMAIL}/sendmail"
-#cmakedefine MIXMASTER "${MIXMASTER}/mixmaster"
+#cmakedefine MAILPATH    "${MAILPATH}"
+#cmakedefine SENDMAIL    "${SENDMAIL}/sendmail"
+#cmakedefine MIXMASTER   "${MIXMASTER}/mixmaster"
 #ifndef MIXMASTER
 #ifndef MIXMASTER
-#define MIXMASTER "mixmaster"
+#define MIXMASTER        "mixmaster"
 #endif
 
 #endif
 
-#cmakedefine MAILPATH "${MAILPATH}"
-
-#cmakedefine HAVE_LIBIDN             1
-#cmakedefine HAVE_QDBM               1
-#cmakedefine HAVE_GDBM               1
-#cmakedefine USE_FLOCK               1
-#cmakedefine USE_FCNTL               1
-#cmakedefine USE_HCACHE              1
-#cmakedefine USE_NNTP                1
-#cmakedefine USE_LIBESMTP            1
-#cmakedefine USE_SLANG_CURSES        1
-
+/* headers */
 #cmakedefine HAVE_ALLOCA_H           1
 #cmakedefine HAVE_ARGZ_H             1
 #cmakedefine HAVE_GETOPT_H           1
 #cmakedefine HAVE_ALLOCA_H           1
 #cmakedefine HAVE_ARGZ_H             1
 #cmakedefine HAVE_GETOPT_H           1
 #cmakedefine HAVE_WCHAR_H            1
 #cmakedefine HAVE_WCTYPE_H           1
 
 #cmakedefine HAVE_WCHAR_H            1
 #cmakedefine HAVE_WCTYPE_H           1
 
+/* type */
+#cmakedefine HAVE_DIRENT_D_INO       1
+
+/* functions */
 #cmakedefine HAVE_GETSID             1
 #cmakedefine HAVE_ISCTYPE            1
 #cmakedefine HAVE_GETOPT             1
 #cmakedefine HAVE_GETSID             1
 #cmakedefine HAVE_ISCTYPE            1
 #cmakedefine HAVE_GETOPT             1
 #cmakedefine HAVE_META               1
 #cmakedefine HAVE_USE_DEFAULT_COLORS 1
 #cmakedefine HAVE_RESIZETERM         1
 #cmakedefine HAVE_META               1
 #cmakedefine HAVE_USE_DEFAULT_COLORS 1
 #cmakedefine HAVE_RESIZETERM         1
+
+/* libraries */
+#cmakedefine HAVE_LIBIDN             1
+#cmakedefine HAVE_QDBM               1
+#cmakedefine HAVE_GDBM               1
+#cmakedefine USE_FLOCK               1
+#cmakedefine USE_FCNTL               1
+#cmakedefine USE_HCACHE              1
+#cmakedefine USE_NNTP                1
+#cmakedefine USE_LIBESMTP            1
+#cmakedefine USE_SLANG_CURSES        1
+
index 89ae790..f0a1484 100644 (file)
@@ -656,7 +656,7 @@ static int maildir_parse_dir (CONTEXT * ctx, struct maildir ***last,
     /* FOO - really ignore the return value? */
 
     maildir_parse_entry (ctx, last, subdir, de->d_name, count, is_old,
     /* FOO - really ignore the return value? */
 
     maildir_parse_entry (ctx, last, subdir, de->d_name, count, is_old,
-#if HAVE_DIRENT_D_INO
+#ifdef HAVE_DIRENT_D_INO
                          de->d_ino
 #else
                          0
                          de->d_ino
 #else
                          0
index 69dcf0d..f5e7132 100644 (file)
@@ -299,8 +299,9 @@ static int mutt_nntp_query (NNTP_DATA * data, char *line, size_t linelen)
  * -2 - invalid command or execution error,
  * -3 - error in funct(*line, *data).
  */
  * -2 - invalid command or execution error,
  * -3 - error in funct(*line, *data).
  */
-static int mutt_nntp_fetch (NNTP_DATA * nntp_data, const char *query, char *msg,
-                            progress_t* bar, int (*funct) (char *, void *),
+static int mutt_nntp_fetch (NNTP_DATA * nntp_data, const char *query,
+                            const char *msg, progress_t* bar,
+                            int (*funct) (char *, void *),
                             void *data, int tagged)
 {
   char buf[LONG_STRING];
                             void *data, int tagged)
 {
   char buf[LONG_STRING];