configure 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. #! /bin/sh
  2. #
  3. # configure
  4. #
  5. # Configuration script for POCO.
  6. #
  7. # Invoke configure --help for help.
  8. #
  9. showhelp()
  10. {
  11. cat << ENDHELP
  12. usage: configure {options}
  13. Configure the POCO C++ Libraries.
  14. Options:
  15. --help
  16. Display this help screen.
  17. --config=<config_name>
  18. Use the given build configuration.
  19. Available configurations are:
  20. `ls -C $base/build/config/`
  21. --prefix=<install_prefix>
  22. Use the given install directory for make install.
  23. Default is /usr/local.
  24. --no-prefix
  25. Do not use /usr/local as default install directory and do not
  26. define POCO_PREFIX.
  27. --stdcxx-base=<apache_stdcxx_install_prefix>
  28. If (and only if) the $base/build/config selected with --config
  29. uses the Apache stdcxx library, then apache_stdcxx_install_prefix
  30. specifies the base directory where stdcxx is installed.
  31. --no-tests
  32. Do not build testsuites.
  33. --no-samples
  34. Do not build samples.
  35. --minimal
  36. Build only Foundation, XML, JSON, Util and Net.
  37. --typical (default)
  38. Build only Foundation, XML, JSON, Util, Net, Crypto, NetSSL, Data/SQLite and Zip.
  39. --everything
  40. Build everything.
  41. --no-wstring
  42. Compile with -DPOCO_NO_WSTRING.
  43. Useful if your C++ compiler does not support std::wstring
  44. (such as uClibc-based systems).
  45. --no-fpenvironment
  46. Compile with -DPOCO_NO_FPENVIRONMENT.
  47. Useful if your C++ compiler has incomplete floating-point support
  48. (such as uClibc-based systems).
  49. --no-sharedmemory
  50. Compile with -DPOCO_NO_SHAREDMEMORY.
  51. For systems that don't support shared memory API's,
  52. like uClibc-based Linux systems.
  53. --no-sharedlibs
  54. Compile with -DPOCO_NO_SHAREDLIBS.
  55. For systems that don't support shared library loading.
  56. --no-ipv6
  57. Compile with -DPOCO_NET_NO_IPv6.
  58. For systems that don't support IPv6.
  59. --sqlite-fts=<path>
  60. Compile with -DPOCO_DATA_SQLITE_FTS.
  61. Compile SQLite with Full Text Search support.
  62. --sqlite-thread-safe=<value>
  63. Compile with -DSQLITE_THREADSAFE=<value>.
  64. Valid values are:
  65. - 0 single-thread, no thread safety
  66. - 1 serial access, highest thread safety
  67. - 2 multi-threaded, without session sharing support
  68. --omit=<component>{,<component>}
  69. Do not build the specified component(s).
  70. Example: --omit=Data/MySQL,Data/ODBC,Zip
  71. --include-path=<path>
  72. Add search path for header files.
  73. --library-path=<path>
  74. Add search path for library files.
  75. --odbc-lib=<path>
  76. Specify the directory where ODBC library is located.
  77. --odbc-include=<path>
  78. Specify the directory where ODBC header files are located.
  79. --cflags=<flags>
  80. Pass additional flags to compiler.
  81. Example: --cflags=-wall
  82. --poquito
  83. Omit a few features for smaller codesize when linking
  84. statically for embedded targets.
  85. --unbundled
  86. Use system-provided zlib, pcre, expat and sqlite instead of
  87. bundled ones.
  88. --static
  89. Build static libraries. Overrides default mode, which
  90. depends upon target. Can be specified together
  91. with --shared to build both.
  92. --shared
  93. Build shared libraries. Overrides default mode, which
  94. depends upon target. Can be specified together
  95. with --static to build both.
  96. ENDHELP
  97. }
  98. # save cwd
  99. build=`pwd`
  100. # get directory where we are located
  101. cd `dirname $0`
  102. base=`pwd`
  103. cd $build
  104. tests=1
  105. samples=1
  106. noprefix=0
  107. flags=""
  108. includepath=""
  109. librarypath=""
  110. odbclib=""
  111. odbcinclude=""
  112. unbundled=""
  113. static=""
  114. shared=""
  115. omitMinimal="Crypto NetSSL_OpenSSL Zip Data Data/SQLite Data/ODBC Data/MySQL MongoDB PDF CppParser PageCompiler"
  116. omitTypical="Data/ODBC Data/MySQL MongoDB PDF CppParser"
  117. omit=$omitTypical
  118. # parse arguments
  119. while [ $# -ge 1 ]; do
  120. case "$1" in
  121. --config=*)
  122. config="`echo ${1} | awk '{print substr($0,10)}'`" ;;
  123. --prefix=*)
  124. prefix="`echo ${1} | awk '{print substr($0,10)}'`" ;;
  125. --no-prefix)
  126. noprefix=1 ;;
  127. --stdcxx-base=*)
  128. stdcxx_base="`echo ${1} | awk '{print substr($0,15)}'`" ;;
  129. --omit=*)
  130. omit="`echo ${1} | awk '{print substr($0,8)}' | tr ',;' ' '`" ;;
  131. --include-path=*)
  132. includepath="`echo ${1} | awk '{print substr($0,16)}' | tr ',;' ' '`" ;;
  133. --library-path=*)
  134. librarypath="`echo ${1} | awk '{print substr($0,16)}' | tr ',;' ' '`" ;;
  135. --odbc-lib=*)
  136. odbclib="`echo ${1} | awk '{print substr($0,12)}'`" ;;
  137. --odbc-include=*)
  138. odbcinclude="`echo ${1} | awk '{print substr($0,16)}'`" ;;
  139. --cflags=*)
  140. flags="$flags `echo ${1} | awk '{print substr($0,10)}'`" ;;
  141. --no-samples)
  142. samples="" ;;
  143. --no-tests)
  144. tests="" ;;
  145. --no-wstring)
  146. flags="$flags -DPOCO_NO_WSTRING" ;;
  147. --no-fpenvironment)
  148. flags="$flags -DPOCO_NO_FPENVIRONMENT" ;;
  149. --no-sharedmemory)
  150. flags="$flags -DPOCO_NO_SHAREDMEMORY" ;;
  151. --no-sharedlibs)
  152. flags="$flags -DPOCO_NO_SHAREDLIBS" ;;
  153. --no-ipv6)
  154. flags="$flags -DPOCO_NET_NO_IPv6" ;;
  155. --sqlite-thread-safe=*)
  156. flags="$flags -DSQLITE_THREADSAFE=`echo ${1} | awk '{print substr($0,22)}'`" ;;
  157. --sqlite-fts)
  158. flags="$flags -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS" ;;
  159. --poquito)
  160. flags="$flags -DPOCO_NO_FILECHANNEL -DPOCO_NO_SPLITTERCHANNEL -DPOCO_NO_SYSLOGCHANNEL -DPOCO_UTIL_NO_INIFILECONFIGURATION -DPOCO_UTIL_NO_JSONCONFIGURATION -DPOCO_UTIL_NO_XMLCONFIGURATION" ;;
  161. --unbundled)
  162. flags="$flags -DPOCO_UNBUNDLED"
  163. unbundled=1
  164. ;;
  165. --minimal)
  166. omit=$omitMinimal ;;
  167. --typical)
  168. omit=$omitTypical ;;
  169. --everything)
  170. omit="" ;;
  171. --static)
  172. static=1 ;;
  173. --shared)
  174. shared=1 ;;
  175. --help)
  176. showhelp
  177. exit 0
  178. ;;
  179. *)
  180. showhelp
  181. exit 1
  182. ;;
  183. esac
  184. shift
  185. done
  186. # autodetect build environment
  187. # ...special cases for CYGWIN or MinGW
  188. if [ "$config" = "" ] ; then
  189. config=`uname`
  190. case "$config" in
  191. CYGWIN*)
  192. config=CYGWIN ;;
  193. MINGW*)
  194. config=MinGW ;;
  195. esac
  196. fi
  197. if [ ! -f "$base/build/config/$config" ] ; then
  198. echo "Unknown configuration: $config"
  199. echo "Please use the --config option to specify another build configuration"
  200. echo "The following configurations are available:"
  201. ls $base/build/config
  202. exit 1
  203. fi
  204. if [ -z "$prefix" ] ; then
  205. if [ $noprefix -eq 0 ] ; then
  206. prefix=/usr/local
  207. fi
  208. fi
  209. # check for patches
  210. if [ -d $base/patches/$config ] ; then
  211. echo "NOTE: There are patches for your configuration available. Please apply them before compiling."
  212. fi
  213. # copy Makefile to build dir
  214. if [ "$base" != "$build" ] ; then
  215. cp $base/Makefile $build
  216. fi
  217. if [ -n "$static" -a -n "$shared" ] ; then
  218. linkmode=BOTH
  219. elif [ -n "$static" ] ; then
  220. linkmode=STATIC
  221. elif [ -n "$shared" ] ; then
  222. linkmode=SHARED
  223. else
  224. linkmode=""
  225. fi
  226. # create config.make
  227. echo '# config.make generated by configure script' >$build/config.make
  228. echo "POCO_CONFIG = $config" >>$build/config.make
  229. echo "POCO_BASE = $base" >>$build/config.make
  230. echo "POCO_BUILD = $build" >>$build/config.make
  231. echo "POCO_FLAGS = $flags" >>$build/config.make
  232. if [ -n "$prefix" ] ; then
  233. echo "POCO_PREFIX = $prefix" >>$build/config.make
  234. fi
  235. echo "OMIT = $omit" >>$build/config.make
  236. if [ -n "$stdcxx_base" ] ; then
  237. echo "STDCXX_BASE = $stdcxx_base" >>$build/config.make
  238. fi
  239. if [ -n "$includepath" ] ; then
  240. echo "POCO_ADD_INCLUDE = $includepath" >>$build/config.make
  241. fi
  242. if [ -n "$librarypath" ] ; then
  243. echo "POCO_ADD_LIBRARY = $librarypath" >>$build/config.make
  244. fi
  245. if [ -n "$odbclib" ] ; then
  246. echo "POCO_ODBC_LIB = $odbclib" >>$build/config.make
  247. fi
  248. if [ -n "$odbcinclude" ] ; then
  249. echo "POCO_ODBC_INCLUDE = $odbcinclude" >>$build/config.make
  250. fi
  251. if [ -n "$unbundled" ] ; then
  252. echo "POCO_UNBUNDLED = 1" >>$build/config.make
  253. fi
  254. if [ -n "$linkmode" ] ; then
  255. echo "LINKMODE = $linkmode" >>$build/config.make
  256. fi
  257. cat <<__EOF__ >>$build/config.make
  258. export POCO_CONFIG
  259. export POCO_BASE
  260. export POCO_BUILD
  261. export POCO_FLAGS
  262. __EOF__
  263. if [ -n "$prefix" ] ; then
  264. echo "export POCO_PREFIX" >>$build/config.make
  265. fi
  266. if [ -n "$stdcxx_base" ] ; then
  267. echo "export STDCXX_BASE" >>$build/config.make
  268. fi
  269. if [ -n "$includepath" ] ; then
  270. echo "export POCO_ADD_INCLUDE" >>$build/config.make
  271. fi
  272. if [ -n "$librarypath" ] ; then
  273. echo "export POCO_ADD_LIBRARY" >>$build/config.make
  274. fi
  275. if [ -n "$odbclib" ] ; then
  276. echo "export POCO_ODBC_LIB" >>$build/config.make
  277. fi
  278. if [ -n "$odbcinclude" ] ; then
  279. echo "export POCO_ODBC_INCLUDE" >>$build/config.make
  280. fi
  281. if [ -n "$unbundled" ] ; then
  282. echo "export POCO_UNBUNDLED" >>$build/config.make
  283. fi
  284. if [ -n "$linkmode" ] ; then
  285. echo "export LINKMODE" >>$build/config.make
  286. fi
  287. # create config.build
  288. echo '# config.build generated by configure script' >$build/config.build
  289. cat <<__EOF__ >>$build/config.build
  290. TESTS = $tests
  291. SAMPLES = $samples
  292. __EOF__
  293. echo "Configured for $config"