1# Style guidelines for `configure.ac`
2
3Version `2019.08.09.21.54`
4
5
6## Purpose
7
8Define a small set of rules for style used in Expat's `configure.ac`
9so that we have a common ground and something documented to refer to
10in pull requests, when style is off.
11
12
13## 1. Quoting
14Quote "everything":
15```
16AC_DEFINE([HAVE_FOO], [1], [Define to 1 if you have the `foo' function.])
17```
18
19## 2. Parameter indentation
20
21Parameters to functions either go
22- (a) on the the same line or
23- (b) align vertically or
24- (c) go to the next line, with the first character indented 2 spaces more
25  than the first *non-`[`*(!) parent level character,
26  i.e. 2 or [3 columns further right](https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Autoconf-Language.html):
27
28```
29CALL([parameter], [parameter], [parameter])
30
31CALL([parameter],
32     [parameter],
33     [parameter])
34
35CALL([parameter], [parameter],
36  [CALL(
37     [CALL()])])
38
39  ^  ^
40  |  2 + 3(!) spaces
41  2 spaces
42```
43
44## 3. Consecutive call / multi-line indentation
45
46Consecutive calls to macros (= on the the same nesting level) are aligned vertically:
47
48```
49CALL([parameter],
50  [CALL([])
51   CALL([])
52   CALL([])])
53```
54
55## 4. Closing bracket placement
56Closing braces accumulate on the same line in general...
57
58```
59CALL(
60  [CALL([CALL([])],
61        [CALL([])])
62   CALL([])])
63```
64
65...but can go a new line (e.g. with `AC_LANG_SOURCE`) to match parameter indentation rule (2), i.e. either
66
67```
68CALL([CALL([
69    one
70    two
71  ])],
72  [CALL()])
73```
74
75.. or ..
76```
77CALL([CALL([
78        one
79        two
80     ])],
81     [CALL()])
82```
83
84
85EOF
86