configure 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. #!/bin/sh
  2. # Copyright 2005 Douglas Gregor.
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  5. # boostinspect:notab - Tabs are required for the Makefile.
  6. BJAM=""
  7. TOOLSET=""
  8. BJAM_CONFIG=""
  9. BUILD=""
  10. PREFIX=/usr/local
  11. EPREFIX=
  12. LIBDIR=
  13. INCLUDEDIR=
  14. LIBS=""
  15. PYTHON=python
  16. PYTHON_VERSION=
  17. PYTHON_ROOT=
  18. ICU_ROOT=
  19. # Internal flags
  20. flag_no_python=
  21. flag_icu=
  22. flag_show_libraries=
  23. for option
  24. do
  25. case $option in
  26. -help | --help | -h)
  27. want_help=yes ;;
  28. -prefix=* | --prefix=*)
  29. PREFIX=`expr "x$option" : "x-*prefix=\(.*\)"`
  30. ;;
  31. -exec-prefix=* | --exec-prefix=*)
  32. EPREFIX=`expr "x$option" : "x-*exec-prefix=\(.*\)"`
  33. ;;
  34. -libdir=* | --libdir=*)
  35. LIBDIR=`expr "x$option" : "x-*libdir=\(.*\)"`
  36. ;;
  37. -includedir=* | --includedir=*)
  38. INCLUDEDIR=`expr "x$option" : "x-*includedir=\(.*\)"`
  39. ;;
  40. -show-libraries | --show-libraries )
  41. flag_show_libraries=yes
  42. ;;
  43. -with-bjam=* | --with-bjam=* )
  44. BJAM=`expr "x$option" : "x-*with-bjam=\(.*\)"`
  45. ;;
  46. -with-icu | --with-icu )
  47. flag_icu=yes
  48. ;;
  49. -with-icu=* | --with-icu=* )
  50. flag_icu=yes
  51. ICU_ROOT=`expr "x$option" : "x-*with-icu=\(.*\)"`
  52. ;;
  53. -with-libraries=* | --with-libraries=* )
  54. library_list=`expr "x$option" : "x-*with-libraries=\(.*\)"`
  55. if test "$library_list" != "all"; then
  56. old_IFS=$IFS
  57. IFS=,
  58. for library in $library_list
  59. do
  60. LIBS="$LIBS --with-$library"
  61. if test $library == python; then
  62. requested_python=yes
  63. fi
  64. done
  65. IFS=$old_IFS
  66. if test "x$requested_python" != xyes; then
  67. flag_no_python=yes
  68. fi
  69. fi
  70. ;;
  71. -without-libraries=* | --without-libraries=* )
  72. library_list=`expr "x$option" : "x-*without-libraries=\(.*\)"`
  73. old_IFS=$IFS
  74. IFS=,
  75. for library in $library_list
  76. do
  77. LIBS="$LIBS --without-$library"
  78. if test $library == python; then
  79. flag_no_python=yes
  80. fi
  81. done
  82. IFS=$old_IFS
  83. ;;
  84. -with-python=* | --with-python=* )
  85. PYTHON=`expr "x$option" : "x-*with-python=\(.*\)"`
  86. ;;
  87. -with-python-root=* | --with-python-root=* )
  88. PYTHON_ROOT=`expr "x$option" : "x-*with-python-root=\(.*\)"`
  89. ;;
  90. -with-python-version=* | --with-python-version=* )
  91. PYTHON_VERSION=`expr "x$option" : "x-*with-python-version=\(.*\)"`
  92. ;;
  93. -with-toolset=* | --with-toolset=* )
  94. TOOLSET=`expr "x$option" : "x-*with-toolset=\(.*\)"`
  95. ;;
  96. -*)
  97. { echo "error: unrecognized option: $option
  98. Try \`$0 --help' for more information." >&2
  99. { (exit 1); exit 1; }; }
  100. ;;
  101. esac
  102. done
  103. if test "x$want_help" = xyes; then
  104. cat <<EOF
  105. \`configure' configures Boost to adapt to a few kinds of systems.
  106. Usage: $0 [OPTION]...
  107. Defaults for the options are specified in brackets.
  108. Configuration:
  109. -h, --help display this help and exit
  110. --with-bjam=BJAM use existing Boost.Jam executable (bjam)
  111. [automatically built]
  112. --with-toolset=TOOLSET use specific Boost.Build toolset
  113. [automatically detected]
  114. --show-libraries show the set of libraries that require build
  115. and installation steps (i.e., those libraries
  116. that can be used with --with-libraries or
  117. --without-libraries), then exit
  118. --with-libraries=list build only a particular set of libraries,
  119. describing using either a comma-separated list of
  120. library names or "all"
  121. [all]
  122. --without-libraries=list build all libraries except the ones listed []
  123. --with-icu enable Unicode/ICU support in Regex [disabled]
  124. --with-icu=DIR specify the root of the ICU library installation
  125. and enable Unicode/ICU support in Regex [disabled]
  126. --with-python=PYTHON specify the Python executable [python]
  127. --with-python-root=DIR specify the root of the Python installation
  128. [automatically detected]
  129. --with-python-version=X.Y specify the Python version as X.Y
  130. [automatically detected]
  131. Installation directories:
  132. --prefix=PREFIX install Boost into the given PREFIX
  133. [/usr/local]
  134. --exec-prefix=EPREFIX install Boost binaries into the given EPREFIX
  135. [PREFIX]
  136. More precise control over installation directories:
  137. --libdir=DIR install libraries here [EPREFIX/lib]
  138. --includedir=DIR install headers here [PREFIX/include]
  139. EOF
  140. fi
  141. test -n "$want_help" && exit 0
  142. # TBD: Determine where the script is located
  143. my_dir="."
  144. # Determine the toolset, if not already decided
  145. if test "x$TOOLSET" == x; then
  146. TOOLSET=`$my_dir/tools/jam/src/build.sh --guess-toolset`
  147. fi
  148. rm -f config.log
  149. # Build bjam
  150. if test "x$BJAM" == x; then
  151. echo -n "Building Boost.Jam with toolset $TOOLSET... "
  152. pwd=`pwd`
  153. cd "$my_dir/tools/jam/src" && ./build.sh "$TOOLSET" > config.log 2>&1
  154. cd $pwd
  155. arch=`cd $my_dir/tools/jam/src && ./bootstrap/jam0 -d0 -f build.jam --toolset=$TOOLSET --toolset-root= --show-locate-target && cd ..`
  156. BJAM="$my_dir/tools/jam/src/$arch/bjam"
  157. echo "tools/jam/src/$arch/bjam"
  158. fi
  159. # TBD: Turn BJAM into an absolute path
  160. # If there is a list of libraries
  161. if test "x$flag_show_libraries" == xyes; then
  162. libraries=`$BJAM -d0 --show-libraries`
  163. cat <<EOF
  164. The following Boost libraries have portions that require a separate build
  165. and installation step. Any library not listed here can be used by including
  166. the headers only.
  167. The Boost libraries requiring separate building and installation are:
  168. EOF
  169. for lib in $libraries
  170. do
  171. echo " $lib"
  172. done
  173. exit 0
  174. fi
  175. # Setup paths
  176. if test "x$EPREFIX" == x; then
  177. EPREFIX=$PREFIX
  178. fi
  179. if test "x$LIBDIR" == x; then
  180. LIBDIR="$EPREFIX/lib"
  181. fi
  182. if test "x$INCLUDEDIR" == x; then
  183. INCLUDEDIR="$PREFIX/include"
  184. fi
  185. # Find Python
  186. if test "x$flag_no_python" == x; then
  187. if test "x$PYTHON_VERSION" == x; then
  188. echo -n "Detecting Python version... "
  189. PYTHON_VERSION=`$PYTHON -c "import sys; print (\"%d.%d\" % (sys.version_info[0], sys.version_info[1]))"`
  190. echo $PYTHON_VERSION
  191. fi
  192. if test "x$PYTHON_ROOT" == x; then
  193. echo -n "Detecting Python root... "
  194. PYTHON_ROOT=`$PYTHON -c "import sys; print sys.prefix"`
  195. echo $PYTHON_ROOT
  196. fi
  197. BJAM_CONFIG="$BJAM_CONFIG -sPYTHON_ROOT=$PYTHON_ROOT -sPYTHON_VERSION=$PYTHON_VERSION"
  198. fi
  199. # Configure ICU
  200. echo -n "Unicode/ICU support for Boost.Regex?... "
  201. if test "x$flag_icu" == xyes; then
  202. if test "x$ICU_ROOT" == x; then
  203. BJAM_CONFIG="$BJAM_CONFIG -sHAVE_ICU=1"
  204. echo "yes."
  205. else
  206. BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT"
  207. echo "$ICU_ROOT"
  208. fi
  209. else
  210. echo "no."
  211. fi
  212. # Generate the Makefile
  213. echo "Generating Makefile..."
  214. cat > Makefile <<EOF
  215. BJAM=$BJAM
  216. TOOLSET=$TOOLSET
  217. BJAM_CONFIG=$BJAM_CONFIG
  218. PREFIX=$PREFIX
  219. EPREFIX=$EPREFIX
  220. LIBDIR=$LIBDIR
  221. INCLUDEDIR=$INCLUDEDIR
  222. LIBS=$LIBS
  223. all: .dummy
  224. @echo "\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) \$(LIBS)"
  225. @\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) \$(LIBS) || \\
  226. echo "Not all Boost libraries built properly."
  227. clean: .dummy
  228. rm -rf bin
  229. distclean: clean
  230. rm -rf Makefile config.log
  231. check: .dummy
  232. @cd status && ../\$(BJAM) \$(BJAM_CONFIG) -sTOOLS=\$(TOOLSET) test || echo "Some Boost regression tests failed. This is normal."
  233. install: .dummy
  234. @echo "\$(BJAM) \$(BJAM_CONFIG) --prefix=\$(PREFIX) --exec-prefix=\$(EPREFIX) --libdir=\$(LIBDIR) --includedir=\$(INCLUDEDIR) -sTOOLS=\$(TOOLSET) \$(LIBS) install"
  235. @\$(BJAM) \$(BJAM_CONFIG) --prefix=\$(PREFIX) --exec-prefix=\$(EPREFIX) --libdir=\$(LIBDIR) --includedir=\$(INCLUDEDIR) -sTOOLS=\$(TOOLSET) \$(LIBS) install || echo "Not all Boost libraries built properly."
  236. .dummy:
  237. EOF
粤ICP备19079148号