configure 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. #!/bin/sh
  2. ### Automatic build configuration script for Dinit.
  3. ### This script generates an "mconfig" file suitable for building on the current system.
  4. ## Initial preparation
  5. set -eu
  6. cd "$(dirname "$0")"
  7. ## Helper functions
  8. # POSIX "echo" behaviour is unspecified behavior in some cases, for example
  9. # when the first argument is "-n" or backslash ("\").
  10. # So, replace the shell built-in echo with a printf based function.
  11. # For more info see http://www.etalabs.net/sh_tricks.html
  12. echo()
  13. {
  14. IFS=" " printf %s\\n "$*"
  15. }
  16. info()
  17. {
  18. echo "$*"
  19. }
  20. sub_info()
  21. {
  22. echo " ... $*"
  23. }
  24. error()
  25. {
  26. >&2 echo "Error: $*"
  27. exit 1
  28. }
  29. sub_error()
  30. {
  31. >&2 echo " ... Error: $*"
  32. exit 1
  33. }
  34. # warning() have a built-in extra information feild which is optional
  35. # $1: Info, $2: Extra info (Optional)
  36. # NOTE: Always quote your warning() messages
  37. warning()
  38. {
  39. >&2 echo
  40. >&2 echo "Warning: $1"
  41. [ -n "${2:-}" ] && >&2 echo " ... $2"
  42. >&2 echo
  43. }
  44. cxx_works()
  45. {
  46. info Checking whether \""$1"\" is a working C++ compiler...
  47. if $CXX -o testfile.o testfile.cc; then
  48. rm -f testfile
  49. sub_info Yes.
  50. else
  51. rm -f testfile*
  52. sub_error It seems like \""$CXX"\" is not working a working C++ compiler. Please specify compiler.
  53. fi
  54. }
  55. # Test if the compiler accepts an argument (for compilation and link); if so add it to named variable.
  56. # NOTE: This function will return 1 on unsupported flag, use try_optional_cxx_argument() when
  57. # flag is not required or check its return.
  58. # $1 - the name of the variable to potentially add the argument to
  59. # $2 - the argument to add
  60. # CXX - the name of the compiler
  61. # CXXFLAGS, CXXFLAGS_EXTRA, LDFLAGS, LDFLAGS_EXTRA - any predetermined flags
  62. try_cxx_argument()
  63. {
  64. info Checking whether the compiler accepts "$2"...
  65. if $CXX $CXXFLAGS $2 $CXXFLAGS_EXTRA $LDFLAGS $LDFLAGS_EXTRA testfile.cc -o testfile > /dev/null 2>&1; then
  66. rm testfile
  67. sub_info Yes.
  68. eval "$1=\"\${$1} \$2\""
  69. eval "$1=\${$1# }"
  70. return 0
  71. else
  72. sub_info No.
  73. return 1
  74. fi
  75. }
  76. # Same as try_cxx_argument but doesn't return 1 on unsupported flag
  77. try_optional_cxx_argument()
  78. {
  79. try_cxx_argument "$1" "$2" || :
  80. }
  81. try_ld_argument()
  82. {
  83. info Checking whether "$2" is accepted as a link-time option...
  84. if $CXX $CXXFLAGS $CXXFLAGS_EXTRA $LDFLAGS $LDFLAGS_EXTRA $2 testfile.cc -o testfile > /dev/null 2>&1; then
  85. sub_info Yes.
  86. eval "$1=\"\${$1} \$2\""
  87. eval "$1=\${$1# }"
  88. else
  89. sub_info No.
  90. fi
  91. }
  92. try_both_argument()
  93. {
  94. info Checking whether the compiler/linker accepts "$3"...
  95. if $CXX $CXXFLAGS $CXXFLAGS_EXTRA $LDFLAGS $LDFLAGS_EXTRA $3 testfile.cc -o testfile > /dev/null 2>&1; then
  96. sub_info Yes.
  97. eval "$1=\"\${$1} \$3\""
  98. eval "$1=\${$1# }"
  99. eval "$2=\"\${$2} \$3\""
  100. eval "$2=\${$2# }"
  101. else
  102. sub_info No.
  103. fi
  104. }
  105. usage()
  106. {
  107. cat << _EOF
  108. Usage: $0 [OPTION]...
  109. Generates build configuration for Dinit.
  110. Defaults for the options are specified in brackets.
  111. -h, --help This help message.
  112. -q, --quiet Don't print normal messages, just errors.
  113. -c, --clear Clear mconfig and configure's temporary files.
  114. Target options:
  115. --platform=PLATFORM Set the platform manually (Just for cross-platform cross-compile!) [autodetected]
  116. Note: for all cross-compiles please specify correct CXX and CXX_FOR_BUILD!
  117. Installation directories:
  118. --prefix=PREFIX Main installation prefix [/usr]
  119. --exec-prefix=EPREFIX Main executables prefix [/]
  120. --sbindir=SBINDIR Dinit executables [EPREFIX/sbin]
  121. --mandir=MANDIR Dinit man-pages location [PREFIX/share/man]
  122. --syscontrolsocket=SOCKETPATH Dinitctl socket location [/run/dinitctl] on Linux systems
  123. [/var/run/dinitctl] on other systems
  124. Optional options:
  125. --enable-strip Strip debug information in installation process [Enabled]
  126. --disable-strip Don't strip debug information in installation process
  127. --shutdown-prefix=PREFIX Name prefix for shutdown, poweroff, reboot, soft-reboot, halt programs []
  128. --enable-shutdown Build shutdown, poweroff, reboot, soft-reboot, halt programs [Enabled only on Linux systems]
  129. --disable-shutdown Don't build shutdown, poweroff, reboot, soft-reboot, halt programs
  130. --enable-cgroups Enable Cgroups support [Enabled only on Linux based systems]
  131. --disable-cgroups Disable Cgroups support
  132. --enable-utmpx Enable manipulating the utmp/utmpx database via the related POSIX functions [guessed]
  133. --disable-utmpx Disable manipulating the utmp/utmpx database via the related POSIX functions
  134. --enable-initgroups Enable initialization of supplementary groups for run-as [Enabled]
  135. --disable-initgroups Disable initialization of supplementary groups for run-as
  136. --enable-auto-restart Enable auto-restart for services by default [Deprecated]
  137. --disable-auto-restart Disable auto-restart for services by default [Deprecated]
  138. --default-start-timeout=sec Default start-timeout for services [60]
  139. --default-stop-timeout=sec Default stop-timeout for services [10]
  140. --default-auto-restart=(never|on-failure|always)
  141. When to automatically restart services. This controls the default value for the
  142. "restart" service setting; see the dinit-service(5) man page for details. [always]
  143. Build variables:
  144. Note: build variables can be passed in the environment, or as $0 argument (as "var=VALUE").
  145. Note: CXXFLAGS, TEST_CXXFLAGS, LDFLAGS and TEST_LDFLAGS by default will be set to options considered suitable
  146. for the platform, filtered to remove any options not supported by the compiler/linker. To disable this,
  147. specify the values explicitly (an empty string is accepted). To add options without removing the defaults,
  148. set the variable with _EXTRA appended to the name (eg CXXFLAGS_EXTRA).
  149. CXX C++ compiler
  150. CXX_FOR_BUILD C++ compiler generating code for the build system (for cross-compiles).
  151. CXXFLAGS_FOR_BUILD Flags to use when generating code for the build system.
  152. Defaults to the value of CXXFLAGS.
  153. CPPFLAGS_FOR_BUILD Preprocessor flags to use when generating code for the build system.
  154. Defaults to the value of CPPFLAGS.
  155. LDFLAGS_FOR_BUILD Link flags to use when generating code for the build system.
  156. Defaults to the value of LDFLAGS.
  157. CXXFLAGS Flags to use when compiling C++ code.
  158. CXXFLAGS_EXTRA Additional flags to use when compiling C++ code.
  159. TEST_CXXFLAGS Flags to use when compiling C++ code in tests.
  160. TEST_CXXFLAGS_EXTRA Additional flags to use when compiling C++ code in tests.
  161. CPPFLAGS Preprocessor flags to use when compiling C++ code.
  162. LDFLAGS Link flags.
  163. LDFLAGS_EXTRA Additional link flags.
  164. LDFLAGS_BASE Link flags to use in addition to any link-time optimisation
  165. (LTO)-related options. Set this to control link options without
  166. disabling LTO. Ignored if LDFLAGS is set.
  167. TEST_LDFLAGS Link flags when building test executables.
  168. TEST_LDFLAGS_EXTRA Additional link flags when building test executables.
  169. TEST_LDFLAGS_BASE Link flags to use when building test executables, in addition to
  170. LTO-releated options.
  171. Note: paths specified via --prefix/--exec-prefix/--sbindir/--mandir, and build variable values, must be
  172. escaped for use in a makefile and in shell commands. If there are spaces in paths it is recommended to
  173. prepend a backslash (\) to them.
  174. For example: ./configure --prefix="/home/my\ home"
  175. See BUILD file for more information.
  176. _EOF
  177. exit 0
  178. }
  179. ## Don't take values from environment for these variables:
  180. for var in PREFIX \
  181. EPREFIX \
  182. SBINDIR \
  183. MANDIR \
  184. SHUTDOWN_PREFIX \
  185. BUILD_SHUTDOWN \
  186. SUPPORT_CGROUPS \
  187. USE_UTMPX \
  188. USE_INITGROUPS \
  189. SYSCONTROLSOCKET \
  190. STRIPOPTS
  191. do
  192. unset $var
  193. done
  194. ## Flag parser
  195. for arg in "$@"; do
  196. case "$arg" in
  197. -h|--help) usage ;;
  198. -q|--quiet)
  199. info() { true; }
  200. sub_info() { true; }
  201. warning() { true; }
  202. ;;
  203. -c|--clear) rm -f test* & rm -f mconfig && exit 0 ;;
  204. --platform=*) PLATFORM="${arg#*=}" && shift ;;
  205. --prefix=*) PREFIX="${arg#*=}" && shift ;;
  206. --exec-prefix=*) EPREFIX="${arg#*=}" && shift;;
  207. --sbindir=*) SBINDIR="${arg#*=}" && shift ;;
  208. --mandir=*) MANDIR="${arg#*=}" && shift ;;
  209. --default-start-timeout=*) DEFAULT_START_TIMEOUT="${arg#*=}" && shift ;;
  210. --default-stop-timeout=*) DEFAULT_STOP_TIMEOUT="${arg#*=}" && shift ;;
  211. --syscontrolsocket=*) SYSCONTROLSOCKET="${arg#*=}" && shift ;;
  212. --shutdown-prefix=*) SHUTDOWN_PREFIX="${arg#*=}" && shift ;;
  213. --enable-shutdown|--enable-shutdown=yes) BUILD_SHUTDOWN=yes ;;
  214. --disable-shutdown|--enable-shutdown=no) BUILD_SHUTDOWN=no ;;
  215. --enable-cgroups|--enable-cgroups=yes) SUPPORT_CGROUPS=1 ;;
  216. --disable-cgroups|--enable-cgroups=no) SUPPORT_CGROUPS=0 ;;
  217. --enable-utmpx|--enable-utmpx=yes) USE_UTMPX=1 ;;
  218. --disable-utmpx|--enable-utmpx=no) USE_UTMPX=0 ;;
  219. --enable-initgroups|--enable-initgroups=yes) USE_INITGROUPS=1 ;;
  220. --disable-initgroups|--enable-initgroups=no) USE_INITGROUPS=0 ;;
  221. --enable-auto-restart|--enable-auto-restart=yes) DEFAULT_AUTO_RESTART=ALWAYS ;; # Deprecated
  222. --disable-auto-restart|--enable-auto-restart=no) DEFAULT_AUTO_RESTART=NEVER ;; # Deprecated
  223. --enable-strip|--enable-strip=yes) STRIPOPTS="-s" ;;
  224. --disable-strip|--enable-strip=no) STRIPOPTS="" ;;
  225. --default-auto-restart=never) DEFAULT_AUTO_RESTART=NEVER ;;
  226. --default-auto-restart=always) DEFAULT_AUTO_RESTART=ALWAYS ;;
  227. --default-auto-restart=on-failure) DEFAULT_AUTO_RESTART=ON_FAILURE ;;
  228. CXX=*|CXX_FOR_BUILD=*|CXXFLAGS_FOR_BUILD=*|CPPFLAGS_FOR_BUILD=*\
  229. |LDFLAGS_FOR_BUILD=*|CXXFLAGS=*|CXXFLAGS_EXTRA=*|TEST_CXXFLAGS=*\
  230. |TEST_CXXFLAGS_EXTRA=*|LDFLAGS=*|LDFLAGS_EXTRA=*|TEST_LDFLAGS=*\
  231. |TEST_LDFLAGS_EXTRA=*|CPPFLAGS=*|LDFLAGS_BASE=*|TEST_LDFLAGS_BASE=*) eval "${arg%%=*}=\${arg#*=}" ;;
  232. *=*) warning "Unknown variable: ${arg%%=*}" ;;
  233. *) warning "Unknown argument: $arg" ;;
  234. esac
  235. done
  236. ## Defaults for variables not specified by user
  237. : "${PLATFORM:=$(uname)}"
  238. : "${PREFIX:="/usr"}"
  239. : "${EPREFIX:="/"}"
  240. : "${SBINDIR:="${EPREFIX%%/}/sbin"}"
  241. : "${MANDIR:="${PREFIX%%/}/share/man"}"
  242. : "${SHUTDOWN_PREFIX:=""}"
  243. : "${CXXFLAGS_EXTRA:=""}"
  244. : "${TEST_CXXFLAGS_EXTRA:=""}"
  245. : "${CPPFLAGS:=""}"
  246. : "${LDFLAGS_EXTRA:=""}"
  247. : "${TEST_LDFLAGS_EXTRA:=""}"
  248. : "${DEFAULT_AUTO_RESTART:="ALWAYS"}"
  249. : "${DEFAULT_START_TIMEOUT:="60"}"
  250. : "${DEFAULT_STOP_TIMEOUT:="10"}"
  251. : "${USE_INITGROUPS:="1"}"
  252. if [ "$PLATFORM" = "Linux" ]; then
  253. : "${BUILD_SHUTDOWN:="yes"}"
  254. : "${SUPPORT_CGROUPS:="1"}"
  255. : "${SYSCONTROLSOCKET:="/run/dinitctl"}"
  256. else
  257. : "${BUILD_SHUTDOWN:="no"}"
  258. : "${SUPPORT_CGROUPS:="0"}"
  259. : "${SYSCONTROLSOCKET:="/var/run/dinitctl"}"
  260. fi
  261. HAS_LTO=""
  262. ## Finalize $CXXFLAGS, $TEST_CXXFLAGS, $LDFLAGS, $TEST_LDFLAGS, $STRIPOPTS
  263. if [ -z "${CXXFLAGS+IS_SET}" ]; then
  264. CXXFLAGS=""
  265. AUTO_CXXFLAGS="true"
  266. else
  267. AUTO_CXXFLAGS="false"
  268. fi
  269. if [ -z "${TEST_CXXFLAGS+IS_SET}" ]; then
  270. TEST_CXXFLAGS=""
  271. AUTO_TEST_CXXFLAGS="true"
  272. else
  273. AUTO_TEST_CXXFLAGS="false"
  274. fi
  275. if [ -z "${LDFLAGS+IS_SET}" ]; then
  276. LDFLAGS=""
  277. AUTO_LDFLAGS="true"
  278. else
  279. AUTO_LDFLAGS="false"
  280. fi
  281. if [ -z "${TEST_LDFLAGS+IS_SET}" ]; then
  282. TEST_LDFLAGS=""
  283. AUTO_TEST_LDFLAGS="true"
  284. else
  285. AUTO_TEST_LDFLAGS="false"
  286. fi
  287. if [ -z "${LDFLAGS_BASE+IS_SET}" ]; then
  288. LDFLAGS_BASE=""
  289. AUTO_LDFLAGS_BASE="true"
  290. else
  291. AUTO_LDFLAGS_BASE="false"
  292. fi
  293. if [ -z "${TEST_LDFLAGS_BASE+IS_SET}" ]; then
  294. TEST_LDFLAGS_BASE=""
  295. AUTO_TEST_LDFLAGS_BASE="true"
  296. else
  297. AUTO_TEST_LDFLAGS=BASE="false"
  298. fi
  299. [ -z "${STRIPOPTS+IS_SET}" ] && STRIPOPTS="-s"
  300. ## Verify PLATFORM value
  301. if [ "$PLATFORM" != "Linux" ] && [ "$PLATFORM" != "FreeBSD" ] && \
  302. [ "$PLATFORM" != "OpenBSD" ] && [ "$PLATFORM" != "Darwin" ]; then
  303. warning "$PLATFORM platform is unknown!" "Known Platforms are: Linux, FreeBSD, OpenBSD, Darwin"
  304. fi
  305. ## Create testfile.cc to test c++ compiler
  306. echo "int main(int argc, char **argv) { return 0; }" > testfile.cc || error Can\'t create temporary file
  307. ## Find and test C++ compiler
  308. if [ -z "${CXX:-}" ]; then
  309. info Checking C++ compiler...
  310. for guess in g++ clang++ c++; do
  311. if type "$guess" > /dev/null 2>&1; then
  312. CXX="$guess"
  313. sub_info "$CXX"
  314. break # Found
  315. fi
  316. done
  317. if [ -z "${CXX:-}" ]; then
  318. sub_error No C++ compiler found! # Not found
  319. fi
  320. fi
  321. cxx_works "$CXX"
  322. if [ -n "${CXX_FOR_BUILD:-}" ]; then
  323. cxx_works "$CXX_FOR_BUILD"
  324. fi
  325. ## Test compiler/linker supported arguments
  326. if [ "$AUTO_CXXFLAGS" = "true" ]; then
  327. if ! try_cxx_argument CXXFLAGS -std=c++11; then
  328. sub_error "The C++ compiler ($CXX) doesn't accept '-std=c++11' and may be too old."
  329. fi
  330. for argument in -Wall \
  331. -Os \
  332. -fno-plt
  333. do
  334. try_optional_cxx_argument CXXFLAGS $argument
  335. done
  336. if [ "$PLATFORM" != "Darwin" ]; then
  337. try_optional_cxx_argument CXXFLAGS -fno-rtti
  338. fi
  339. fi
  340. if [ "$AUTO_LDFLAGS" = "true" ] && [ "$AUTO_CXXFLAGS" = "true" ]; then
  341. if try_cxx_argument CXXFLAGS -flto; then
  342. HAS_LTO="true"
  343. else
  344. HAS_LTO="false"
  345. fi
  346. fi
  347. if [ "$AUTO_LDFLAGS_BASE" = true ] && [ "$PLATFORM" = FreeBSD ]; then
  348. try_ld_argument LDFLAGS_BASE -lrt
  349. fi
  350. if [ "$AUTO_TEST_LDFLAGS_BASE" = true ]; then
  351. TEST_LDFLAGS_BASE="\$(LDFLAGS_BASE)"
  352. established_TEST_LDFLAGS="$LDFLAGS_BASE"
  353. else
  354. established_TEST_LDFLAGS="$TEST_LDFLAGS_BASE"
  355. fi
  356. # Determine LDFLAGS/TEST_LDFLAGS. In the case of TEST_LDFLAGS we may still add sanitisation
  357. # options, shortly.
  358. if [ "$HAS_LTO" = true ]; then
  359. if [ "$AUTO_LDFLAGS" = true ]; then
  360. LDFLAGS="\$(LDFLAGS_BASE) \$(CXXFLAGS)"
  361. fi
  362. if [ "$AUTO_TEST_LDFLAGS" = true ]; then
  363. TEST_LDFLAGS="\$(TEST_LDFLAGS_BASE) \$(TEST_CXXFLAGS)"
  364. established_TEST_LDFLAGS="$established_TEST_LDFLAGS $TEST_CXXFLAGS"
  365. else
  366. established_TEST_LDFLAGS="$TEST_LDFLAGS"
  367. fi
  368. else
  369. # default LDFLAGS are just $(LDFLAGS_BASE)
  370. if [ "$AUTO_LDFLAGS" = true ]; then
  371. LDFLAGS="\$(LDFLAGS_BASE)"
  372. fi
  373. if [ "$AUTO_TEST_LDFLAGS" = true ]; then
  374. TEST_LDFLAGS="\$(TEST_LDFLAGS_BASE)"
  375. else
  376. established_TEST_LDFLAGS="$TEST_LDFLAGS"
  377. fi
  378. fi
  379. # Default for test flags (TEST_CXXFLAGS, TEST_LDFLAGS) is to use the build flags
  380. if [ "$AUTO_TEST_CXXFLAGS" = "true" ]; then
  381. TEST_CXXFLAGS="\$(CXXFLAGS)"
  382. established_TEST_CXXFLAGS="$CXXFLAGS"
  383. else
  384. established_TEST_CXXFLAGS="$TEST_CXXFLAGS"
  385. fi
  386. # Check whether sanitizers can be used for tests
  387. if [ "$AUTO_TEST_LDFLAGS" = "true" ] && [ "$AUTO_TEST_CXXFLAGS" = "true" ]; then
  388. if [ "$HAS_LTO" = true ]; then
  389. CXXFLAGS="$established_TEST_CXXFLAGS" CXXFLAGS_EXTRA="$TEST_CXXFLAGS_EXTRA" \
  390. LDFLAGS="$established_TEST_LDFLAGS" LDFLAGS_EXTRA="$TEST_LDFLAGS_EXTRA" \
  391. try_optional_cxx_argument TEST_CXXFLAGS -fsanitize=address,undefined
  392. else
  393. CXXFLAGS="$established_TEST_CXXFLAGS" CXXFLAGS_EXTRA="$TEST_CXXFLAGS_EXTRA" \
  394. LDFLAGS="$established_TEST_LDFLAGS" LDFLAGS_EXTRA="$TEST_LDFLAGS_EXTRA" \
  395. try_both_argument TEST_CXXFLAGS TEST_LDFLAGS -fsanitize=address,undefined
  396. fi
  397. fi
  398. ## Create mconfig
  399. rm -f testfile*
  400. info Creating mconfig...
  401. cat << _EOF > mconfig
  402. ## Auto-generated by "$0" for "$PLATFORM"
  403. # All changes will be lost if "$0" is re-run.
  404. # See BUILD for help on all variables.
  405. # Installation path options.
  406. SBINDIR=$SBINDIR
  407. MANDIR=$MANDIR
  408. SYSCONTROLSOCKET=$SYSCONTROLSOCKET
  409. # General build options.
  410. CXX=$CXX
  411. CXXFLAGS=$CXXFLAGS
  412. CXXFLAGS_EXTRA=$CXXFLAGS_EXTRA
  413. TEST_CXXFLAGS=$TEST_CXXFLAGS
  414. TEST_CXXFLAGS_EXTRA=$TEST_CXXFLAGS_EXTRA
  415. CPPFLAGS=$CPPFLAGS
  416. LDFLAGS_BASE=$LDFLAGS_BASE
  417. LDFLAGS=$LDFLAGS
  418. LDFLAGS_EXTRA=$LDFLAGS_EXTRA
  419. TEST_LDFLAGS_BASE=$TEST_LDFLAGS_BASE
  420. TEST_LDFLAGS=$TEST_LDFLAGS
  421. TEST_LDFLAGS_EXTRA=$TEST_LDFLAGS_EXTRA
  422. BUILD_SHUTDOWN=$BUILD_SHUTDOWN
  423. STRIPOPTS=$STRIPOPTS
  424. # Feature settings
  425. SUPPORT_CGROUPS=$SUPPORT_CGROUPS
  426. USE_INITGROUPS=$USE_INITGROUPS
  427. # Optional settings
  428. SHUTDOWN_PREFIX=${SHUTDOWN_PREFIX:-}
  429. # Service defaults
  430. DEFAULT_AUTO_RESTART=$DEFAULT_AUTO_RESTART
  431. DEFAULT_START_TIMEOUT=$DEFAULT_START_TIMEOUT
  432. DEFAULT_STOP_TIMEOUT=$DEFAULT_STOP_TIMEOUT
  433. _EOF
  434. if [ -n "${USE_UTMPX:-}" ]; then
  435. echo "USE_UTMPX=$USE_UTMPX" >> mconfig
  436. fi
  437. if [ -n "${CXX_FOR_BUILD:-}" ]; then
  438. {
  439. echo ""
  440. echo "# For cross-compiling"
  441. echo "CXX_FOR_BUILD=$CXX_FOR_BUILD"
  442. } >> mconfig
  443. fi
  444. if [ -n "${CXXFLAGS_FOR_BUILD:-}" ]; then
  445. echo "CXXFLAGS_FOR_BUILD=$CXXFLAGS_FOR_BUILD" >> mconfig
  446. fi
  447. if [ -n "${CPPFLAGS_FOR_BUILD:-}" ]; then
  448. echo "CPPFLAGS_FOR_BUILD=$CPPFLAGS_FOR_BUILD" >> mconfig
  449. fi
  450. if [ -n "${LDFLAGS_FOR_BUILD:-}" ]; then
  451. echo "LDFLAGS_FOR_BUILD=$LDFLAGS_FOR_BUILD" >> mconfig
  452. fi
  453. sub_info done.
  454. info Done!
  455. exit 0