git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 08/11] cmake: added checks for struct stat and libiconv

From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date
May 14, 2020, 15:31 UTC
Message-ID
<20200514153140.GB1939@danh.dev>
In-Reply-To
<f496cd7d8aa12047db7f6c0212fbcb2497469785.1589302255.git.gitgitgadget@gmail.com>
On 2020-05-12 16:50:51+0000, Sibi Siddharthan via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 6 quoted lines
> From: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
> 
> The CMake script now checks whether st_blocks is a member of struct stat
> and set the compile definition NO_ST_BLOCKS_IN_STRUCT_STAT accordingly.
> 
> The check for whether ICONV_OMITS_BOM is also added as requested by Danh.
Please don't write my name in the commit message like this.
This maybe rephased to:
	
	While we're as it, add the check for ICONV_OMITS_BOM.
Show 91 quoted lines
> Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
> ---
>  CMakeLists.txt | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 57 insertions(+), 2 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 4353080b708..975791c8b89 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -22,6 +22,7 @@ project(git
>  include(CheckTypeSize)
>  include(CheckCSourceRuns)
>  include(CheckCSourceCompiles)
> +include(CheckCSourceRuns)
>  include(CheckIncludeFile)
>  include(CheckFunctionExists)
>  include(CheckSymbolExists)
> @@ -128,7 +129,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
>  	include_directories(compat/win32)
>  	add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32
>  				_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe"  NO_SYMLINK_HEAD UNRELIABLE_FSTAT
> -				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0 NO_ST_BLOCKS_IN_STRUCT_STAT
> +				NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
>  				USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
>  				UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET)
>  	list(APPEND compat_SOURCES compat/mingw.c compat/winansi.c compat/win32/path-utils.c
> @@ -280,6 +281,11 @@ if(HAVE_CLOCK_MONOTONIC)
>  	add_compile_definitions(HAVE_CLOCK_MONOTONIC)
>  endif()
>  
> +#check for st_blocks in struct stat
> +check_struct_has_member("struct stat" st_blocks "sys/stat.h" STRUCT_STAT_HAS_ST_BLOCKS)
> +if(NOT STRUCT_STAT_HAS_ST_BLOCKS)
> +	add_compile_definitions(NO_ST_BLOCKS_IN_STRUCT_STAT)
> +endif()
>  
>  #compile checks
>  check_c_source_runs("
> @@ -344,7 +350,6 @@ if(NOT HAVE_REGEX)
>  	add_compile_definitions(NO_REGEX NO_MBSUPPORT GAWK)
>  endif()
>  
> -
>  check_c_source_compiles("
>  #include <stddef.h>
>  #include <sys/types.h>
> @@ -368,6 +373,56 @@ if(HAVE_BSD_SYSCTL)
>  	add_compile_definitions(HAVE_BSD_SYSCTL)
>  endif()
>  
> +set(CMAKE_REQUIRED_LIBRARIES ${Iconv_LIBRARIES})
> +set(CMAKE_REQUIRED_INCLUDES ${Iconv_INCLUDE_DIRS})
> +
> +check_c_source_compiles("
> +#include <iconv.h>
> +
> +extern size_t iconv(iconv_t cd,
> +		char **inbuf, size_t *inbytesleft,
> +		char **outbuf, size_t *outbytesleft);
> +
> +int main(){return 0;}"
> +HAVE_NEW_ICONV)
> +if(HAVE_NEW_ICONV)
> +	set(HAVE_OLD_ICONV 0)
> +else()
> +	set(HAVE_OLD_ICONV 1)
> +endif()
> +
> +check_c_source_runs("
> +#include <iconv.h>
> +#if ${HAVE_OLD_ICONV}
> +typedef const char *iconv_ibp;
> +#else
> +typedef char *iconv_ibp;
> +#endif
> +
> +int main()
> +{
> +	int v;
> +	iconv_t conv;
> +	char in[] = \"a\"; iconv_ibp pin = in;
> +	char out[20] = \"\"; char *pout = out;
> +	size_t isz = sizeof in;
> +	size_t osz = sizeof out;
> +
> +	conv = iconv_open(\"UTF-16\", \"UTF-8\");
> +	iconv(conv, &pin, &isz, &pout, &osz);
> +	iconv_close(conv);
> +	v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
> +	return v != 0xfe + 0xff;
> +}"

I think the closing double-quote should be placed in a newline, in order to make sure the source file ended with newline, old C standard requires final newline.

-- 
Danh
Previous: Junio C HamanoNext: Sibi Siddharthan
Message 103 of 179 in “CMake build system for git”
  1. 0/8 CMake build system for gitSibi Siddharthan via GitGitGadget, Apr 24, 2020
  2. 2/8 cmake: generate the shell/perl/python scripts and templates, translationsSibi Siddharthan via GitGitGadget, Apr 24, 2020
  3. Danh DoanApr 24, 2020
  4. Sibi SiddharthanApr 24, 2020
  5. 3/8 cmake: installation support for gitSibi Siddharthan via GitGitGadget, Apr 24, 2020
  6. Danh DoanApr 24, 2020
  7. Sibi SiddharthanApr 24, 2020
  8. 1/8 Introduce CMake support for configuring Git on LinuxSibi Siddharthan via GitGitGadget, Apr 24, 2020
  9. Danh DoanApr 24, 2020
  10. Sibi SiddharthanApr 24, 2020
  11. Danh DoanApr 24, 2020
  12. Sibi SiddharthanApr 25, 2020
  13. Johannes SchindelinApr 25, 2020
  14. brian m. carlsonApr 25, 2020
  15. Randall S. BeckerApr 25, 2020
  16. Philip OakleyApr 25, 2020
  17. Sibi SiddharthanApr 25, 2020
  18. 5/8 cmake: support for testing git when building out of the source treeSibi Siddharthan via GitGitGadget, Apr 24, 2020
  19. Danh DoanApr 24, 2020
  20. Sibi SiddharthanApr 24, 2020
  21. Danh DoanApr 24, 2020
  22. Sibi SiddharthanApr 25, 2020
  23. 7/8 cmake: support for building git on windows with msvc and clang.Sibi Siddharthan via GitGitGadget, Apr 24, 2020
  24. Danh DoanApr 24, 2020
  25. Sibi SiddharthanApr 24, 2020
  26. 4/8 cmake: support for testing git with ctestSibi Siddharthan via GitGitGadget, Apr 24, 2020
  27. Danh DoanApr 24, 2020
  28. Sibi SiddharthanApr 24, 2020
  29. 8/8 ci: modification of main.yml to use cmake for vs-build jobSibi Siddharthan via GitGitGadget, Apr 24, 2020
  30. Danh DoanApr 24, 2020
  31. Sibi SiddharthanApr 24, 2020
  32. Johannes SchindelinApr 24, 2020
  33. 6/8 cmake: support for building git on windows with mingwSibi Siddharthan via GitGitGadget, Apr 24, 2020
  34. Philip OakleyApr 24, 2020
  35. Sibi SiddharthanApr 24, 2020
  36. Philip OakleyApr 25, 2020
  37. Sibi SiddharthanApr 25, 2020
  38. Junio C HamanoApr 24, 2020
  39. Sibi SiddharthanApr 24, 2020
  40. Junio C HamanoApr 24, 2020
  41. Sibi SiddharthanApr 25, 2020
  42. Philip OakleyApr 25, 2020
  43. Johannes SchindelinApr 25, 2020
  44. Sibi SiddharthanApr 25, 2020
  45. Johannes SchindelinApr 25, 2020
  46. Sibi SiddharthanApr 25, 2020
  47. Johannes SchindelinApr 25, 2020
  48. Sibi SiddharthanApr 25, 2020
  49. Danh DoanApr 26, 2020
  50. Sibi SiddharthanApr 26, 2020
  51. Johannes SchindelinApr 25, 2020
  52. Jeff KingApr 27, 2020
  53. Jeff KingApr 27, 2020
  54. Danh DoanApr 28, 2020
  55. Jeff KingApr 28, 2020
  56. Sibi SiddharthanApr 29, 2020
  57. Johannes SchindelinMay 1, 2020
  58. Sibi SiddharthanMay 2, 2020
  59. Randall S. BeckerMay 2, 2020
  60. Junio C HamanoMay 2, 2020
  61. Sibi SiddharthanMay 3, 2020
  62. Junio C HamanoMay 3, 2020
  63. Konstantin TokarevMay 3, 2020
  64. Junio C HamanoMay 3, 2020
  65. Johannes SchindelinMay 4, 2020
  66. Konstantin TokarevMay 4, 2020
  67. Sibi SiddharthanMay 5, 2020
  68. Junio C HamanoMay 5, 2020
  69. Sibi SiddharthanMay 5, 2020
  70. Junio C HamanoMay 5, 2020
  71. Sibi SiddharthanMay 6, 2020
  72. Đoàn Trần Công DanhMay 7, 2020
  73. Johannes SchindelinMay 6, 2020
  74. Johannes SchindelinMay 7, 2020
  75. Danh DoanMay 2, 2020
  76. Sibi SiddharthanMay 2, 2020
  77. Danh DoanMay 2, 2020
  78. Sibi SiddharthanMay 2, 2020
  79. Junio C HamanoApr 27, 2020
  80. Michal SuchánekApr 27, 2020
  81. Jeff KingApr 27, 2020
  82. Elijah NewrenApr 27, 2020
  83. Junio C HamanoApr 27, 2020
  84. Jeff KingApr 28, 2020
  85. 00/11 CMake build system for gitSibi Siddharthan via GitGitGadget, May 12, 2020
  86. 02/11 cmake: generate the shell/perl/python scripts and templates, translationsSibi Siddharthan via GitGitGadget, May 12, 2020
  87. Junio C HamanoMay 12, 2020
  88. Sibi SiddharthanMay 13, 2020
  89. 01/11 Introduce CMake support for configuring Git on LinuxSibi Siddharthan via GitGitGadget, May 12, 2020
  90. Junio C HamanoMay 12, 2020
  91. Sibi SiddharthanMay 13, 2020
  92. 05/11 cmake: support for testing git when building out of the source treeSibi Siddharthan via GitGitGadget, May 12, 2020
  93. 03/11 cmake: installation support for gitSibi Siddharthan via GitGitGadget, May 12, 2020
  94. 06/11 cmake: support for building git on windows with mingwSibi Siddharthan via GitGitGadget, May 12, 2020
  95. Đoàn Trần Công DanhMay 14, 2020
  96. Sibi SiddharthanMay 14, 2020
  97. 04/11 cmake: support for testing git with ctestSibi Siddharthan via GitGitGadget, May 12, 2020
  98. 07/11 cmake: support for building git on windows with msvc and clang.Sibi Siddharthan via GitGitGadget, May 12, 2020
  99. 08/11 cmake: added checks for struct stat and libiconvSibi Siddharthan via GitGitGadget, May 12, 2020
  100. Junio C HamanoMay 12, 2020
  101. Sibi SiddharthanMay 13, 2020
  102. Junio C HamanoMay 14, 2020
  103. Đoàn Trần Công DanhMay 14, 2020
  104. Sibi SiddharthanMay 14, 2020
  105. 11/11 ci: modification of main.yml to use cmake for vs-build jobSibi Siddharthan via GitGitGadget, May 12, 2020
  106. Junio C HamanoMay 12, 2020
  107. Sibi SiddharthanMay 13, 2020
  108. Sibi SiddharthanMay 25, 2020
  109. Junio C HamanoMay 25, 2020
  110. Sibi SiddharthanMay 25, 2020
  111. Johannes SchindelinMay 25, 2020
  112. 10/11 cmake: parse the makefile for the sources.Sibi Siddharthan via GitGitGadget, May 12, 2020
  113. Junio C HamanoMay 12, 2020
  114. Sibi SiddharthanMay 13, 2020
  115. Junio C HamanoMay 13, 2020
  116. 09/11 cmake: relocated script file contrib/buildsystemsSibi Siddharthan via GitGitGadget, May 12, 2020
  117. Junio C HamanoMay 12, 2020
  118. Sibi SiddharthanMay 13, 2020
  119. 0/8 CMake build system for gitSibi Siddharthan via GitGitGadget, May 29, 2020
  120. 1/8 Introduce CMake support for configuring GitSibi Siddharthan via GitGitGadget, May 29, 2020
  121. Junio C HamanoMay 29, 2020
  122. Sibi SiddharthanMay 30, 2020
  123. Junio C HamanoMay 31, 2020
  124. Johannes SchindelinMay 30, 2020
  125. Đoàn Trần Công DanhMay 30, 2020
  126. 3/8 cmake: installation support for gitSibi Siddharthan via GitGitGadget, May 29, 2020
  127. 2/8 cmake: generate the shell/perl/python scripts and templates, translationsSibi Siddharthan via GitGitGadget, May 29, 2020
  128. Junio C HamanoMay 29, 2020
  129. Sibi SiddharthanMay 30, 2020
  130. Sibi SiddharthanJun 8, 2020
  131. Junio C HamanoJun 8, 2020
  132. 4/8 cmake: support for testing git with ctestSibi Siddharthan via GitGitGadget, May 29, 2020
  133. Đoàn Trần Công DanhMay 30, 2020
  134. Sibi SiddharthanMay 30, 2020
  135. Đoàn Trần Công DanhMay 31, 2020
  136. 6/8 cmake: support for building git on windows with mingwSibi Siddharthan via GitGitGadget, May 29, 2020
  137. 5/8 cmake: support for testing git when building out of the source treeSibi Siddharthan via GitGitGadget, May 29, 2020
  138. 7/8 cmake: support for building git on windows with msvc and clang.Sibi Siddharthan via GitGitGadget, May 29, 2020
  139. Đoàn Trần Công DanhMay 30, 2020
  140. Sibi SiddharthanMay 30, 2020
  141. 8/8 ci: modification of main.yml to use cmake for vs-build jobSibi Siddharthan via GitGitGadget, May 29, 2020
  142. Đoàn Trần Công DanhMay 30, 2020
  143. Sibi SiddharthanMay 30, 2020
  144. 0/8 CMake build system for gitSibi Siddharthan via GitGitGadget, Jun 12, 2020
  145. 3/8 cmake: installation support for gitSibi Siddharthan via GitGitGadget, Jun 12, 2020
  146. 1/8 Introduce CMake support for configuring GitSibi Siddharthan via GitGitGadget, Jun 12, 2020
  147. Øystein WalleJun 15, 2020
  148. Sibi SiddharthanJun 15, 2020
  149. 4/8 cmake: support for testing git with ctestSibi Siddharthan via GitGitGadget, Jun 12, 2020
  150. Øystein WalleJun 15, 2020
  151. Sibi SiddharthanJun 15, 2020
  152. 2/8 cmake: generate the shell/perl/python scripts and templates, translationsSibi Siddharthan via GitGitGadget, Jun 12, 2020
  153. 5/8 cmake: support for testing git when building out of the source treeSibi Siddharthan via GitGitGadget, Jun 12, 2020
  154. 7/8 cmake: support for building git on windows with msvc and clang.Sibi Siddharthan via GitGitGadget, Jun 12, 2020
  155. Øystein WalleJun 15, 2020
  156. Sibi SiddharthanJun 15, 2020
  157. 6/8 cmake: support for building git on windows with mingwSibi Siddharthan via GitGitGadget, Jun 12, 2020
  158. Øystein WalleJun 15, 2020
  159. Sibi SiddharthanJun 15, 2020
  160. Junio C HamanoJun 18, 2020
  161. Sibi SiddharthanJun 18, 2020
  162. Junio C HamanoJun 18, 2020
  163. Sibi SiddharthanJun 18, 2020
  164. Junio C HamanoJun 18, 2020
  165. Sibi SiddharthanJun 19, 2020
  166. Junio C HamanoJun 19, 2020
  167. 8/8 ci: modification of main.yml to use cmake for vs-build jobSibi Siddharthan via GitGitGadget, Jun 12, 2020
  168. 0/8 CMake build system for gitSibi Siddharthan via GitGitGadget, Jun 26, 2020
  169. 1/8 Introduce CMake support for configuring GitSibi Siddharthan via GitGitGadget, Jun 26, 2020
  170. 3/8 cmake: installation support for gitSibi Siddharthan via GitGitGadget, Jun 26, 2020
  171. 7/8 cmake: support for building git on windows with msvc and clang.Sibi Siddharthan via GitGitGadget, Jun 26, 2020
  172. 6/8 cmake: support for building git on windows with mingwSibi Siddharthan via GitGitGadget, Jun 26, 2020
  173. David AguilarJun 30, 2020
  174. Sibi SiddharthanJul 1, 2020
  175. Sibi SiddharthanJul 1, 2020
  176. 2/8 cmake: generate the shell/perl/python scripts and templates, translationsSibi Siddharthan via GitGitGadget, Jun 26, 2020
  177. 8/8 ci: modification of main.yml to use cmake for vs-build jobSibi Siddharthan via GitGitGadget, Jun 26, 2020
  178. 5/8 cmake: support for testing git when building out of the source treeSibi Siddharthan via GitGitGadget, Jun 26, 2020
  179. 4/8 cmake: support for testing git with ctestSibi Siddharthan via GitGitGadget, Jun 26, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.