configure.host 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. # configure.host
  2. # This shell script handles all host based configuration for libgcj.
  3. # It sets various shell variables based on the the host and the
  4. # configuration options. You can modify this shell script without
  5. # needing to rerun autoconf.
  6. # This shell script should be invoked as
  7. # . configure.host
  8. # If it encounters an error, it will exit with a message.
  9. # It uses the following shell variables:
  10. # host The configuration host
  11. # host_cpu The configuration host CPU
  12. # target_optspace --enable-target-optspace ("yes", "no", "")
  13. # It sets the following shell variables:
  14. # libgcj_cflags Special CFLAGS to use when building
  15. # libgcj_cxxflags Special CXXFLAGS to use when building
  16. # libgcj_javaflags Special JAVAFLAGS to use when building
  17. # libgcj_sublib_ltflags Special Libtool flags to use when building sublibs
  18. # libgcj_sublib_core_extra_deps Extra dependencies to add to core sublib
  19. # libgcj_interpreter If the bytecode interpreter supports this platform.
  20. # enable_java_net_default If java.net native code should be enabled by
  21. # default.
  22. # enable_hash_synchronization_default If hash synchronization should be
  23. # enabled by default.
  24. # enable_libgcj_sublibs_default Whether to build libgcj as a bunch of
  25. # separate shared libraries or in one
  26. # monolithic one.
  27. # sysdeps_dir Directory containing system-dependent headers
  28. # slow_pthread_self The synchronization code should try to avoid
  29. # pthread_self calls by caching thread IDs in a hashtable
  30. # can_unwind_signal Set to "yes" if the EH unwinder supports throwing
  31. # from a signal handler.
  32. # fallback_backtrace_h Header to use for fallback backtrace implementation
  33. # (only for targets that don't support DWARF2 unwind)
  34. # descriptor_h Header to use for looking past function descriptors
  35. # use_libgcj_bc Whether to build a "libgcj-bc" library for BC-ABI
  36. # binaries to link against.
  37. libgcj_flags=
  38. libgcj_cflags=
  39. libgcj_cxxflags=
  40. libgcj_javaflags=
  41. libgcj_sublib_ltflags=
  42. libgcj_sublib_core_extra_deps=
  43. libgcj_interpreter=
  44. enable_java_net_default=yes
  45. enable_hash_synchronization_default=no
  46. enable_libgcj_sublibs_default=no
  47. sysdeps_dir=generic
  48. slow_pthread_self=
  49. can_unwind_signal=no
  50. fallback_backtrace_h=sysdep/generic/backtrace.h
  51. case "${target_optspace}:${host}" in
  52. yes:*)
  53. libgcj_flags="${libgcj_flags} -Os"
  54. ;;
  55. :m32r-* | :d10v-* | :d30v-*)
  56. libgcj_flags="${libgcj_flags} -Os"
  57. ;;
  58. no:* | :*)
  59. # Nothing.
  60. ;;
  61. esac
  62. AM_RUNTESTFLAGS=
  63. # Set any host dependent compiler flags.
  64. # THIS TABLE IS SORTED. KEEP IT THAT WAY.
  65. echo "$target"
  66. DIVIDESPEC=-fuse-divide-subroutine
  67. EXCEPTIONSPEC=-fnon-call-exceptions
  68. CHECKREFSPEC=
  69. BACKTRACESPEC=
  70. ATOMICSPEC=
  71. # This case statement supports per-CPU defaults.
  72. case "${host}" in
  73. aarch64*-linux*)
  74. libgcj_interpreter=yes
  75. sysdeps_dir=aarch64
  76. ATOMICSPEC=-fuse-atomic-builtins
  77. ;;
  78. arm*-elf)
  79. with_libffi_default=no
  80. PROCESS=Ecos
  81. FILE=Posix
  82. CHECKREFSPEC=-fcheck-references
  83. EXCEPTIONSPEC=
  84. enable_java_net_default=no
  85. enable_getenv_properties_default=no
  86. enable_main_args_default=no
  87. sysdeps_dir=arm
  88. ;;
  89. arm*-linux*)
  90. libgcj_interpreter=yes
  91. sysdeps_dir=arm
  92. fallback_backtrace_h=sysdep/arm/backtrace.h
  93. libgcj_cxxflags=-Wno-abi
  94. ATOMICSPEC=-fuse-atomic-builtins
  95. # Work around a strange libtool feature that causes libraries
  96. # to be linked with libgcc_s but not libgcc.
  97. LDFLAGS="${LDFLAGS} -Wl,-lgcc"
  98. ;;
  99. mips-tx39-*|mipstx39-unknown-*)
  100. libgcj_flags="${libgcj_flags} -G 0"
  101. LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
  102. AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
  103. # Use "Ecos" processes since they are a no-op.
  104. PROCESS=Ecos
  105. FILE=Posix
  106. enable_java_net_default=no
  107. enable_getenv_properties_default=no
  108. ;;
  109. mips*-*)
  110. libgcj_interpreter=yes
  111. ;;
  112. i686-*|i586-*|i486-*|i386-*)
  113. sysdeps_dir=i386
  114. # With -fomit-frame-pointer -maccumulate-outgoing-args (implied),
  115. # the .text section of libgcj.so is 30k larger, and the .eh_frame
  116. # section is 1.4M smaller.
  117. libgcj_flags="${libgcj_flags} -ffloat-store -fomit-frame-pointer"
  118. # On Solaris we have defined 'sun' which later conflicts with
  119. # namespace usage. So to work this away we use the below undefine.
  120. libgcj_flags="${libgcj_flags} -Usun"
  121. libgcj_interpreter=yes
  122. libgcj_cxxflags=
  123. libgcj_cflags=
  124. DIVIDESPEC=-fno-use-divide-subroutine
  125. enable_hash_synchronization_default=yes
  126. slow_pthread_self=yes
  127. ;;
  128. x86_64-*)
  129. sysdeps_dir=i386
  130. # For 64-bit we always use SSE registers for arithmetic,
  131. # which doesn't have the extra precision problems of the fpu.
  132. # But be careful about 32-bit multilibs.
  133. case " $CC " in
  134. *" -m32 "*)
  135. libgcj_flags="${libgcj_flags} -ffloat-store" ;;
  136. esac
  137. libgcj_flags="${libgcj_flags} -fomit-frame-pointer"
  138. # On Solaris we have defined 'sun' which later conflicts with
  139. # namespace usage. So to work this away we use the below undefine.
  140. libgcj_flags="${libgcj_flags} -Usun"
  141. libgcj_cxxflags=
  142. libgcj_cflags=
  143. DIVIDESPEC=-fno-use-divide-subroutine
  144. enable_hash_synchronization_default=yes
  145. slow_pthread_self=yes
  146. libgcj_interpreter=yes
  147. ;;
  148. alpha*-*)
  149. sysdeps_dir=alpha
  150. libgcj_flags="${libgcj_flags} -mieee"
  151. libgcj_interpreter=yes
  152. enable_hash_synchronization_default=yes
  153. IEEESPEC=-mieee
  154. ;;
  155. hppa*-*)
  156. sysdeps_dir=pa
  157. libgcj_interpreter=yes
  158. enable_hash_synchronization_default=no
  159. ;;
  160. m68k-*)
  161. sysdeps_dir=m68k
  162. libgcj_interpreter=yes
  163. ;;
  164. powerpc64*-*)
  165. sysdeps_dir=powerpc
  166. libgcj_interpreter=yes
  167. if [ x`$CC -print-multi-os-directory` = x../lib64 ]; then
  168. libgcj_flags="${libgcj_flags} -mminimal-toc"
  169. fi
  170. enable_hash_synchronization_default=yes
  171. slow_pthread_self=yes
  172. ;;
  173. powerpc*-*)
  174. sysdeps_dir=powerpc
  175. libgcj_interpreter=yes
  176. enable_hash_synchronization_default=yes
  177. slow_pthread_self=yes
  178. ;;
  179. s390*-*)
  180. sysdeps_dir=s390
  181. libgcj_interpreter=yes
  182. DIVIDESPEC=-fno-use-divide-subroutine
  183. enable_hash_synchronization_default=yes
  184. ;;
  185. sparc*-*)
  186. sysdeps_dir=sparc
  187. # On Solaris we have defined 'sun' which later conflicts with
  188. # namespace usage. So to work this away we use the below undefine.
  189. libgcj_flags="${libgcj_flags} -Usun"
  190. libgcj_interpreter=yes
  191. ;;
  192. ia64-*)
  193. sysdeps_dir=ia64
  194. libgcj_flags="${libgcj_flags} -funwind-tables"
  195. libgcj_interpreter=yes
  196. enable_hash_synchronization_default=yes
  197. ;;
  198. sh-* | sh[34]*-*)
  199. sysdeps_dir=sh
  200. libgcj_flags="${libgcj_flags} -mieee"
  201. libgcj_interpreter=yes
  202. enable_hash_synchronization_default=yes
  203. IEEESPEC=-mieee
  204. ;;
  205. esac
  206. # This case statement supports generic port properties and may refine
  207. # the above per-CPU defaults. Note: If your OS implements
  208. # MD_FALLBACK_FRAME_STATE_FOR, then you want to set can_unwind_signal
  209. # here.
  210. case "${host}" in
  211. i[34567]86*-linux* | \
  212. powerpc*-linux* | \
  213. alpha*-linux* | \
  214. s390*-linux* | \
  215. sparc*-linux* | \
  216. ia64-* | \
  217. x86_64*-linux* | \
  218. hppa*-linux* | \
  219. m68k*-linux* | \
  220. sh-linux* | sh[34]*-linux*)
  221. can_unwind_signal=yes
  222. libgcj_ld_symbolic='-Wl,-Bsymbolic'
  223. if test x$slow_pthread_self = xyes \
  224. && test x$cross_compiling != xyes; then
  225. cat > conftest.c <<EOF
  226. #define _GNU_SOURCE 1
  227. #include <pthread.h>
  228. #include <stdlib.h>
  229. #include <sys/resource.h>
  230. #include <limits.h>
  231. void *
  232. tf (void *arg __attribute__ ((unused)))
  233. {
  234. pthread_attr_t a;
  235. size_t s;
  236. if (pthread_getattr_np (pthread_self (), &a)
  237. || pthread_attr_getstacksize (&a, &s)
  238. || s > 2 * PTHREAD_STACK_MIN)
  239. exit (1);
  240. exit (0);
  241. }
  242. int
  243. main (int argc, char **argv)
  244. {
  245. pthread_t p;
  246. void *ret;
  247. struct rlimit r;
  248. if (argc == 2)
  249. {
  250. r.rlim_cur = 2 * PTHREAD_STACK_MIN;
  251. r.rlim_max = 2 * PTHREAD_STACK_MIN;
  252. if (setrlimit (RLIMIT_STACK, &r))
  253. exit (1);
  254. execl (argv[1], argv[0], NULL);
  255. exit (1);
  256. }
  257. if (pthread_create (&p, NULL, tf, NULL)
  258. || pthread_join (p, &ret))
  259. exit (1);
  260. exit (1);
  261. }
  262. EOF
  263. $CC -o conftest conftest.c -lpthread > /dev/null 2>&1 && \
  264. ./conftest ./conftest && slow_pthread_self=
  265. rm -f conftest conftest.c
  266. fi
  267. ;;
  268. i[34567]86*-kfreebsd*-gnu | x86_64*-kfreebsd*-gnu)
  269. libgcj_ld_symbolic='-Wl,-Bsymbolic'
  270. slow_pthread_self=
  271. ;;
  272. i[34567]86-*-solaris2.1[0-9]* )
  273. sysdeps_dir=i386
  274. DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
  275. ;;
  276. x86_64-*-solaris2.1[0-9]* )
  277. sysdeps_dir=i386
  278. DIVIDESPEC=-f%{m32:no-}use-divide-subroutine
  279. ;;
  280. aarch64*-linux* )
  281. slow_pthread_self=no
  282. can_unwind_signal=no
  283. CHECKREFSPEC=-fcheck-references
  284. DIVIDESPEC=-fuse-divide-subroutine
  285. ;;
  286. arm*-linux* )
  287. slow_pthread_self=no
  288. can_unwind_signal=no
  289. CHECKREFSPEC=-fcheck-references
  290. DIVIDESPEC=-fuse-divide-subroutine
  291. ;;
  292. mips*-*-linux* )
  293. sysdeps_dir=mips
  294. can_unwind_signal=yes
  295. DIVIDESPEC=-fno-use-divide-subroutine
  296. enable_hash_synchronization_default=yes
  297. ;;
  298. powerpc*-*-darwin*)
  299. enable_hash_synchronization_default=yes
  300. slow_pthread_self=
  301. can_unwind_signal=yes
  302. ;;
  303. i?86-*-darwin*)
  304. enable_hash_synchronization_default=yes
  305. slow_pthread_self=
  306. can_unwind_signal=no
  307. ;;
  308. i?86-*-darwin[912]*)
  309. can_unwind_signal=yes
  310. DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
  311. ;;
  312. x86_64-*-darwin[912]*)
  313. enable_hash_synchronization_default=yes
  314. slow_pthread_self=
  315. can_unwind_signal=yes
  316. DIVIDESPEC=-fuse-divide-subroutine
  317. CHECKREFSPEC=-fcheck-references
  318. ;;
  319. i?86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
  320. can_unwind_signal=yes
  321. ;;
  322. *-*-freebsd*)
  323. slow_pthread_self=
  324. can_unwind_signal=yes
  325. DIVIDESPEC=-fuse-divide-subroutine
  326. ;;
  327. *-mingw*)
  328. libgcj_flags="${libgcj_flags} -fno-omit-frame-pointer"
  329. # FIXME: win32_exception_handler( ) in win32.cc does not do the
  330. # right stuff yet w.r.t. SEH. Live with the following for now.
  331. can_unwind_signal=no
  332. CHECKREFSPEC=-fcheck-references
  333. DIVIDESPEC=-fuse-divide-subroutine
  334. ;;
  335. *-cygwin*)
  336. # The cygwin linker doesn't do 8-byte alignment by default, so
  337. # disable hash synchronization for now.
  338. enable_hash_synchronization_default=no
  339. slow_pthread_self=
  340. ;;
  341. hppa*-hp-hpux11.*)
  342. slow_pthread_self=no
  343. can_unwind_signal=yes
  344. DIVIDESPEC=-fuse-divide-subroutine
  345. ;;
  346. sparc*-sun-solaris2.*)
  347. slow_pthread_self=
  348. can_unwind_signal=yes
  349. ;;
  350. esac
  351. case "${host}" in
  352. x86_64-*-cygwin* | x86_64-*-mingw*)
  353. # Win32 DLLs are limited to 64k exported symbols each.
  354. enable_libgcj_sublibs_default=yes
  355. libgcj_sublib_ltflags='$(lt_host_flags) \
  356. -Wl,-u,_ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
  357. libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
  358. ;;
  359. *-cygwin* | *-mingw*)
  360. fallback_backtrace_h=sysdep/i386/backtrace.h
  361. # We need a frame pointer on Windows, so override BACKTRACESPEC
  362. BACKTRACESPEC=
  363. # Win32 DLLs are limited to 64k exported symbols each.
  364. enable_libgcj_sublibs_default=yes
  365. libgcj_sublib_ltflags='$(lt_host_flags) \
  366. -Wl,-u,__ZN3org4ietf4jgss10GSSManagerC1Ev,-L..,-lgcj-noncore-dummy'
  367. libgcj_sublib_core_extra_deps=libgcj-noncore-dummy.dll.a
  368. ;;
  369. esac
  370. case "${host}" in
  371. ia64-*)
  372. descriptor_h=sysdep/descriptor-y.h
  373. ;;
  374. hppa*64*-*-hpux*)
  375. descriptor_h=sysdep/pa/descriptor-pa64-hpux.h
  376. ;;
  377. hppa*-*-hpux*)
  378. descriptor_h=sysdep/pa/descriptor-pa32-hpux.h
  379. ;;
  380. hppa*-*)
  381. descriptor_h=sysdep/pa/descriptor.h
  382. ;;
  383. rs6000-* | powerpc*-*)
  384. descriptor_h=sysdep/powerpc/descriptor.h
  385. ;;
  386. *)
  387. descriptor_h=sysdep/descriptor-n.h
  388. ;;
  389. esac
  390. case "${host}" in
  391. *linux*|*-kfreebsd*-gnu|*-gnu*)
  392. use_libgcj_bc=yes
  393. ;;
  394. *)
  395. use_libgcj_bc=no
  396. ;;
  397. esac
  398. libgcj_cflags="${libgcj_cflags} ${libgcj_flags}"
  399. libgcj_cxxflags="${libgcj_cxxflags} ${libgcj_flags}"
  400. libgcj_javaflags="${libgcj_javaflags} ${libgcj_flags}"