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