configure 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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, halt programs []
  128. --enable-shutdown Build shutdown, poweroff, reboot, halt programs [Enabled only on Linux systems]
  129. --disable-shutdown Don't build shutdown, poweroff, 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 [Enabled]
  137. --disable-auto-restart Disable auto-restart for services by default
  138. --default-start-timeout=sec Default start-timeout for services [60]
  139. --default-stop-timeout=sec Default stop-timeout for services [10]
  140. Build variables:
  141. Note: build variables can be passed in the environment, or as $0 argument (as "var=VALUE").
  142. Note: CXXFLAGS, TEST_CXXFLAGS, LDFLAGS and TEST_LDFLAGS by default will be set to options considered suitable
  143. for the platform, filtered to remove any options not supported by the compiler/linker. To disable this,
  144. specify the values explicitly (an empty string is accepted). To add options without removing the defaults,
  145. set the variable with _EXTRA appended to the name (eg CXXFLAGS_EXTRA).
  146. CXX C++ compiler
  147. CXX_FOR_BUILD C++ compiler generating code for the build system (for cross-compiles).
  148. CXXFLAGS_FOR_BUILD Flags to use when generating code for the build system.
  149. Defaults to the value of CXXFLAGS.
  150. CPPFLAGS_FOR_BUILD Preprocessor flags to use when generating code for the build system.
  151. Defaults to the value of CPPFLAGS.
  152. LDFLAGS_FOR_BUILD Link flags to use when generating code for the build system.
  153. Defaults to the value of LDFLAGS.
  154. CXXFLAGS Flags to use when compiling C++ code.
  155. CXXFLAGS_EXTRA Additional flags to use when compiling C++ code.
  156. TEST_CXXFLAGS Flags to use when compiling C++ code in tests.
  157. TEST_CXXFLAGS_EXTRA Additional flags to use when compiling C++ code in tests.
  158. CPPFLAGS Preprocessor flags to use when compiling C++ code.
  159. LDFLAGS Link flags.
  160. LDFLAGS_EXTRA Additional link flags.
  161. LDFLAGS_BASE Link flags to use in addition to any link-time optimisation
  162. (LTO)-related options. Set this to control link options without
  163. disabling LTO. Ignored if LDFLAGS is set.
  164. TEST_LDFLAGS Links flags when building test executables.
  165. TEST_LDFLAGS_EXTRA Additional link flags when building test executables.
  166. TEST_LDFLAGS_BASE Link flags to use when building test executables, in addition to
  167. LTO-releated options.
  168. Note: paths specified via --prefix/--exec-prefix/--sbindir/--mandir, and build variable values, must be
  169. escaped for use in a makefile and in shell commands. If there are spaces in paths it is recommended to
  170. prepend a backslash (\) to them.
  171. For example: ./configure --prefix="/home/my\ home"
  172. See BUILD file for more information.
  173. _EOF
  174. exit 0
  175. }
  176. ## Don't take values from environment for these variables:
  177. for var in PREFIX \
  178. EPREFIX \
  179. SBINDIR \
  180. MANDIR \
  181. SHUTDOWN_PREFIX \
  182. BUILD_SHUTDOWN \
  183. SUPPORT_CGROUPS \
  184. USE_UTMPX \
  185. USE_INITGROUPS \
  186. SYSCONTROLSOCKET \
  187. STRIPOPTS
  188. do
  189. unset $var
  190. done
  191. ## Flag parser
  192. for arg in "$@"; do
  193. case "$arg" in
  194. -h|--help) usage ;;
  195. -q|--quiet)
  196. info() { true; }
  197. sub_info() { true; }
  198. warning() { true; }
  199. ;;
  200. -c|--clear) rm -f test* & rm -f mconfig && exit 0 ;;
  201. --platform=*) PLATFORM="${arg#*=}" && shift ;;
  202. --prefix=*) PREFIX="${arg#*=}" && shift ;;
  203. --exec-prefix=*) EPREFIX="${arg#*=}" && shift;;
  204. --sbindir=*) SBINDIR="${arg#*=}" && shift ;;
  205. --mandir=*) MANDIR="${arg#*=}" && shift ;;
  206. --default-start-timeout=*) DEFAULT_START_TIMEOUT="${arg#*=}" && shift ;;
  207. --default-stop-timeout=*) DEFAULT_STOP_TIMEOUT="${arg#*=}" && shift ;;
  208. --syscontrolsocket=*) SYSCONTROLSOCKET="${arg#*=}" && shift ;;
  209. --shutdown-prefix=*) SHUTDOWN_PREFIX="${arg#*=}" && shift ;;
  210. --enable-shutdown|--enable-shutdown=yes) BUILD_SHUTDOWN=yes ;;
  211. --disable-shutdown|--enable-shutdown=no) BUILD_SHUTDOWN=no ;;
  212. --enable-cgroups|--enable-cgroups=yes) SUPPORT_CGROUPS=1 ;;
  213. --disable-cgroups|--enable-cgroups=no) SUPPORT_CGROUPS=0 ;;
  214. --enable-utmpx|--enable-utmpx=yes) USE_UTMPX=1 ;;
  215. --disable-utmpx|--enable-utmpx=no) USE_UTMPX=0 ;;
  216. --enable-initgroups|--enable-initgroups=yes) USE_INITGROUPS=1 ;;
  217. --disable-initgroups|--enable-initgroups=no) USE_INITGROUPS=0 ;;
  218. --enable-auto-restart|--enable-auto-restart=yes) DEFAULT_AUTO_RESTART=true ;;
  219. --disable-auto-restart|--enable-auto-restart=no) DEFAULT_AUTO_RESTART=false ;;
  220. --enable-strip|--enable-strip=yes) STRIPOPTS="-s" ;;
  221. --disable-strip|--enable-strip=no) STRIPOPTS="" ;;
  222. CXX=*|CXX_FOR_BUILD=*|CXXFLAGS_FOR_BUILD=*|CPPFLAGS_FOR_BUILD=*\
  223. |LDFLAGS_FOR_BUILD=*|CXXFLAGS=*|CXXFLAGS_EXTRA=*|TEST_CXXFLAGS=*\
  224. |TEST_CXXFLAGS_EXTRA=*|LDFLAGS=*|LDFLAGS_EXTRA=*|TEST_LDFLAGS=*\
  225. |TEST_LDFLAGS_EXTRA=*|CPPFLAGS=*|LDFLAGS_BASE=*|TEST_LDFLAGS_BASE=*) eval "${arg%%=*}=\${arg#*=}" ;;
  226. *=*) warning "Unknown variable: ${arg%%=*}" ;;
  227. *) warning "Unknown argument: $arg" ;;
  228. esac
  229. done
  230. ## Defaults for variables not specified by user
  231. : "${PLATFORM:=$(uname)}"
  232. : "${PREFIX:="/usr"}"
  233. : "${EPREFIX:="/"}"
  234. : "${SBINDIR:="${EPREFIX%%/}/sbin"}"
  235. : "${MANDIR:="${PREFIX%%/}/share/man"}"
  236. : "${SHUTDOWN_PREFIX:=""}"
  237. : "${CXXFLAGS_EXTRA:=""}"
  238. : "${TEST_CXXFLAGS_EXTRA:=""}"
  239. : "${CPPFLAGS:=""}"
  240. : "${LDFLAGS_EXTRA:=""}"
  241. : "${TEST_LDFLAGS_EXTRA:=""}"
  242. : "${DEFAULT_AUTO_RESTART:="true"}"
  243. : "${DEFAULT_START_TIMEOUT:="60"}"
  244. : "${DEFAULT_STOP_TIMEOUT:="10"}"
  245. : "${USE_INITGROUPS:="1"}"
  246. if [ "$PLATFORM" = "Linux" ]; then
  247. : "${BUILD_SHUTDOWN:="yes"}"
  248. : "${SUPPORT_CGROUPS:="1"}"
  249. : "${SYSCONTROLSOCKET:="/run/dinitctl"}"
  250. else
  251. : "${BUILD_SHUTDOWN:="no"}"
  252. : "${SUPPORT_CGROUPS:="0"}"
  253. : "${SYSCONTROLSOCKET:="/var/run/dinitctl"}"
  254. fi
  255. HAS_LTO=""
  256. ## Finalize $CXXFLAGS, $TEST_CXXFLAGS, $LDFLAGS, $TEST_LDFLAGS, $STRIPOPTS
  257. if [ -z "${CXXFLAGS+IS_SET}" ]; then
  258. CXXFLAGS=""
  259. AUTO_CXXFLAGS="true"
  260. else
  261. AUTO_CXXFLAGS="false"
  262. fi
  263. if [ -z "${TEST_CXXFLAGS+IS_SET}" ]; then
  264. TEST_CXXFLAGS=""
  265. AUTO_TEST_CXXFLAGS="true"
  266. else
  267. AUTO_TEST_CXXFLAGS="false"
  268. fi
  269. if [ -z "${LDFLAGS+IS_SET}" ]; then
  270. LDFLAGS=""
  271. AUTO_LDFLAGS="true"
  272. else
  273. AUTO_LDFLAGS="false"
  274. fi
  275. if [ -z "${TEST_LDFLAGS+IS_SET}" ]; then
  276. TEST_LDFLAGS=""
  277. AUTO_TEST_LDFLAGS="true"
  278. else
  279. AUTO_TEST_LDFLAGS="false"
  280. fi
  281. if [ -z "${LDFLAGS_BASE+IS_SET}" ]; then
  282. LDFLAGS_BASE=""
  283. AUTO_LDFLAGS_BASE="true"
  284. else
  285. AUTO_LDFLAGS_BASE="false"
  286. fi
  287. if [ -z "${TEST_LDFLAGS_BASE+IS_SET}" ]; then
  288. TEST_LDFLAGS_BASE=""
  289. AUTO_TEST_LDFLAGS_BASE="true"
  290. else
  291. AUTO_TEST_LDFLAGS=BASE="false"
  292. fi
  293. [ -z "${STRIPOPTS+IS_SET}" ] && STRIPOPTS="-s"
  294. ## Verify PLATFORM value
  295. if [ "$PLATFORM" != "Linux" ] && [ "$PLATFORM" != "FreeBSD" ] && \
  296. [ "$PLATFORM" != "OpenBSD" ] && [ "$PLATFORM" != "Darwin" ]; then
  297. warning "$PLATFORM platform is unknown!" "Known Platforms are: Linux, FreeBSD, OpenBSD, Darwin"
  298. fi
  299. ## Create testfile.cc to test c++ compiler
  300. echo "int main(int argc, char **argv) { return 0; }" > testfile.cc || error Can\'t create temporary file
  301. ## Find and test C++ compiler
  302. if [ -z "${CXX:-}" ]; then
  303. info Checking C++ compiler...
  304. for guess in g++ clang++ c++; do
  305. if type "$guess" > /dev/null 2>&1; then
  306. CXX="$guess"
  307. sub_info "$CXX"
  308. break # Found
  309. fi
  310. done
  311. if [ -z "${CXX:-}" ]; then
  312. sub_error No C++ compiler found! # Not found
  313. fi
  314. fi
  315. cxx_works "$CXX"
  316. if [ -n "${CXX_FOR_BUILD:-}" ]; then
  317. cxx_works "$CXX_FOR_BUILD"
  318. fi
  319. ## Test compiler/linker supported arguments
  320. if [ "$AUTO_CXXFLAGS" = "true" ]; then
  321. if ! try_cxx_argument CXXFLAGS -std=c++11; then
  322. sub_error "The C++ compiler ($CXX) doesn't accept '-std=c++11' and may be too old."
  323. fi
  324. for argument in -Wall \
  325. -Os \
  326. -fno-plt
  327. do
  328. try_optional_cxx_argument CXXFLAGS $argument
  329. done
  330. if [ "$PLATFORM" != "Darwin" ]; then
  331. try_optional_cxx_argument CXXFLAGS -fno-rtti
  332. fi
  333. fi
  334. if [ "$AUTO_LDFLAGS" = "true" ] && [ "$AUTO_CXXFLAGS" = "true" ]; then
  335. if try_cxx_argument CXXFLAGS -flto; then
  336. HAS_LTO="true"
  337. else
  338. HAS_LTO="false"
  339. fi
  340. fi
  341. if [ "$AUTO_LDFLAGS_BASE" = true ] && [ "$PLATFORM" = FreeBSD ]; then
  342. try_ld_argument LDFLAGS_BASE -lrt
  343. fi
  344. if [ "$AUTO_TEST_LDFLAGS_BASE" = true ]; then
  345. TEST_LDFLAGS_BASE="\$(LDFLAGS_BASE)"
  346. established_TEST_LDFLAGS="$LDFLAGS_BASE"
  347. else
  348. established_TEST_LDFLAGS="$TEST_LDFLAGS_BASE"
  349. fi
  350. # Determine LDFLAGS/TEST_LDFLAGS. In the case of TEST_LDFLAGS we may still add sanitisation
  351. # options, shortly.
  352. if [ "$HAS_LTO" = true ]; then
  353. if [ "$AUTO_LDFLAGS" = true ]; then
  354. LDFLAGS="\$(LDFLAGS_BASE) \$(CXXFLAGS)"
  355. fi
  356. if [ "$AUTO_TEST_LDFLAGS" = true ]; then
  357. TEST_LDFLAGS="\$(TEST_LDFLAGS_BASE) \$(TEST_CXXFLAGS)"
  358. established_TEST_LDFLAGS="$established_TEST_LDFLAGS $TEST_CXXFLAGS"
  359. else
  360. established_TEST_LDFLAGS="$TEST_LDFLAGS"
  361. fi
  362. else
  363. # default LDFLAGS are just $(LDFLAGS_BASE)
  364. if [ "$AUTO_LDFLAGS" = true ]; then
  365. LDFLAGS="\$(LDFLAGS_BASE)"
  366. fi
  367. if [ "$AUTO_TEST_LDFLAGS" = true ]; then
  368. TEST_LDFLAGS="\$(TEST_LDFLAGS_BASE)"
  369. else
  370. established_TEST_LDFLAGS="$TEST_LDFLAGS"
  371. fi
  372. fi
  373. # Default for test flags (TEST_CXXFLAGS, TEST_LDFLAGS) is to use the build flags
  374. if [ "$AUTO_TEST_CXXFLAGS" = "true" ]; then
  375. TEST_CXXFLAGS="\$(CXXFLAGS)"
  376. established_TEST_CXXFLAGS="$CXXFLAGS"
  377. else
  378. established_TEST_CXXFLAGS="$TEST_CXXFLAGS"
  379. fi
  380. # Check whether sanitizers can be used for tests
  381. if [ "$AUTO_TEST_LDFLAGS" = "true" ] && [ "$AUTO_TEST_CXXFLAGS" = "true" ]; then
  382. if [ "$HAS_LTO" = true ]; then
  383. CXXFLAGS="$established_TEST_CXXFLAGS" CXXFLAGS_EXTRA="$TEST_CXXFLAGS_EXTRA" \
  384. LDFLAGS="$established_TEST_LDFLAGS" LDFLAGS_EXTRA="$TEST_LDFLAGS_EXTRA" \
  385. try_optional_cxx_argument TEST_CXXFLAGS -fsanitize=address,undefined
  386. else
  387. CXXFLAGS="$established_TEST_CXXFLAGS" CXXFLAGS_EXTRA="$TEST_CXXFLAGS_EXTRA" \
  388. LDFLAGS="$established_TEST_LDFLAGS" LDFLAGS_EXTRA="$TEST_LDFLAGS_EXTRA" \
  389. try_both_argument TEST_CXXFLAGS TEST_LDFLAGS -fsanitize=address,undefined
  390. fi
  391. fi
  392. ## Create mconfig
  393. rm -f testfile*
  394. info Creating mconfig...
  395. cat << _EOF > mconfig
  396. ## Auto-generated by "$0" for "$PLATFORM"
  397. # All changes will be lost if "$0" is re-run.
  398. # See BUILD for help on all variables.
  399. # Installation path options.
  400. SBINDIR=$SBINDIR
  401. MANDIR=$MANDIR
  402. SYSCONTROLSOCKET=$SYSCONTROLSOCKET
  403. # General build options.
  404. CXX=$CXX
  405. CXXFLAGS=$CXXFLAGS
  406. CXXFLAGS_EXTRA=$CXXFLAGS_EXTRA
  407. TEST_CXXFLAGS=$TEST_CXXFLAGS
  408. TEST_CXXFLAGS_EXTRA=$TEST_CXXFLAGS_EXTRA
  409. CPPFLAGS=$CPPFLAGS
  410. LDFLAGS_BASE=$LDFLAGS_BASE
  411. LDFLAGS=$LDFLAGS
  412. LDFLAGS_EXTRA=$LDFLAGS_EXTRA
  413. TEST_LDFLAGS_BASE=$TEST_LDFLAGS_BASE
  414. TEST_LDFLAGS=$TEST_LDFLAGS
  415. TEST_LDFLAGS_EXTRA=$TEST_LDFLAGS_EXTRA
  416. BUILD_SHUTDOWN=$BUILD_SHUTDOWN
  417. STRIPOPTS=$STRIPOPTS
  418. # Feature settings
  419. SUPPORT_CGROUPS=$SUPPORT_CGROUPS
  420. USE_INITGROUPS=$USE_INITGROUPS
  421. # Optional settings
  422. SHUTDOWN_PREFIX=${SHUTDOWN_PREFIX:-}
  423. # Service defaults
  424. DEFAULT_AUTO_RESTART=$DEFAULT_AUTO_RESTART
  425. DEFAULT_START_TIMEOUT=$DEFAULT_START_TIMEOUT
  426. DEFAULT_STOP_TIMEOUT=$DEFAULT_STOP_TIMEOUT
  427. _EOF
  428. if [ -n "${USE_UTMPX:-}" ]; then
  429. echo "USE_UTMPX=$USE_UTMPX" >> mconfig
  430. fi
  431. if [ -n "${CXX_FOR_BUILD:-}" ]; then
  432. {
  433. echo ""
  434. echo "# For cross-compiling"
  435. echo "CXX_FOR_BUILD=$CXX_FOR_BUILD"
  436. } >> mconfig
  437. fi
  438. if [ -n "${CXXFLAGS_FOR_BUILD:-}" ]; then
  439. echo "CXXFLAGS_FOR_BUILD=$CXXFLAGS_FOR_BUILD" >> mconfig
  440. fi
  441. if [ -n "${CPPFLAGS_FOR_BUILD:-}" ]; then
  442. echo "CPPFLAGS_FOR_BUILD=$CPPFLAGS_FOR_BUILD" >> mconfig
  443. fi
  444. if [ -n "${LDFLAGS_FOR_BUILD:-}" ]; then
  445. echo "LDFLAGS_FOR_BUILD=$LDFLAGS_FOR_BUILD" >> mconfig
  446. fi
  447. sub_info done.
  448. info Done!
  449. exit 0