2
0

apr_hints.m4 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. dnl -------------------------------------------------------- -*- autoconf -*-
  2. dnl Licensed to the Apache Software Foundation (ASF) under one or more
  3. dnl contributor license agreements. See the NOTICE file distributed with
  4. dnl this work for additional information regarding copyright ownership.
  5. dnl The ASF licenses this file to You under the Apache License, Version 2.0
  6. dnl (the "License"); you may not use this file except in compliance with
  7. dnl the License. You may obtain a copy of the License at
  8. dnl
  9. dnl http://www.apache.org/licenses/LICENSE-2.0
  10. dnl
  11. dnl Unless required by applicable law or agreed to in writing, software
  12. dnl distributed under the License is distributed on an "AS IS" BASIS,
  13. dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. dnl See the License for the specific language governing permissions and
  15. dnl limitations under the License.
  16. dnl -----------------------------------------------------------------
  17. dnl apr_hints.m4: APR's autoconf macros for platform-specific hints
  18. dnl
  19. dnl We preload various configure settings depending
  20. dnl on previously obtained platform knowledge.
  21. dnl We allow all settings to be overridden from
  22. dnl the command-line.
  23. dnl
  24. dnl We maintain the "format" that we've used
  25. dnl under 1.3.x, so we don't exactly follow
  26. dnl what is "recommended" by autoconf.
  27. dnl
  28. dnl APR_PRELOAD
  29. dnl
  30. dnl Preload various ENV/makefile params such as CC, CFLAGS, etc
  31. dnl based on outside knowledge
  32. dnl
  33. dnl Generally, we force the setting of CC, and add flags
  34. dnl to CFLAGS, CPPFLAGS, LIBS and LDFLAGS.
  35. dnl
  36. AC_DEFUN([APR_PRELOAD], [
  37. if test "x$apr_preload_done" != "xyes" ; then
  38. apr_preload_done="yes"
  39. echo "Applying APR hints file rules for $host"
  40. case "$host" in
  41. *mint)
  42. APR_ADDTO(CPPFLAGS, [-DMINT])
  43. APR_ADDTO(LIBS, [-lportlib])
  44. ;;
  45. *MPE/iX*)
  46. APR_ADDTO(CPPFLAGS, [-DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE])
  47. APR_ADDTO(LIBS, [-lsvipc -lcurses])
  48. APR_ADDTO(LDFLAGS, [-Xlinker \"-WL,cap=ia,ba,ph;nmstack=1024000\"])
  49. ;;
  50. *-apple-aux3*)
  51. APR_ADDTO(CPPFLAGS, [-DAUX3 -D_POSIX_SOURCE])
  52. APR_ADDTO(LIBS, [-lposix -lbsd])
  53. APR_ADDTO(LDFLAGS, [-s])
  54. APR_SETVAR(SHELL, [/bin/ksh])
  55. ;;
  56. *-ibm-aix*)
  57. APR_ADDTO(CPPFLAGS, [-U__STR__ -D_THREAD_SAFE])
  58. dnl _USR_IRS gets us the hstrerror() proto in netdb.h
  59. case $host in
  60. *-ibm-aix4.3)
  61. APR_ADDTO(CPPFLAGS, [-D_USE_IRS])
  62. ;;
  63. *-ibm-aix5*)
  64. APR_ADDTO(CPPFLAGS, [-D_USE_IRS])
  65. ;;
  66. *-ibm-aix4.3.*)
  67. APR_ADDTO(CPPFLAGS, [-D_USE_IRS])
  68. ;;
  69. esac
  70. dnl If using xlc, remember it, and give it the right options.
  71. if $CC 2>&1 | grep 'xlc' > /dev/null; then
  72. APR_SETIFNULL(AIX_XLC, [yes])
  73. APR_ADDTO(CFLAGS, [-qHALT=E])
  74. fi
  75. APR_SETIFNULL(apr_sysvsem_is_global, [yes])
  76. APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
  77. case $host in
  78. *-ibm-aix3* | *-ibm-aix4.1.*)
  79. ;;
  80. *)
  81. APR_ADDTO(LDFLAGS, [-Wl,-brtl])
  82. ;;
  83. esac
  84. ;;
  85. *-apollo-*)
  86. APR_ADDTO(CPPFLAGS, [-DAPOLLO])
  87. ;;
  88. *-dg-dgux*)
  89. APR_ADDTO(CPPFLAGS, [-DDGUX])
  90. ;;
  91. *-os2*)
  92. APR_SETVAR(SHELL, [sh])
  93. APR_SETIFNULL(apr_gethostbyname_is_thread_safe, [yes])
  94. APR_SETIFNULL(apr_gethostbyaddr_is_thread_safe, [yes])
  95. ;;
  96. *-hi-hiux)
  97. APR_ADDTO(CPPFLAGS, [-DHIUX])
  98. ;;
  99. *-hp-hpux11.*)
  100. APR_ADDTO(CPPFLAGS, [-DHPUX11 -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED])
  101. ;;
  102. *-hp-hpux10.*)
  103. case $host in
  104. *-hp-hpux10.01)
  105. dnl # We know this is a problem in 10.01.
  106. dnl # Not a problem in 10.20. Otherwise, who knows?
  107. APR_ADDTO(CPPFLAGS, [-DSELECT_NEEDS_CAST])
  108. ;;
  109. esac
  110. APR_ADDTO(CPPFLAGS, [-D_REENTRANT])
  111. ;;
  112. *-hp-hpux*)
  113. APR_ADDTO(CPPFLAGS, [-DHPUX -D_REENTRANT])
  114. ;;
  115. *-linux-*)
  116. case `uname -r` in
  117. 2.* ) APR_ADDTO(CPPFLAGS, [-DLINUX=2])
  118. ;;
  119. 1.* ) APR_ADDTO(CPPFLAGS, [-DLINUX=1])
  120. ;;
  121. * )
  122. ;;
  123. esac
  124. APR_ADDTO(CPPFLAGS, [-D_REENTRANT -D_GNU_SOURCE])
  125. ;;
  126. *-GNU*)
  127. APR_ADDTO(CPPFLAGS, [-DHURD -D_GNU_SOURCE])
  128. ;;
  129. *-lynx-lynxos)
  130. APR_ADDTO(CPPFLAGS, [-D__NO_INCLUDE_WARN__ -DLYNXOS])
  131. APR_ADDTO(LIBS, [-lbsd])
  132. ;;
  133. *486-*-bsdi*)
  134. APR_ADDTO(CFLAGS, [-m486])
  135. ;;
  136. *-*-bsdi*)
  137. case $host in
  138. *bsdi4.1)
  139. APR_ADDTO(CFLAGS, [-D_REENTRANT])
  140. ;;
  141. esac
  142. ;;
  143. *-openbsd*)
  144. APR_ADDTO(CPPFLAGS, [-D_POSIX_THREADS])
  145. # binding to an ephemeral port fails on OpenBSD so override
  146. # the test for O_NONBLOCK inheritance across accept().
  147. APR_SETIFNULL(ac_cv_o_nonblock_inherited, [yes])
  148. ;;
  149. *-netbsd*)
  150. APR_ADDTO(CPPFLAGS, [-DNETBSD])
  151. # fcntl() lies about O_NONBLOCK on an accept()ed socket (PR kern/26950)
  152. APR_SETIFNULL(ac_cv_o_nonblock_inherited, [yes])
  153. ;;
  154. *-freebsd*)
  155. APR_SETIFNULL(apr_lock_method, [USE_FLOCK_SERIALIZE])
  156. if test -x /sbin/sysctl; then
  157. os_version=`/sbin/sysctl -n kern.osreldate`
  158. else
  159. os_version=000000
  160. fi
  161. # 502102 is when libc_r switched to libpthread (aka libkse).
  162. if test $os_version -ge "502102"; then
  163. apr_cv_pthreads_cflags="none"
  164. apr_cv_pthreads_lib="-lpthread"
  165. else
  166. APR_ADDTO(CPPFLAGS, [-D_THREAD_SAFE -D_REENTRANT])
  167. APR_SETIFNULL(enable_threads, [no])
  168. fi
  169. # prevent use of KQueue before FreeBSD 4.8
  170. if test $os_version -lt "480000"; then
  171. APR_SETIFNULL(ac_cv_func_kqueue, no)
  172. fi
  173. ;;
  174. *-next-nextstep*)
  175. APR_SETIFNULL(CFLAGS, [-O])
  176. APR_ADDTO(CPPFLAGS, [-DNEXT])
  177. ;;
  178. *-next-openstep*)
  179. APR_SETIFNULL(CFLAGS, [-O])
  180. APR_ADDTO(CPPFLAGS, [-DNEXT])
  181. ;;
  182. *-apple-rhapsody*)
  183. APR_ADDTO(CPPFLAGS, [-DRHAPSODY])
  184. ;;
  185. *-apple-darwin*)
  186. APR_ADDTO(CPPFLAGS, [-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp])
  187. APR_SETIFNULL(apr_posixsem_is_global, [yes])
  188. APR_SETIFNULL(ac_cv_func_poll, [no]) # See issue 34332
  189. # kqueue is broken on OS X, the poll tests work, but the socket tests
  190. # hang when it's turned on. if you decide to reenable this please be
  191. # sure to test that ALL the tests continue to work with it turned on.
  192. APR_SETIFNULL(ac_cv_func_kqueue, [no])
  193. ;;
  194. *-dec-osf*)
  195. APR_ADDTO(CPPFLAGS, [-DOSF1])
  196. # process-shared mutexes don't seem to work in Tru64 5.0
  197. APR_SETIFNULL(apr_cv_process_shared_works, [no])
  198. ;;
  199. *-nto-qnx*)
  200. ;;
  201. *-qnx)
  202. APR_ADDTO(CPPFLAGS, [-DQNX])
  203. APR_ADDTO(LIBS, [-N128k -lunix])
  204. ;;
  205. *-qnx32)
  206. APR_ADDTO(CPPFLAGS, [-DQNX])
  207. APR_ADDTO(CFLAGS, [-mf -3])
  208. APR_ADDTO(LIBS, [-N128k -lunix])
  209. ;;
  210. *-isc4*)
  211. APR_ADDTO(CPPFLAGS, [-posix -DISC])
  212. APR_ADDTO(LDFLAGS, [-posix])
  213. APR_ADDTO(LIBS, [-linet])
  214. ;;
  215. *-sco3.2v[[234]]*)
  216. APR_ADDTO(CPPFLAGS, [-DSCO -D_REENTRANT])
  217. if test "$GCC" = "no"; then
  218. APR_ADDTO(CFLAGS, [-Oacgiltz])
  219. fi
  220. APR_ADDTO(LIBS, [-lPW -lmalloc])
  221. ;;
  222. *-sco3.2v5*)
  223. APR_ADDTO(CPPFLAGS, [-DSCO5 -D_REENTRANT])
  224. ;;
  225. *-sco_sv*|*-SCO_SV*)
  226. APR_ADDTO(CPPFLAGS, [-DSCO -D_REENTRANT])
  227. APR_ADDTO(LIBS, [-lPW -lmalloc])
  228. ;;
  229. *-solaris2*)
  230. PLATOSVERS=`echo $host | sed 's/^.*solaris2.//'`
  231. APR_ADDTO(CPPFLAGS, [-DSOLARIS2=$PLATOSVERS -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT])
  232. APR_SETIFNULL(apr_lock_method, [USE_FCNTL_SERIALIZE])
  233. ;;
  234. *-sunos4*)
  235. APR_ADDTO(CPPFLAGS, [-DSUNOS4])
  236. ;;
  237. *-unixware1)
  238. APR_ADDTO(CPPFLAGS, [-DUW=100])
  239. ;;
  240. *-unixware2)
  241. APR_ADDTO(CPPFLAGS, [-DUW=200])
  242. APR_ADDTO(LIBS, [-lgen])
  243. ;;
  244. *-unixware211)
  245. APR_ADDTO(CPPFLAGS, [-DUW=211])
  246. APR_ADDTO(LIBS, [-lgen])
  247. ;;
  248. *-unixware212)
  249. APR_ADDTO(CPPFLAGS, [-DUW=212])
  250. APR_ADDTO(LIBS, [-lgen])
  251. ;;
  252. *-unixware7)
  253. APR_ADDTO(CPPFLAGS, [-DUW=700])
  254. APR_ADDTO(LIBS, [-lgen])
  255. ;;
  256. maxion-*-sysv4*)
  257. APR_ADDTO(CPPFLAGS, [-DSVR4])
  258. APR_ADDTO(LIBS, [-lc -lgen])
  259. ;;
  260. *-*-powermax*)
  261. APR_ADDTO(CPPFLAGS, [-DSVR4])
  262. APR_ADDTO(LIBS, [-lgen])
  263. ;;
  264. TPF)
  265. APR_ADDTO(CPPFLAGS, [-DTPF -D_POSIX_SOURCE])
  266. ;;
  267. bs2000*-siemens-sysv*)
  268. APR_SETIFNULL(CFLAGS, [-O])
  269. APR_ADDTO(CPPFLAGS, [-DSVR4 -D_XPG_IV -D_KMEMUSER])
  270. APR_ADDTO(LIBS, [-lsocket])
  271. APR_SETIFNULL(enable_threads, [no])
  272. ;;
  273. *-siemens-sysv4*)
  274. APR_ADDTO(CPPFLAGS, [-DSVR4 -D_XPG_IV -DHAS_DLFCN -DUSE_MMAP_FILES -DUSE_SYSVSEM_SERIALIZED_ACCEPT])
  275. APR_ADDTO(LIBS, [-lc])
  276. ;;
  277. pyramid-pyramid-svr4)
  278. APR_ADDTO(CPPFLAGS, [-DSVR4 -DNO_LONG_DOUBLE])
  279. APR_ADDTO(LIBS, [-lc])
  280. ;;
  281. DS/90\ 7000-*-sysv4*)
  282. APR_ADDTO(CPPFLAGS, [-DUXPDS])
  283. ;;
  284. *-tandem-sysv4*)
  285. APR_ADDTO(CPPFLAGS, [-DSVR4])
  286. ;;
  287. *-ncr-sysv4)
  288. APR_ADDTO(CPPFLAGS, [-DSVR4 -DMPRAS])
  289. APR_ADDTO(LIBS, [-lc -L/usr/ucblib -lucb])
  290. ;;
  291. *-sysv4*)
  292. APR_ADDTO(CPPFLAGS, [-DSVR4])
  293. APR_ADDTO(LIBS, [-lc])
  294. ;;
  295. 88k-encore-sysv4)
  296. APR_ADDTO(CPPFLAGS, [-DSVR4 -DENCORE])
  297. APR_ADDTO(LIBS, [-lPW])
  298. ;;
  299. *-uts*)
  300. PLATOSVERS=`echo $host | sed 's/^.*,//'`
  301. case $PLATOSVERS in
  302. 2*) APR_ADDTO(CPPFLAGS, [-DUTS21])
  303. APR_ADDTO(CFLAGS, [-Xa -eft])
  304. APR_ADDTO(LIBS, [-lbsd -la])
  305. ;;
  306. *) APR_ADDTO(CPPFLAGS, [-DSVR4])
  307. APR_ADDTO(CFLAGS, [-Xa])
  308. ;;
  309. esac
  310. ;;
  311. *-ultrix)
  312. APR_ADDTO(CPPFLAGS, [-DULTRIX])
  313. APR_SETVAR(SHELL, [/bin/sh5])
  314. ;;
  315. *powerpc-tenon-machten*)
  316. APR_ADDTO(LDFLAGS, [-Xlstack=0x14000 -Xldelcsect])
  317. ;;
  318. *-machten*)
  319. APR_ADDTO(LDFLAGS, [-stack 0x14000])
  320. ;;
  321. *convex-v11*)
  322. APR_ADDTO(CPPFLAGS, [-DCONVEXOS11])
  323. APR_SETIFNULL(CFLAGS, [-O1])
  324. APR_ADDTO(CFLAGS, [-ext])
  325. ;;
  326. i860-intel-osf1)
  327. APR_ADDTO(CPPFLAGS, [-DPARAGON])
  328. ;;
  329. *-sequent-ptx2.*.*)
  330. APR_ADDTO(CPPFLAGS, [-DSEQUENT=20])
  331. APR_ADDTO(CFLAGS, [-Wc,-pw])
  332. APR_ADDTO(LIBS, [-linet -lc -lseq])
  333. ;;
  334. *-sequent-ptx4.0.*)
  335. APR_ADDTO(CPPFLAGS, [-DSEQUENT=40])
  336. APR_ADDTO(CFLAGS, [-Wc,-pw])
  337. APR_ADDTO(LIBS, [-linet -lc])
  338. ;;
  339. *-sequent-ptx4.[[123]].*)
  340. APR_ADDTO(CPPFLAGS, [-DSEQUENT=41])
  341. APR_ADDTO(CFLAGS, [-Wc,-pw])
  342. APR_ADDTO(LIBS, [-lc])
  343. ;;
  344. *-sequent-ptx4.4.*)
  345. APR_ADDTO(CPPFLAGS, [-DSEQUENT=44])
  346. APR_ADDTO(CFLAGS, [-Wc,-pw])
  347. APR_ADDTO(LIBS, [-lc])
  348. ;;
  349. *-sequent-ptx4.5.*)
  350. APR_ADDTO(CPPFLAGS, [-DSEQUENT=45])
  351. APR_ADDTO(CFLAGS, [-Wc,-pw])
  352. APR_ADDTO(LIBS, [-lc])
  353. ;;
  354. *-sequent-ptx5.0.*)
  355. APR_ADDTO(CPPFLAGS, [-DSEQUENT=50])
  356. APR_ADDTO(CFLAGS, [-Wc,-pw])
  357. APR_ADDTO(LIBS, [-lc])
  358. ;;
  359. *NEWS-OS*)
  360. APR_ADDTO(CPPFLAGS, [-DNEWSOS])
  361. ;;
  362. *-riscix)
  363. APR_ADDTO(CPPFLAGS, [-DRISCIX])
  364. APR_SETIFNULL(CFLAGS, [-O])
  365. ;;
  366. *-irix*)
  367. APR_ADDTO(CPPFLAGS, [-D_POSIX_THREAD_SAFE_FUNCTIONS])
  368. ;;
  369. *beos*)
  370. APR_ADDTO(CPPFLAGS, [-DBEOS])
  371. PLATOSVERS=`uname -r`
  372. APR_SETIFNULL(apr_process_lock_is_global, [yes])
  373. case $PLATOSVERS in
  374. 5.0.4)
  375. APR_ADDTO(LDFLAGS, [-L/boot/beos/system/lib])
  376. APR_ADDTO(LIBS, [-lbind -lsocket])
  377. APR_ADDTO(CPPFLAGS,[-DBONE7])
  378. ;;
  379. 5.1)
  380. APR_ADDTO(LDFLAGS, [-L/boot/beos/system/lib])
  381. APR_ADDTO(LIBS, [-lbind -lsocket])
  382. ;;
  383. esac
  384. APR_ADDTO(CPPFLAGS, [-DSIGPROCMASK_SETS_THREAD_MASK -DAP_AUTH_DBM_USE_APR])
  385. ;;
  386. 4850-*.*)
  387. APR_ADDTO(CPPFLAGS, [-DSVR4 -DMPRAS])
  388. APR_ADDTO(LIBS, [-lc -L/usr/ucblib -lucb])
  389. ;;
  390. drs6000*)
  391. APR_ADDTO(CPPFLAGS, [-DSVR4])
  392. APR_ADDTO(LIBS, [-lc -L/usr/ucblib -lucb])
  393. ;;
  394. m88k-*-CX/SX|CYBER)
  395. APR_ADDTO(CPPFLAGS, [-D_CX_SX])
  396. APR_ADDTO(CFLAGS, [-Xa])
  397. ;;
  398. *-tandem-oss)
  399. APR_ADDTO(CPPFLAGS, [-D_TANDEM_SOURCE -D_XOPEN_SOURCE_EXTENDED=1])
  400. ;;
  401. *-ibm-os390)
  402. APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
  403. APR_SETIFNULL(apr_sysvsem_is_global, [yes])
  404. APR_SETIFNULL(apr_gethostbyname_is_thread_safe, [yes])
  405. APR_SETIFNULL(apr_gethostbyaddr_is_thread_safe, [yes])
  406. APR_ADDTO(CPPFLAGS, [-U_NO_PROTO -DPTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR -DPTHREAD_SETS_ERRNO -DPTHREAD_DETACH_ARG1_ADDR -DSIGPROCMASK_SETS_THREAD_MASK -DTCP_NODELAY=1])
  407. ;;
  408. *-ibm-as400)
  409. APR_SETIFNULL(apr_lock_method, [USE_SYSVSEM_SERIALIZE])
  410. APR_SETIFNULL(apr_process_lock_is_global, [yes])
  411. APR_SETIFNULL(apr_gethostbyname_is_thread_safe, [yes])
  412. APR_SETIFNULL(apr_gethostbyaddr_is_thread_safe, [yes])
  413. ;;
  414. *cygwin*)
  415. APR_ADDTO(CPPFLAGS, [-DCYGWIN])
  416. APR_ADDTO(LIBS, [-lcrypt])
  417. ;;
  418. esac
  419. fi
  420. ])
  421. dnl
  422. dnl APR_CC_HINTS
  423. dnl
  424. dnl Allows us to provide a default choice of compiler which
  425. dnl the user can override.
  426. AC_DEFUN([APR_CC_HINTS], [
  427. case "$host" in
  428. *-apple-aux3*)
  429. APR_SETIFNULL(CC, [gcc])
  430. ;;
  431. bs2000*-siemens-sysv*)
  432. APR_SETIFNULL(CC, [c89 -XLLML -XLLMK -XL -Kno_integer_overflow])
  433. ;;
  434. *convex-v11*)
  435. APR_SETIFNULL(CC, [cc])
  436. ;;
  437. *-ibm-os390)
  438. APR_SETIFNULL(CC, [cc])
  439. ;;
  440. *-ibm-as400)
  441. APR_SETIFNULL(CC, [icc])
  442. ;;
  443. *-isc4*)
  444. APR_SETIFNULL(CC, [gcc])
  445. ;;
  446. m88k-*-CX/SX|CYBER)
  447. APR_SETIFNULL(CC, [cc])
  448. ;;
  449. *-next-openstep*)
  450. APR_SETIFNULL(CC, [cc])
  451. ;;
  452. *-qnx32)
  453. APR_SETIFNULL(CC, [cc -F])
  454. ;;
  455. *-tandem-oss)
  456. APR_SETIFNULL(CC, [c89])
  457. ;;
  458. TPF)
  459. APR_SETIFNULL(CC, [c89])
  460. ;;
  461. esac
  462. ])