configure 9.7 KB

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