• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl GP_CONFIG_INIT
2dnl      use default LHS width (called implicitly if not called explicitly)
3dnl GP_CONFIG_INIT([WIDTH-OF-LHS])
4dnl      explicitly set the LHS width to the given value
5dnl
6dnl GP_CONFIG_MSG
7dnl      empty output line
8dnl GP_CONFIG_MSG([LHS],[RHS])
9dnl      formatted output line "LHS: RHS"
10dnl
11dnl GP_CONFIG_OUTPUT
12dnl      print all the output messages we collected in the mean time
13dnl
14dnl Simple way to print a configuration summary at the end of ./configure.
15dnl
16dnl Example usage:
17dnl
18dnl    GP_CONFIG_INIT
19dnl    GP_CONFIG_MSG([Source code location],[${srcdir}])
20dnl    GP_CONFIG_MSG([Compiler],[${CC}])
21dnl    GP_CONFIG_MSG
22dnl    GP_CONFIG_MSG([Feature foo],[${foo}])
23dnl    GP_CONFIG_MSG([Location of bar],[${bar}])
24dnl    [...]
25dnl    AC_OUTPUT
26dnl    GP_CONFIG_OUTPUT
27dnl
28dnl Copyright (C) 2005 Hans Ulrich Niedermann <gp@n-dimensional.de>
29dnl SPDX-License-Identifier: LGPL-2.0-or-later
30dnl
31AC_DEFUN([GP_CONFIG_INIT],
32[dnl
33AC_REQUIRE([GP_CHECK_SHELL_ENVIRONMENT])
34dnl the empty string must contain at least as many spaces as the substr length
35dnl FIXME: let m4 determine that length
36dnl        (collect left parts in array and choose largest length)
37m4_if([$1],[],[gp_config_len="30"],[gp_config_len="$1"])
38gp_config_empty=""
39gp_config_len3="$(expr "$gp_config_len" - 3)"
40n="$gp_config_len"
41while test "$n" -gt 0; do
42      gp_config_empty="${gp_config_empty} "
43      n="$(expr "$n" - 1)"
44done
45gp_config_msg="
46Configuration (${PACKAGE_TARNAME} ${PACKAGE_VERSION}):
47"
48])dnl
49dnl
50dnl
51AC_DEFUN([GP_CONFIG_MSG],
52[AC_REQUIRE([GP_CONFIG_INIT])dnl
53m4_if([$1],[],[
54gp_config_msg="${gp_config_msg}
55"
56],[$2],[],[
57gp_config_msg="${gp_config_msg}
58  [$1]
59"
60],[
61gp_config_msg_len="$(expr "[$1]" : '.*')"
62if test "$gp_config_msg_len" -ge "$gp_config_len"; then
63	gp_config_msg_lhs="$(expr "[$1]" : "\(.\{0,${gp_config_len3}\}\)")..:"
64else
65	gp_config_msg_lhs="$(expr "[$1]:${gp_config_empty}" : "\(.\{0,${gp_config_len}\}\)")"
66fi
67gp_config_msg="${gp_config_msg}    ${gp_config_msg_lhs} [$2]
68"
69])])dnl
70dnl
71AC_DEFUN([GP_CONFIG_MSG_SUBDIRS],[dnl
72# Message about configured subprojects
73if test "x$subdirs" != "x"; then
74	GP_CONFIG_MSG()dnl
75	_subdirs=""
76	for sd in $subdirs; do
77		ssd="$(basename "$sd")"
78		if test "x$_subdirs" = "x"; then
79			_subdirs="$ssd";
80		else
81			_subdirs="$_subdirs $ssd"
82		fi
83	done
84	GP_CONFIG_MSG([Subprojects],[${_subdirs}])dnl
85fi
86])dnl
87dnl
88AC_DEFUN([GP_CONFIG_OUTPUT],
89[AC_REQUIRE([GP_CONFIG_INIT])dnl
90AC_REQUIRE([GP_CONFIG_MSG])dnl
91AC_REQUIRE([GP_CONFIG_MSG_SUBDIRS])dnl
92echo "${gp_config_msg}
93You may run \"make\" and \"make install\" now."
94])dnl
95dnl
96dnl Please do not remove this:
97dnl filetype: de774af3-dc3b-4b1d-b6f2-4aca35d3da16
98dnl I use this to find all the different instances of this file which
99dnl are supposed to be synchronized.
100dnl
101dnl Local Variables:
102dnl mode: autoconf
103dnl End:
104