Skip to content

Commit 10950b8

Browse files
committed
XXX same behaviour between automake and cmake builds
* use the same file names for messages and C code * print the same "Configuration summary" output
1 parent 4fdac7a commit 10950b8

File tree

6 files changed

+53
-25
lines changed

6 files changed

+53
-25
lines changed

CMakeLists.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,8 @@ endif()
368368
# Configuration
369369
# =====================================
370370

371-
message(STATUS "Configuration summary:")
372-
message(STATUS "----------------------")
371+
message(STATUS "Configuration details:")
372+
message(STATUS "---------------------")
373373

374374
if (DEBUG_CMAKE)
375375
message(STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}")
@@ -404,13 +404,6 @@ if (DEBUG_CMAKE)
404404
message(STATUS "----------------------")
405405
endif()
406406

407-
buildinfo_item("libelf" "yes")
408-
buildinfo_item("libelf" "no")
409-
buildinfo_item("libelf" "DO HAVE")
410-
buildinfo_item("libelf" "DON'T HAVE")
411-
412-
buildinfo_output()
413-
414407
if(HAVE_LIBELF)
415408
message(STATUS "DO HAVE libelf")
416409
else()
@@ -503,3 +496,11 @@ else()
503496
endif()
504497

505498
message(STATUS "----------------------")
499+
500+
buildinfo_item("libelf" "yes")
501+
buildinfo_item("libelf" "no")
502+
buildinfo_item("libelf" "DO HAVE")
503+
buildinfo_item("libelf" "DON'T HAVE")
504+
505+
# print the output collected by earlier calls to buildinfo_item()
506+
buildinfo_output()

src/build-helpers/buildinfo.cmake

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,42 @@
11
function(buildinfo_setup)
22
message(STATUS "BEGIN buildinfo_setup")
3+
string(CONCAT BUILDINFO_INCLUDE_TOP
4+
" /* buildinfo-include.c - DO NOT MODIFY THIS FILE! */\n"
5+
" /* This include file buildinfo-include.c is AUTOGENERATED by configure. */\n"
6+
" /* This file is meant to be \#include'ed, but is not a header file. */\n"
7+
)
8+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/src/buildinfo-include.c"
9+
"${BUILDINFO_INCLUDE_TOP}")
10+
string(CONCAT BUILDINFO_SUMMARY_TOP
11+
"Configuration summary:\n"
12+
"----------------------\n"
13+
"\n"
14+
)
15+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/buildinfo-summary.txt"
16+
"${BUILDINFO_SUMMARY_TOP}")
317
message(STATUS "END buildinfo_setup")
418
endfunction()
519

620
function(buildinfo_item KEY VAL)
721
cmake_parse_arguments(arg "" "" "" ${ARGN})
822
message(STATUS "BEGIN buildinfo_item")
923
message(STATUS " K,V: ${KEY}, ${VAL}")
24+
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/src/buildinfo-include.c"
25+
" {\"AUTO-BUIDLINFO ${KEY}\", \"${VAL}\"},\n")
26+
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/buildinfo-summary.txt"
27+
" * ${KEY}: ${VAL}\n")
1028
message(STATUS "END buildinfo_item")
1129
endfunction()
1230

1331
function(buildinfo_output)
1432
message(STATUS "BEGIN buildinfo_output")
15-
message(STATUS "END buildinfo_output")
33+
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/src/buildinfo-include.c"
34+
" /* end of buildinfo-include.c */\n")
35+
#file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/buildinfo-summary.txt"
36+
# "\nThe End.\n")
37+
file(READ "${CMAKE_CURRENT_BINARY_DIR}/buildinfo-summary.txt" msg)
38+
message("\n${msg}")
39+
# message(STATUS "END buildinfo_output")
1640
endfunction()
1741

1842
buildinfo_setup()

