runConfigureICU 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. #!/bin/sh
  2. # Copyright (C) 2016 and later: Unicode, Inc. and others.
  3. # License & terms of use: http://www.unicode.org/copyright.html
  4. # Copyright (c) 1999-2015, International Business Machines Corporation and
  5. # others. All Rights Reserved.
  6. # runConfigureICU: This script will run the "configure" script for the appropriate platform
  7. # Only supported platforms are recognized
  8. me=`basename $0`
  9. OPTS=
  10. usage()
  11. {
  12. ec=0$1
  13. if test $ec -eq 0
  14. then
  15. uletter=U
  16. else
  17. uletter=u
  18. fi
  19. echo "${uletter}sage: $me [ -h, --help ] [ --enable-debug | --disable-release ] platform [ configurearg ... ]"
  20. if test $ec -eq 0
  21. then
  22. cat <<EOE
  23. Options: -h, --help Print this message and exit
  24. --enable-debug Enable support for debugging
  25. --disable-release Disable presetting optimization flags
  26. If you want to add custom CFLAGS or CXXFLAGS or similar, provide them _before_
  27. the runConfigureICU command:
  28. CXXFLAGS=xyz path/to/runConfigureICU --enable-debug ...
  29. The following names can be supplied as the argument for platform:
  30. AIX Use the IBM Visual Age xlc_r/xlC_r compilers on AIX
  31. AIX/GCC Use the GNU gcc/g++ compilers on AIX
  32. Cygwin Use the GNU gcc/g++ compilers on Cygwin
  33. Cygwin/MSVC Use the Microsoft Visual C++ compiler on Cygwin
  34. Cygwin/MSVC2005 Use the Microsoft Visual C++ 2005 compiler on Cygwin
  35. Cygwin/ICL Use the Intel C++ compiler on Cygwin
  36. FreeBSD Use the clang/clang++ or GNU gcc/g++ compilers on FreeBSD
  37. HP-UX/ACC Use the HP ANSI C/Advanced C++ compilers on HP-UX 11
  38. IBMi Use the iCC compilers on IBM i, i5/OS, OS/400
  39. Linux Use the clang/clang++ or GNU gcc/g++ compilers on Linux
  40. Linux/gcc Use the GNU gcc/g++ compilers on Linux
  41. Linux/ECC Use the Intel ECC compiler on Linux
  42. Linux/ICC Use the Intel ICC compiler on Linux
  43. Linux/VA Use the IBM Visual Age compiler on Power PC Linux
  44. MacOSX Use the default compilers on MacOS X (Darwin)
  45. MacOSX/GCC Use the GNU gcc/g++ compilers on MacOSX (Darwin)
  46. MinGW Use the GNU gcc/g++ compilers on MinGW
  47. MSYS/MSVC Use the Microsoft Visual C++ computer on MSYS
  48. QNX Use the QNX QCC compiler on QNX/Neutrino
  49. Solaris Use the Sun cc/CC compilers on Solaris
  50. Solaris/GCC Use the GNU gcc/g++ compilers on Solaris
  51. SolarisX86 Use the Sun cc/CC compilers on Solaris x86
  52. TRU64V5.1/CXX Use the Compaq cxx compiler on Tru64 (OSF)
  53. zOS Use the IBM cxx compiler on z/OS (os/390)
  54. zOSV1R2 Use the IBM cxx compiler for z/OS 1.2
  55. EOE
  56. fi
  57. exit $ec
  58. }
  59. # Parse arguments
  60. platform=
  61. debug=0
  62. release=1
  63. while test $# -ne 0
  64. do
  65. case "$1" in
  66. -h|--help)
  67. usage 0
  68. ;;
  69. --enable-debug)
  70. debug=1
  71. OPTS="$OPTS --enable-debug"
  72. ;;
  73. --disable-release)
  74. release=0
  75. OPTS="$OPTS --disable-release"
  76. ;;
  77. *)
  78. platform="$1"
  79. shift
  80. break
  81. ;;
  82. esac
  83. shift
  84. done
  85. if test x$platform = x
  86. then
  87. usage 1
  88. fi
  89. # Go.
  90. rm -f config.cache
  91. rm -f config.log
  92. rm -f config.status
  93. DEBUG_CFLAGS='-g'
  94. DEBUG_CXXFLAGS='-g'
  95. if test x$configure = x
  96. then
  97. if test -f ./configure
  98. then
  99. configuredir=.
  100. else
  101. configuredir=`echo $0 | sed 's,[^/]*$,,'`
  102. if test x$configuredir = x$0
  103. then
  104. configuredir=.
  105. fi
  106. fi
  107. if test x$configuredir = x
  108. then
  109. configuredir=.
  110. fi
  111. configure=$configuredir/configure
  112. fi
  113. case $platform in
  114. AIX)
  115. THE_OS=AIX
  116. THE_COMP="xlC_r"
  117. CC=`which xlc_r`; export CC
  118. if [ ! -x $CC ]; then
  119. echo "ERROR: xlc_r was not found, please check the PATH to make sure it is correct."; exit 1
  120. fi
  121. CXX=`which xlC_r`; export CXX
  122. if [ ! -x $CXX ]; then
  123. echo "ERROR: xlC_r was not found, please check the PATH to make sure it is correct."; exit 1
  124. fi
  125. RELEASE_CFLAGS="-O2 -qmaxmem=-1"
  126. RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
  127. ;;
  128. AIX/GCC)
  129. THE_OS=AIX
  130. THE_COMP="the GNU C++"
  131. CC=gcc; export CC
  132. CXX=g++; export CXX
  133. DEBUG_CFLAGS='-g -O0'
  134. DEBUG_CXXFLAGS='-g -O0'
  135. ;;
  136. Solaris)
  137. THE_OS=SOLARIS
  138. THE_COMP="Sun's CC"
  139. CC=`which cc`; export CC
  140. CXX=`which CC`; export CXX
  141. RELEASE_CFLAGS="-xO1 -xlibmil"
  142. RELEASE_CXXFLAGS="-O4 -xlibmil"
  143. ;;
  144. Solaris/GCC)
  145. THE_OS=SOLARIS
  146. THE_COMP="the GNU C++"
  147. CC=gcc; export CC
  148. CXX=g++; export CXX
  149. RELEASE_CFLAGS=-O1
  150. RELEASE_CXXFLAGS=-O2
  151. ;;
  152. SolarisX86)
  153. THE_OS="SOLARIS X86"
  154. THE_COMP="Sun's CC"
  155. CC=`which cc`; export CC
  156. CXX=`which CC`; export CXX
  157. LDFLAGS="${LDFLAGS} -lCrun";export LDFLAGS
  158. RELEASE_CFLAGS=-xO3
  159. RELEASE_CXXFLAGS=-O3
  160. ;;
  161. HP-UX/ACC)
  162. THE_OS="HP-UX 11"
  163. THE_COMP="aCC"
  164. CC=cc; export CC
  165. CXX=aCC; export CXX
  166. RELEASE_CFLAGS='+O2 +Ofltacc'
  167. RELEASE_CXXFLAGS='+O2 +Ofltacc'
  168. ;;
  169. IBMi)
  170. THE_OS="IBM i"
  171. THE_COMP="the iCC C++"
  172. CC=icc; export CC
  173. CXX=icc; export CXX
  174. CPP="$CC -c -qpponly"; export CPP
  175. MAKE=gmake; export MAKE
  176. U_MAKE=gmake; export U_MAKE
  177. # gmake is a .pgm and may not be on the path. Don't use a full path, just use gmake.
  178. ac_cv_path_U_MAKE=gmake; export ac_cv_path_U_MAKE
  179. RELEASE_CFLAGS='-O4'
  180. RELEASE_CXXFLAGS='-O4'
  181. ;;
  182. Linux/ECC)
  183. THE_OS="Linux"
  184. THE_COMP="Intel ECC 7.1"
  185. CC=ecc; export CC
  186. CXX=ecpc; export CXX
  187. RELEASE_CFLAGS='-O2'
  188. RELEASE_CXXFLAGS='-O2'
  189. ;;
  190. Linux/ICC)
  191. THE_OS="Linux"
  192. CC=`which icc`; export CC
  193. CXX=`which icpc`; export CXX
  194. ICC_VER=`${CC} -v 2>&1`
  195. RELEASE_CFLAGS='-O'
  196. RELEASE_CXXFLAGS='-O'
  197. export CFLAGS="-fp-model precise"
  198. export CXXFLAGS="-fp-model precise"
  199. if [ "${ICC_VER}" = "Version 9.0 " ]; then
  200. RELEASE_CFLAGS=''
  201. RELEASE_CXXFLAGS=''
  202. export CFLAGS="${CFLAGS} -O0"
  203. export CXXFLAGS="${CXXFLAGS} -O0"
  204. echo "ICC 9.0 does not work with optimization- disabling optimizations"
  205. fi
  206. THE_COMP="Intel ${ICC_VER}"
  207. ;;
  208. Linux/VA)
  209. THE_OS="Linux"
  210. THE_COMP="IBM Visual Age C++ Compiler"
  211. CC=`which xlc_r`; export CC
  212. CXX=`which xlC_r`; export CXX
  213. RELEASE_CFLAGS="-O2 -qmaxmem=-1"
  214. RELEASE_CXXFLAGS="-O2 -qmaxmem=-1"
  215. ;;
  216. Linux/gcc)
  217. THE_OS="Linux"
  218. THE_COMP="the GNU C++"
  219. CC=gcc; export CC
  220. CXX=g++; export CXX
  221. RELEASE_CFLAGS='-O3'
  222. RELEASE_CXXFLAGS='-O3'
  223. DEBUG_CFLAGS='-g'
  224. DEBUG_CXXFLAGS='-g'
  225. ;;
  226. Linux*)
  227. THE_OS="Linux"
  228. THE_COMP="the clang or else GNU C++"
  229. RELEASE_CFLAGS='-O3'
  230. RELEASE_CXXFLAGS='-O3'
  231. DEBUG_CFLAGS='-g'
  232. DEBUG_CXXFLAGS='-g'
  233. ;;
  234. Cygwin)
  235. THE_OS="Cygwin"
  236. THE_COMP="the GNU C++"
  237. RELEASE_CFLAGS='-O3'
  238. RELEASE_CXXFLAGS='-O3'
  239. ;;
  240. Cygwin/MSVC)
  241. THE_OS="Windows with Cygwin"
  242. THE_COMP="Microsoft Visual C++"
  243. CC=cl; export CC
  244. CXX=cl; export CXX
  245. RELEASE_CFLAGS='-Gy -MD'
  246. RELEASE_CXXFLAGS='-Gy -MD'
  247. DEBUG_CFLAGS='-Zi -MDd'
  248. DEBUG_CXXFLAGS='-Zi -MDd'
  249. DEBUG_LDFLAGS='-DEBUG'
  250. ;;
  251. Cygwin/MSVC2005)
  252. THE_OS="Windows with Cygwin"
  253. THE_COMP="Microsoft Visual C++ 2005"
  254. CC=cl; export CC
  255. CXX=cl; export CXX
  256. RELEASE_CFLAGS='/Gy /MD'
  257. RELEASE_CXXFLAGS='/Gy /MD'
  258. DEBUG_CFLAGS='/Zi /MDd'
  259. DEBUG_CXXFLAGS='/Zi /MDd'
  260. DEBUG_LDFLAGS='/DEBUG'
  261. ;;
  262. Cygwin/ICL)
  263. THE_OS="Windows with Cygwin"
  264. THE_COMP="Intel C++"
  265. CC=icl; export CC
  266. CXX=icl; export CXX
  267. # The Intel compiler has optimization bugs. So we disable optimization.
  268. RELEASE_CFLAGS='/Od'
  269. RELEASE_CXXFLAGS='/Od'
  270. DEBUG_CFLAGS='/Zi'
  271. DEBUG_CXXFLAGS='/Zi'
  272. DEBUG_LDFLAGS='/DEBUG'
  273. ;;
  274. MacOSX)
  275. THE_OS="MacOS X (Darwin)"
  276. THE_COMP="the default"
  277. RELEASE_CFLAGS='-O2'
  278. RELEASE_CXXFLAGS='-O2'
  279. DEBUG_CFLAGS='-g -O0'
  280. DEBUG_CXXFLAGS='-g -O0'
  281. ;;
  282. MacOSX/GCC)
  283. THE_OS="MacOS X (Darwin)"
  284. THE_COMP="the GNU C++"
  285. RELEASE_CFLAGS='-O2'
  286. RELEASE_CXXFLAGS='-O2'
  287. DEBUG_CFLAGS='-g -O0'
  288. DEBUG_CXXFLAGS='-g -O0'
  289. CC=gcc; export CC
  290. CXX=g++; export CXX
  291. ;;
  292. MinGW)
  293. THE_OS="MinGW"
  294. THE_COMP="the GNU C++"
  295. RELEASE_CFLAGS='-O3'
  296. RELEASE_CXXFLAGS='-O3'
  297. CXXFLAGS="--std=c++03"
  298. export CXXFLAGS
  299. ;;
  300. MSYS/MSVC)
  301. THE_OS="MSYS"
  302. THE_COMP="Microsoft Visual C++"
  303. CC=cl; export CC
  304. CXX=cl; export CXX
  305. RELEASE_CFLAGS='-Gy -MD'
  306. RELEASE_CXXFLAGS='-Gy -MD'
  307. DEBUG_CFLAGS='-Zi -MDd'
  308. DEBUG_CXXFLAGS='-Zi -MDd'
  309. DEBUG_LDFLAGS='-DEBUG'
  310. ;;
  311. *BSD)
  312. THE_OS="BSD"
  313. THE_COMP="the GNU C++"
  314. DEBUG_CFLAGS='-g -O0'
  315. DEBUG_CXXFLAGS='-g -O0'
  316. ;;
  317. TRU64V5.1/CXX)
  318. THE_OS="OSF1"
  319. THE_COMP="Compaq cxx"
  320. CC=cc; export CC
  321. CXX=cxx; export CXX
  322. ;;
  323. QNX)
  324. THE_OS="QNX"
  325. THE_COMP="QNX cc"
  326. CC=qcc; export CC
  327. CXX=QCC; export CXX
  328. ;;
  329. zOS)
  330. THE_OS="z/OS (OS/390)"
  331. THE_COMP="z/OS C/C++"
  332. CC=xlc; export CC
  333. CXX=xlC; export CXX
  334. RELEASE_CFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'"
  335. RELEASE_CXXFLAGS="-O2 -Wc,'inline(AUTO,NOREPORT,1000,8000)'"
  336. ;;
  337. zOSV1R2)
  338. THE_OS="z/OS 1.2"
  339. THE_COMP="z/OS 1.2 C/C++"
  340. CC=cc; export CC
  341. CXX=cxx; export CXX
  342. export COMPILE_LINK_ENVVAR='_CXX_CICC_VER}=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000'
  343. export _CXX_CVERSION=0x41020000 _C89_CVERSION=0x41020000 _CC_CVERSION=0x41020000 _CXX_PVERSION=0x41020000 _C89_PVERSION=0x41020000 _CC_PVERSION=0x41020000
  344. export LDFLAGS="-Wl,'compat=pm3'"
  345. export CFLAGS="-Wc,'target(zOSV1R2)'"
  346. export CXXFLAGS="-Wc,'target(zOSV1R2)'"
  347. RELEASE_CFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
  348. RELEASE_CXXFLAGS="-2 -Wc,'inline(auto,noreport,500,4000)'"
  349. ;;
  350. *)
  351. >&2 echo "$me: unrecognized platform \"$platform\" (use --help for help)"
  352. exit 1;;
  353. esac
  354. # Tweak flags
  355. if test $release -eq 1
  356. then
  357. if test "$RELEASE_CFLAGS" = ""
  358. then
  359. case $CC in
  360. gcc|*/gcc|*-gcc-*|*/*-gcc-*)
  361. RELEASE_CFLAGS=-O3
  362. ;;
  363. esac
  364. fi
  365. if test "$RELEASE_CFLAGS" != ""
  366. then
  367. CFLAGS="$RELEASE_CFLAGS $CFLAGS"
  368. fi
  369. if test "$RELEASE_CXXFLAGS" = ""
  370. then
  371. case $CXX in
  372. g++|*/g++|*-g++-*|*/*-g++-*)
  373. RELEASE_CXXFLAGS=-O3
  374. ;;
  375. esac
  376. fi
  377. if test "$RELEASE_CXXFLAGS" != ""
  378. then
  379. CXXFLAGS="$RELEASE_CXXFLAGS $CXXFLAGS"
  380. fi
  381. if test "$RELEASE_LDFLAGS" != ""
  382. then
  383. LDFLAGS="$RELEASE_LDFLAGS $LDFLAGS"
  384. fi
  385. fi
  386. if test $debug -eq 1
  387. then
  388. if test "$DEBUG_CFLAGS" != ""
  389. then
  390. CFLAGS="$DEBUG_CFLAGS $CFLAGS"
  391. fi
  392. if test "$DEBUG_CXXFLAGS" != ""
  393. then
  394. CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS"
  395. fi
  396. if test "$DEBUG_LDFLAGS" != ""
  397. then
  398. LDFLAGS="$DEBUG_LDFLAGS $LDFLAGS"
  399. fi
  400. fi
  401. export CFLAGS
  402. export CXXFLAGS
  403. export LDFLAGS
  404. # Run configure
  405. echo "export CPP=$CPP CC=$CC CXX=$CXX CPPFLAGS=$CPPFLAGS CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS MAKE=$MAKE"
  406. echo "Running ./configure $OPTS $@ for $THE_OS using $THE_COMP compiler"
  407. echo
  408. if $configure $OPTS $@
  409. then
  410. echo
  411. echo If the result of the above commands looks okay to you, go to the directory
  412. echo source in the ICU distribution to build ICU. Please remember that ICU needs
  413. echo GNU make to build properly...
  414. else
  415. echo $0: ./configure failed
  416. exit 1
  417. fi