]> granicus.if.org Git - sysstat/blob - iconfig
Merge pull request from GHSA-q8r6-g56f-9w7x
[sysstat] / iconfig
1 #!/bin/sh
2 #@(#) Configuration script for sysstat
3 # (C) 2000-2022 Sebastien GODARD (sysstat <at> orange.fr)
4
5 if [ "$1" = "xlocal" ]
6 then
7         echo
8         echo -n "./configure sa_lib_dir=. sa_dir=. conf_dir=. conf_file=sysstat.sysconfig"
9         echo
10         ./configure sa_lib_dir=. sa_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig
11         exit
12 elif [ "$1" = "local" ]
13 then
14         # This mode is just to make sure that sar will call sadc located in current directory
15         echo
16         echo -n "./configure sa_lib_dir=."
17         echo
18         ./configure sa_lib_dir=.
19         exit
20 elif [ "$1" = "debug" ]
21 then
22         echo
23         echo -n "./configure sa_lib_dir=. --enable-debuginfo --disable-stripping"
24         echo
25         ./configure sa_lib_dir=. --enable-debuginfo --disable-stripping
26         exit
27 fi
28
29 ASK="sh build/Ask.sh"
30
31 echo ; echo
32 echo Welcome to sysstat\'s  Interactive Configuration script!
33 echo
34 echo This script enables you to set the parameters value used by ./configure.
35 echo Please enter the value for the parameters listed below.
36 echo Press Return to tell ./configure to use the default value or to try to guess the proper one.
37 echo "Default value for yes/no questions is no (parameter is NOT set)."
38 echo You can enter a ? to display a help message at any time...
39 echo
40
41 # Syntax: Ask <QUESTION> <PARM> <TEXT_FILE>
42
43 # Installation directory
44 PREFIX=`${ASK} 'Installation directory:' "--prefix" "prefix"`
45 if [ "${PREFIX}" != "" ]; then
46         PREFIX="--prefix=${PREFIX} "
47 fi
48
49 # sadc directory
50 SA_LIB_DIR=`${ASK} 'sadc directory:' "sa_lib_dir" "sa_lib_dir"`
51 if [ "${SA_LIB_DIR}" != "" ]; then
52         SA_LIB_DIR="sa_lib_dir=${SA_LIB_DIR} "
53 fi
54
55 # System Activity directory
56 SA_DIR=`${ASK} 'System activity directory:' "sa_dir" "sa_dir"`
57 if [ "${SA_DIR}" != "" ]; then
58         SA_DIR="sa_dir=${SA_DIR} "
59 fi
60
61 # sysstat configuration directory
62 SYSCONFIG_DIR=`${ASK} 'sysstat configuration directory:' "conf_dir" "conf_dir"`
63 if [ "${SYSCONFIG_DIR}" != "" ]; then
64         SYSCONFIG_DIR="conf_dir=${SYSCONFIG_DIR} "
65 fi
66
67 # sysstat configuration file
68 SYSCONFIG_FILE=`${ASK} 'sysstat configuration file:' "conf_file" "conf_file"`
69 if [ "${SYSCONFIG_FILE}" != "" ]; then
70         SYSCONFIG_FILE="conf_file=${SYSCONFIG_FILE} "
71 fi
72
73 # Clean sa directory
74 CLEAN_SA_DIR=`${ASK} 'Clean system activity directory? (y/n)' "--enable-clean-sa-dir" "clean-sa-dir"`
75 if [ "${CLEAN_SA_DIR}" = "y" ]; then
76         CLEAN_SA_DIR="--enable-clean-sa-dir "
77 else
78         CLEAN_SA_DIR=""
79         echo "Parameter --enable-clean-sa-dir is NOT set"
80 fi
81
82 # National Language Support
83 NLS=`${ASK} 'Disable National Language Support (NLS)? (y/n)' "--disable-nls" "nls"`
84 if [ "${NLS}" = "y" ]; then
85         NLS="--disable-nls "
86 else
87         NLS=""
88         echo "Parameter --disable-nls is NOT set"
89 fi
90
91 # Link Time Optimization support
92 LTO=`${ASK} 'Compile with Link Time Optimizations (LTO)? (y/n)' "--enable-lto" "lto"`
93 if [ "${LTO}" = "y" ]; then
94         LTO="--enable-lto "
95 else
96         LTO=""
97         echo "Parameter --enable-lto is NOT set"
98 fi
99
100 # Sensors support
101 SENSORS=`${ASK} 'Disable sensors support? (y/n)' "--disable-sensors" "sensors"`
102 if [ "${SENSORS}" = "y" ]; then
103         SENSORS="--disable-sensors "
104 else
105         SENSORS=""
106         echo "Parameter --disable-sensors is NOT set"
107 fi
108
109 # PCP support
110 PCP=`${ASK} 'Disable PCP support? (y/n)' "--disable-pcp" "pcp"`
111 if [ "${PCP}" = "y" ]; then
112         PCP="--disable-pcp "
113 else
114         PCP=""
115         echo "Parameter --disable-pcp is NOT set"
116 fi
117
118 # Data history to keep by sa2
119 HISTORY=`${ASK} 'Number of daily data files to keep:' "history" "history"`
120 if [ "${HISTORY}" != "" ]; then
121         HISTORY="history=${HISTORY} "
122 fi
123
124 # Random delay before sa2 script generates its reports files
125 DELAY_RANGE=`${ASK} 'Maximum delay in seconds to wait before sa2 script runs:' "delay_range" "delay_range"`
126 if [ "${DELAY_RANGE}" != "" ]; then
127         DELAY_RANGE="delay_range=${DELAY_RANGE} "
128 fi
129
130 # Delay after which datafiles are to be compressed
131 COMPRESSAFTER=`${ASK} 'Number of days after which sar datafiles must be compressed:' "compressafter" "compressafter"`
132 if [ "${COMPRESSAFTER}" != "" ]; then
133         COMPRESSAFTER="compressafter=${COMPRESSAFTER} "
134 fi
135
136 # Manual page group
137 MAN=`${ASK} 'Group for manual pages:' "man_group" "man_group"`
138 if [ "${MAN}" != "" ]; then
139         MAN="man_group=${MAN} "
140 fi
141
142 # Don't set attributes on files being installed
143 IGNORE_FILE_ATTR=`${ASK} 'Do not set attributes on files being installed? (y/n)' "--disable-file-attr" "ignore-file-attr"`
144 if [ "${IGNORE_FILE_ATTR}" = "y" ]; then
145         IGNORE_FILE_ATTR="--disable-file-attr "
146 else
147         IGNORE_FILE_ATTR=""
148         echo "Parameter --disable-file-attr is NOT set"
149 fi
150
151 # Crontab
152 CRON=`${ASK} 'Set crontab to start sar automatically? (y/n)' "--enable-install-cron" "install-cron"`
153 if [ "${CRON}" = "y" ]; then
154         CRON="--enable-install-cron "
155 else
156         CRON=""
157         echo "Parameter --enable-install-cron is NOT set"
158 fi
159
160 if [ "${CRON}" != "" ];
161 then
162         CRON_OWNER=`${ASK} 'Crontab owner:' "cron_owner" "cron_owner"`
163         if [ "${CRON_OWNER}" != "" ]; then
164                 CRON="${CRON}cron_owner=${CRON_OWNER} "
165         fi
166 fi
167
168 if [ "${CRON}" != "" ];
169 then
170         USE_CROND=`${ASK} 'Use standard cron daemon? (y/n)' "--enable-use-crond" "use-crond"`
171         if [ "${USE_CROND}" = "y" ]; then
172                 USE_CROND="--enable-use-crond "
173         else
174                 USE_CROND=""
175                 echo "Parameter --enable-use-crond is NOT set"
176         fi
177 fi
178
179 if [ "${CRON}" != "" ];
180 then
181         CRON_INTERVAL=`${ASK} 'Crontab sampling interval (in minutes):' "cron_interval" "cron_interval"`
182         if [ "${CRON_INTERVAL}" != "" ]; then
183                 CRON="${CRON}cron_interval=${CRON_INTERVAL} "
184         fi
185 fi
186
187 if [ "${CRON}" != "" ];
188 then
189         COLL_ALL=`${ASK} 'Should sadc collect optional activities? (y/n)' "--enable-collect-all" "collect-all"`
190         if [ "${COLL_ALL}" = "y" ]; then
191                 CRON="${CRON}--enable-collect-all "
192         else
193                 echo "Parameter --enable-collect-all is NOT set"
194         fi
195 fi
196
197 if [ "${CRON}" != "" -a "${COLL_ALL}" != "y" ];
198 then
199         # Optional args for sadc
200         SADC_OPT=`${ASK} 'Options to be passed to sadc:' "sadc_options" "sadc_options"`
201 else
202         SADC_OPT=
203 fi
204
205 if [ "${CRON}" != "" ];
206 then
207         # rc directory
208         RCDIR=`${ASK} 'rc directory:' "rcdir" "rcdir"`
209         if [ "${RCDIR}" != "" ]; then
210                 RCDIR="rcdir=${RCDIR} "
211         fi
212 fi
213
214 if [ "${CRON}" != "" ];
215 then
216         # Only copy files
217         COPY_ONLY=`${ASK} 'Only copy files when installing sysstat? (y/n)' "--enable-copy-only" "copy-only"`
218         if [ "${COPY_ONLY}" = "y" ]; then
219                 COPY_ONLY="--enable-copy-only "
220         else
221                 COPY_ONLY=""
222                 echo "Parameter --enable-copy-only is NOT set"
223         fi
224 fi
225
226 # Compress manual pages
227 COMPRESSMANPG=`${ASK} 'Do not compress manual pages? (y/n)' "--disable-compress-manpg" "compress-manpg"`
228 if [ "${COMPRESSMANPG}" = "y" ]; then
229         COMPRESSMANPG="--disable-compress-manpg "
230 else
231         COMPRESSMANPG=""
232         echo "Parameter --disable-compress-manpg is NOT set"
233 fi
234
235 # Install documentation
236 INSTALL_DOC=`${ASK} 'Skip documentation installation? (y/n)' "--disable-documentation" "install-doc"`
237 if [ "${INSTALL_DOC}" = "y" ]; then
238         INSTALL_DOC="--disable-documentation "
239 else
240         INSTALL_DOC=""
241         echo "Parameter --disable-documentation is NOT set"
242 fi
243
244 # Debug mode
245 DEBUGINFO=`${ASK} 'Debug mode support? (y/n)' "--enable-debuginfo" "debuginfo"`
246 if [ "${DEBUGINFO}" = "y" ]; then
247         DEBUGINFO="--enable-debuginfo "
248 else
249         DEBUGINFO=""
250         echo "Parameter --enable-debuginfo is NOT set"
251 fi
252
253 # Strip object files
254 STRIP=`${ASK} 'Do not strip object files? (y/n)' "--disable-stripping" "stripping"`
255 if [ "${STRIP}" = "y" ]; then
256         STRIP="--disable-stripping "
257 else
258         STRIP=""
259         echo "Parameter --disable-stripping is NOT set"
260 fi
261
262 echo
263 echo -n "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
264 ${CLEAN_SA_DIR}${NLS}${LTO}${HISTORY}${DELAY_RANGE}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR} \
265 ${CRON}${USE_CROND}${RCDIR}"
266 if [ "${SADC_OPT}" != "" ];
267 then
268         echo -n "sadc_options=\"${SADC_OPT}\""
269 fi
270 echo "${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS}${PCP}${STRIP}${COPY_ONLY}"
271 echo
272
273 ./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
274 ${CLEAN_SA_DIR}${NLS}${LTO} \
275 ${HISTORY}${DELAY_RANGE}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${USE_CROND}${RCDIR} \
276 sadc_options="${SADC_OPT}" ${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS} \
277 ${PCP}${STRIP}${COPY_ONLY}