aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: d69c7a6434d63fcd0b83d0117c1b9114bdbca8f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# autoconf script for ctct
#
# Copyright 2015, 2016, 2018 Einhard Leichtfuß
#
# This file is part of ctct.
#
# ctct is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# ctct is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with ctct.  If not, see <https://www.gnu.org/licenses/>.
#

AC_INIT([ctct], [0.2.X], [alguien@respiranto.de])
AC_CONFIG_FILES(
	[Makefile]
	[ctct.1]
	[ctct.bash_completion]
	[config.sh]
)
AC_CONFIG_FILES([ctct], [chmod +x ctct])


# Do not use $(.) notation here, confdir shall allow for shell substitution.
AC_ARG_VAR([confdir], ['system wide configuration directory'])
test -z "$confdir" && confdir='${sysconfdir}/${TARGET}'

AC_ARG_VAR([bash_completion_dir],
					 ['directory to store bash-completion script in'])
test -z "$bash_completion_dir" \
	&& bash_completion_dir='${datarootdir}/bash-completion/completions'


# Used in manpage.  Needs to be fully expanded.
AC_SUBST([default_confdir])

# Use a function to allow for local variables.
fun() {
	if test -z "$default_confdir"
	then

		# If $prefix is unset by the user, set it to autoconf's default value:
		test "$prefix" = NONE && local prefix=/usr/local

		# Prevent //.
		test "$prefix" = / && local prefix=''

		local TARGET="$PACKAGE_NAME"
		default_confdir="$confdir"

		# Resolve $confdir recursively (notably including $prefix):
		while
			eval "default_confdir_expand=\"$default_confdir\""
			test "$default_confdir" != "$default_confdir_expand"
		do
			default_confdir="$default_confdir_expand"
		done
	fi
}; fun


AC_ARG_VAR([default_datadir], ['directory to store contact data in'])
test -z "$default_datadir" && default_datadir='$HOME/.ctct'

AC_ARG_VAR([default_fallback_editor], ['editor to use if EDITOR is unset'])
test -z "$default_fallback_editor" && default_fallback_editor=vi

AC_ARG_VAR([default_user_config_dir], ['user configuration directory'])
test -z "$default_user_config_dir" \
	&& default_user_config_dir='$HOME/.config/'"$PACKAGE_NAME"

AC_ARG_VAR([default_input_program],
					 ['the program that newly created or edited contact files get passed to on stdin'])
test -z "$default_input_program" \
	&& default_input_program='cat'

AC_ARG_VAR([default_output_program],
					 ['the program that gets passed the contact files on stdin'])
test -z "$default_output_program" \
	&& default_output_program='cat'

AC_ARG_VAR([default_visual_program],
					 ['the program that is used to display the data'])
test -z "$default_visual_program" \
	&& default_visual_program='cat'

AC_ARG_VAR([default_confirm_deletion],
					 ['whether to ask for confirmation upon deletion of a contact'])
test -z "$default_confirm_deletion" \
	&& default_confirm_deletion=true

AC_ARG_VAR([default_confirm_default_yes],
					 ['whether to consider "yes" as answer upon a not answered confirmation'])
test -z "$default_confirm_default_yes" \
	&& default_confirm_default_yes=false


AC_OUTPUT