src/build-helpers/buildinfo.m4

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@ m4_pattern_forbid([^BUILDINFO_SETUP])dnl
1313
dnl
1414
AC_DEFUN([BUILDINFO_SETUP], [dnl
1515
dnl AC_MSG_NOTICE([BEGIN ][[$0]])
16-
cat>auto-buildinfo.msg<<EOF
16+
cat>buildinfo-summary.txt<<EOF
1717
18-
AUTO-BUILDINFO
19-
============
18+
Configuration summary:
19+
----------------------
2020
2121
EOF
22-
cat>auto-buildinfo.c<<EOF
23-
/* auto-buildinfo.c - DO NOT MODIFY THIS FILE! */
24-
/* This include file auto-buildinfo.c is AUTOGENERATED by configure. */
22+
cat>buildinfo-include.c<<EOF
23+
/* buildinfo-include.c - DO NOT MODIFY THIS FILE! */
24+
/* This include file buildinfo-include.c is AUTOGENERATED by configure. */
25+
/* This file is meant to be \#include'ed, but is not a header file. */
2526
EOF
2627
dnl AC_MSG_NOTICE([END ][[$0]])
2728
])dnl
@@ -36,8 +37,8 @@ dnl
3637
AC_DEFUN([BUILDINFO_ITEM], [dnl
3738
dnl AC_MSG_NOTICE([BEGIN ][[$0]])
3839
AC_REQUIRE([BUILDINFO_SETUP])
39-
printf " * %-15s %s\n" "$1:" "$2" >> auto-buildinfo.msg
40-
printf " {\"AUTO-BUILDINFO %s\", \"%s\"},\n" "$1" "$2" >> auto-buildinfo.c
40+
printf " * %-15s %s\n" "$1:" "$2" >> buildinfo-summary.txt
41+
printf " {\"AUTO-BUILDINFO %s\", \"%s\"},\n" "$1" "$2" >> buildinfo-include.c
4142
dnl AC_MSG_NOTICE([END ][[$0]])
4243
])dnl
4344
dnl
@@ -51,15 +52,15 @@ dnl
5152
AC_DEFUN([BUILDINFO_OUTPUT], [dnl
5253
dnl AC_MSG_NOTICE([BEGIN ][[$0]])
5354
AC_REQUIRE([BUILDINFO_SETUP])
54-
cat>>auto-buildinfo.msg<<EOF
55+
cat>>buildinfo-summary.txt<<EOF
5556
5657
EOF
57-
cat>>auto-buildinfo.c<<EOF
58-
/* end of auto-buildinfo.c */
58+
cat>>buildinfo-include.c<<EOF
59+
/* end of buildinfo-include.c */
5960
EOF
6061
dnl AC_MSG_NOTICE([END ][[$0]])
6162
62-
cat auto-buildinfo.msg
63+
cat buildinfo-summary.txt
6364
])dnl
6465
dnl
6566
dnl ####################################################################

src/build-helpers/buildinfo.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
EXTRA_DIST += build-helpers/buildinfo.m4
22
EXTRA_DIST += build-helpers/buildinfo.md
33

4-
DISTCLEANFILES += auto-buildinfo.c
5-
DISTCLEANFILES += auto-buildinfo.msg
4+
DISTCLEANFILES += buildinfo-include.c
5+
DISTCLEANFILES += buildinfo-summary.txt

src/buildinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const avr_buildinfo libavrdude_buildinfo = {
88
{
99
{"buildsystem", AVRDUDE_BUILDSYSTEM},
1010

11-
#include <auto-buildinfo.c>
11+
#include <buildinfo-include.c>
1212

1313
{"libelf",
1414
#ifdef HAVE_LIBELF

src/configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ BUILDINFO_ITEM([libelf], [yes])
729729
BUILDINFO_ITEM([libelf], [no])
730730
BUILDINFO_ITEM([libelf], [DO HAVE])
731731
BUILDINFO_ITEM([libelf], [DON'T HAVE])
732+
733+
# print the output collected by earlier calls to BUILDINFO_ITEM()
732734
BUILDINFO_OUTPUT()
733735

734736
echo ""

0 commit comments

Comments
 (0)