Guest User

Untitled

a guest
Jul 18th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.14 KB | None | 0 0
  1. From 900b192a8c73b3486687a74ea9dd4fa9e7f6ce50 Mon Sep 17 00:00:00 2001
  2. From: Serge Ziryukin <ftrvxmtrx@gmail.com>
  3. Date: Wed, 22 Dec 2010 13:03:28 +0200
  4. Subject: [PATCH] cross toolchain patch
  5.  
  6. ---
  7. Makefile | 36 +++++-
  8. asmcomp/asmlink.ml | 4 +-
  9. asmcomp/asmpackager.ml | 2 +-
  10. asmrun/Makefile | 16 +-
  11. bytecomp/bytelink.ml | 4 +-
  12. byterun/Makefile.common | 5 +-
  13. config/Makefile-templ | 25 +++-
  14. config/auto-aux/trycompile | 6 +-
  15. configure | 321 ++++++++++++++++++++++-------------------
  16. otherlibs/Makefile.shared | 13 +-
  17. otherlibs/dynlink/Makefile | 2 +-
  18. otherlibs/labltk/lib/Makefile | 2 +-
  19. otherlibs/systhreads/Makefile | 10 +-
  20. otherlibs/threads/Makefile | 2 +-
  21. stdlib/Makefile | 5 +-
  22. tools/Makefile.shared | 1 +
  23. tools/ocamlmklib.mlp | 8 +-
  24. utils/ccomp.ml | 22 ++-
  25. utils/ccomp.mli | 2 +-
  26. utils/clflags.ml | 7 +-
  27. utils/clflags.mli | 1 +
  28. utils/config.mli | 8 +
  29. utils/config.mlp | 4 +
  30. 23 files changed, 311 insertions(+), 195 deletions(-)
  31.  
  32. diff --git a/Makefile b/Makefile
  33. index e83e881..87cf45d 100644
  34. --- a/Makefile
  35. +++ b/Makefile
  36. @@ -261,6 +261,22 @@ opt:
  37. $(MAKE) otherlibrariesopt
  38. $(MAKE) ocamlbuildlib.native
  39.  
  40. +# Compile the cross-compiler
  41. +cross:
  42. + cd boot && cp $(BINDIR)/ocamlrun .
  43. + cd byterun && cp $(BINDIR)/ocamlrun .
  44. + cd stdlib; $(MAKE) COMPILER=../boot/ocamlc all
  45. + cd stdlib; cp $(LIBFILES) ../boot
  46. + cd yacc; $(MAKE) all
  47. + cp yacc/ocamlyacc$(EXE) boot/ocamlyacc$(EXE)
  48. + $(MAKE) ocamlc
  49. + $(MAKE) ocamltools
  50. + $(MAKE) library
  51. + $(MAKE) runtimeopt
  52. + $(MAKE) ocamlopt
  53. + $(MAKE) libraryopt
  54. + $(MAKE) otherlibrariesopt
  55. +
  56. # Native-code versions of the tools
  57. opt.opt: checkstack runtime core ocaml opt-core ocamlc.opt otherlibraries \
  58. ocamlbuild.byte camlp4out $(DEBUGGER) ocamldoc ocamlopt.opt \
  59. @@ -274,7 +290,7 @@ base.opt: checkstack runtime core ocaml opt-core ocamlc.opt otherlibraries \
  60. # Installation
  61. install:
  62. if test -d $(BINDIR); then : ; else $(MKDIR) $(BINDIR); fi
  63. - if test -d $(LIBDIR); then : ; else $(MKDIR) $(LIBDIR); fi
  64. + if test -d $(LIBDIR)/host; then : ; else $(MKDIR) -p $(LIBDIR)/host; fi
  65. if test -d $(STUBLIBDIR); then : ; else $(MKDIR) $(STUBLIBDIR); fi
  66. if test -d $(MANDIR)/man$(MANEXT); then : ; \
  67. else $(MKDIR) $(MANDIR)/man$(MANEXT); fi
  68. @@ -306,6 +322,18 @@ install:
  69. BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) PREFIX=$(PREFIX) \
  70. ./build/partial-install.sh
  71.  
  72. +# Installation of the cross-compiler
  73. +installcross:
  74. + if test -d $(BINDIR); then : ; else $(MKDIR) $(BINDIR); fi
  75. + if test -d $(LIBDIR); then : ; else $(MKDIR) $(LIBDIR); fi
  76. + if test -d $(STUBLIBDIR); then : ; else $(MKDIR) $(STUBLIBDIR); fi
  77. + cd asmrun; $(MAKE) install
  78. + cp byterun/ocamlrun $(BINDIR)/ocamlrun$(EXE)
  79. + cp ocamlopt $(BINDIR)/ocamlopt$(EXE)
  80. + cd stdlib; $(MAKE) installopt
  81. + for i in $(OTHERLIBRARIES); \
  82. + do (cd otherlibs/$$i; $(MAKE) installopt) || exit $$?; done
  83. +
  84. # Installation of the native-code compiler
  85. installopt:
  86. cd asmrun; $(MAKE) install
  87. @@ -382,6 +410,7 @@ utils/config.ml: utils/config.mlp config/Makefile
  88. -e 's|%%BYTECCLIBS%%|$(BYTECCLIBS)|' \
  89. -e 's|%%NATIVECCLIBS%%|$(NATIVECCLIBS)|' \
  90. -e 's|%%RANLIBCMD%%|$(RANLIBCMD)|' \
  91. + -e 's|%%TARGETRANLIBCMD%%|$(TARGETRANLIBCMD)|' \
  92. -e 's|%%CC_PROFILE%%|$(CC_PROFILE)|' \
  93. -e 's|%%ARCH%%|$(ARCH)|' \
  94. -e 's|%%MODEL%%|$(MODEL)|' \
  95. @@ -395,6 +424,9 @@ utils/config.ml: utils/config.mlp config/Makefile
  96. -e 's|%%MKDLL%%|$(MKDLL)|' \
  97. -e 's|%%MKEXE%%|$(MKEXE)|' \
  98. -e 's|%%MKMAINDLL%%|$(MKMAINDLL)|' \
  99. + -e 's|%%TARGETMKDLL%%|$(TARGETMKDLL)|' \
  100. + -e 's|%%TARGETMKEXE%%|$(TARGETMKEXE)|' \
  101. + -e 's|%%TARGETMKMAINDLL%%|$(TARGETMKMAINDLL)|' \
  102. utils/config.mlp > utils/config.ml
  103. @chmod -w utils/config.ml
  104.  
  105. @@ -654,7 +686,7 @@ alldepend::
  106.  
  107. otherlibraries: ocamltools
  108. for i in $(OTHERLIBRARIES); do \
  109. - (cd otherlibs/$$i; $(MAKE) RUNTIME=$(RUNTIME) all) || exit $$?; \
  110. + (cd otherlibs/$$i; $(MAKE) NATIVECC="$(BYTECC)" HOST=-host RUNTIME=$(RUNTIME) all) || exit $$?; \
  111. done
  112.  
  113. otherlibrariesopt:
  114. diff --git a/asmcomp/asmlink.ml b/asmcomp/asmlink.ml
  115. index 8b8cbc0..909c244 100644
  116. --- a/asmcomp/asmlink.ml
  117. +++ b/asmcomp/asmlink.ml
  118. @@ -251,7 +251,7 @@ let make_shared_startup_file ppf units filename =
  119.  
  120.  
  121. let call_linker_shared file_list output_name =
  122. - if not (Ccomp.call_linker Ccomp.Dll output_name file_list "")
  123. + if not (Ccomp.call_linker true Ccomp.Dll output_name file_list "")
  124. then raise(Error Linking_error)
  125.  
  126. let link_shared ppf objfiles output_name =
  127. @@ -294,7 +294,7 @@ let call_linker file_list startup_file output_name =
  128. else if !Clflags.output_c_object then Ccomp.Partial
  129. else Ccomp.Exe
  130. in
  131. - if not (Ccomp.call_linker mode output_name files c_lib)
  132. + if not (Ccomp.call_linker true mode output_name files c_lib)
  133. then raise(Error Linking_error)
  134.  
  135. (* Main entry point *)
  136. diff --git a/asmcomp/asmpackager.ml b/asmcomp/asmpackager.ml
  137. index fadfa49..62454e3 100644
  138. --- a/asmcomp/asmpackager.ml
  139. +++ b/asmcomp/asmpackager.ml
  140. @@ -104,7 +104,7 @@ let make_package_object ppf members targetobj targetname coercion =
  141. (fun m -> chop_extension_if_any m.pm_file ^ Config.ext_obj)
  142. (List.filter (fun m -> m.pm_kind <> PM_intf) members) in
  143. let ok =
  144. - Ccomp.call_linker Ccomp.Partial targetobj (objtemp :: objfiles) ""
  145. + Ccomp.call_linker true Ccomp.Partial targetobj (objtemp :: objfiles) ""
  146. in
  147. remove_file objtemp;
  148. if not ok then raise(Error Linking_error)
  149. diff --git a/asmrun/Makefile b/asmrun/Makefile
  150. index 3e37ab1..c9b1588 100644
  151. --- a/asmrun/Makefile
  152. +++ b/asmrun/Makefile
  153. @@ -38,13 +38,13 @@ all: libasmrun.a all-$(PROFILING)
  154.  
  155. libasmrun.a: $(OBJS)
  156. rm -f libasmrun.a
  157. - ar rc libasmrun.a $(OBJS)
  158. - $(RANLIB) libasmrun.a
  159. + $(TARGETAR) rc libasmrun.a $(OBJS)
  160. + $(TARGETRANLIB) libasmrun.a
  161.  
  162. libasmrund.a: $(DOBJS)
  163. rm -f libasmrund.a
  164. - ar rc libasmrund.a $(DOBJS)
  165. - $(RANLIB) libasmrund.a
  166. + $(TARGETAR) rc libasmrund.a $(DOBJS)
  167. + $(TARGETRANLIB) libasmrund.a
  168.  
  169. all-noprof:
  170.  
  171. @@ -52,21 +52,21 @@ all-prof: libasmrunp.a
  172.  
  173. libasmrunp.a: $(POBJS)
  174. rm -f libasmrunp.a
  175. - ar rc libasmrunp.a $(POBJS)
  176. - $(RANLIB) libasmrunp.a
  177. + $(TARGETAR) rc libasmrunp.a $(POBJS)
  178. + $(TARGETRANLIB) libasmrunp.a
  179.  
  180. install: install-default install-$(PROFILING)
  181.  
  182. install-default:
  183. cp libasmrun.a $(LIBDIR)/libasmrun.a
  184. - cd $(LIBDIR); $(RANLIB) libasmrun.a
  185. + cd $(LIBDIR); $(TARGETRANLIB) libasmrun.a
  186.  
  187. install-noprof:
  188. rm -f $(LIBDIR)/libasmrunp.a; ln -s libasmrun.a $(LIBDIR)/libasmrunp.a
  189.  
  190. install-prof:
  191. cp libasmrunp.a $(LIBDIR)/libasmrunp.a
  192. - cd $(LIBDIR); $(RANLIB) libasmrunp.a
  193. + cd $(LIBDIR); $(TARGETRANLIB) libasmrunp.a
  194.  
  195. power.o: power-$(SYSTEM).o
  196. cp power-$(SYSTEM).o power.o
  197. diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
  198. index ede7bb9..edf7a4d 100644
  199. --- a/bytecomp/bytelink.ml
  200. +++ b/bytecomp/bytelink.ml
  201. @@ -466,7 +466,7 @@ void caml_startup(char ** argv)\n\
  202. (* Build a custom runtime *)
  203.  
  204. let build_custom_runtime prim_name exec_name =
  205. - Ccomp.call_linker Ccomp.Exe exec_name
  206. + Ccomp.call_linker false Ccomp.Exe exec_name
  207. ([prim_name] @ List.rev !Clflags.ccobjs @ ["-lcamlrun"])
  208. (Clflags.std_include_flag "-I" ^ " " ^ Config.bytecomp_c_libraries)
  209.  
  210. @@ -546,7 +546,7 @@ let link objfiles output_name =
  211. if not (Filename.check_suffix output_name Config.ext_obj) then begin
  212. temps := obj_file :: !temps;
  213. if not (
  214. - Ccomp.call_linker Ccomp.MainDll output_name
  215. + Ccomp.call_linker false Ccomp.MainDll output_name
  216. ([obj_file] @ List.rev !Clflags.ccobjs @ ["-lcamlrun"])
  217. Config.bytecomp_c_libraries
  218. ) then raise (Error Custom_runtime);
  219. diff --git a/byterun/Makefile.common b/byterun/Makefile.common
  220. index cc75cce..2d4c72f 100755
  221. --- a/byterun/Makefile.common
  222. +++ b/byterun/Makefile.common
  223. @@ -43,11 +43,12 @@ all:: ocamlrun$(EXE) ld.conf libcamlrun.$(A)
  224. ld.conf: ../config/Makefile
  225. echo "$(STUBLIBDIR)" > ld.conf
  226. echo "$(LIBDIR)" >> ld.conf
  227. + echo "$(LIBDIR)/host" >> ld.conf
  228.  
  229. install::
  230. cp ocamlrun$(EXE) $(BINDIR)/ocamlrun$(EXE)
  231. - cp libcamlrun.$(A) $(LIBDIR)/libcamlrun.$(A)
  232. - cd $(LIBDIR); $(RANLIB) libcamlrun.$(A)
  233. + cp libcamlrun.$(A) $(LIBDIR)/host/libcamlrun.$(A)
  234. + cd $(LIBDIR)/host; $(RANLIB) libcamlrun.$(A)
  235. if test -d $(LIBDIR)/caml; then : ; else mkdir $(LIBDIR)/caml; fi
  236. for i in $(PUBLIC_INCLUDES); do \
  237. sed -f ../tools/cleanup-header $$i > $(LIBDIR)/caml/$$i; \
  238. diff --git a/config/Makefile-templ b/config/Makefile-templ
  239. index dd65452..2ebe7d3 100644
  240. --- a/config/Makefile-templ
  241. +++ b/config/Makefile-templ
  242. @@ -82,7 +82,7 @@ SHARPBANGSCRIPTS=true
  243. #ml let syslib x = "-l"^x;;
  244. #ml let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
  245.  
  246. -### How to invoke ranlib
  247. +### How to invoke ranlib (for a 'local' library)
  248. RANLIB=ranlib
  249. RANLIBCMD=ranlib
  250.  
  251. @@ -90,6 +90,17 @@ RANLIBCMD=ranlib
  252. #RANLIB=ar rs
  253. #RANLIBCMD=
  254.  
  255. +### How to invoke ranlib (for a 'target' library)
  256. +# BSD-style:
  257. +#TARGETRANLIB=ranlib
  258. +#TARGETRANLIBCMD=ranlib
  259. +# If ranlib is not needed:
  260. +#TARGETRANLIB=ar rs
  261. +#TARGETRANLIBCMD=
  262. +
  263. +### How to invoke ar (for a 'target' library)
  264. +#TARGETAR=
  265. +
  266. ### Shared library support
  267. # Extension for shared libraries: so if supported, a if not supported
  268. #SO=so
  269. @@ -287,3 +298,15 @@ BNG_ASM_LEVEL=1
  270. #TK_LINK="-ltk8.0 -ltcl8.0"
  271. # For Tcl/Tk 8.0 on FreeBSD:
  272. #TK_LINK="-L/usr/local/lib -ltk8.0 -ltcl8.0"
  273. +
  274. +### Compilers for producing executables ('local' and 'target' ones)
  275. +#MKEXE=
  276. +#TARGETMKEXE=
  277. +
  278. +### Compilers for producing dlls ('local' and 'target' ones)
  279. +#MKDLL=
  280. +#TARGETMKDLL=
  281. +
  282. +### Compilers for producing dlls ('local' and 'target' ones)
  283. +#MKMAINDLL=
  284. +#TARGETMKMAINDLL=
  285. diff --git a/config/auto-aux/trycompile b/config/auto-aux/trycompile
  286. index 797a1c3..1ec8876 100755
  287. --- a/config/auto-aux/trycompile
  288. +++ b/config/auto-aux/trycompile
  289. @@ -1,7 +1,7 @@
  290. #!/bin/sh
  291. if test "$verbose" = yes; then
  292. -echo "trycompile: $cc -o tst $* $cclibs" >&2
  293. -$cc -o tst $* $cclibs || exit 100
  294. +echo "trycompile: $trycc -o tst $* $cclibs" >&2
  295. +$trycc -o tst $* $cclibs || exit 100
  296. else
  297. -$cc -o tst $* $cclibs 2> /dev/null || exit 100
  298. +$trycc -o tst $* $cclibs 2> /dev/null || exit 100
  299. fi
  300. diff --git a/configure b/configure
  301. index 56a209c..99c3c7e 100755
  302. --- a/configure
  303. +++ b/configure
  304. @@ -25,10 +25,12 @@ host_type=unknown
  305. ccoption=''
  306. asoption=''
  307. asppoption=''
  308. +crosscompile=''
  309. cclibs=''
  310. curseslibs=''
  311. mathlib='-lm'
  312. dllib=''
  313. +disablex11=no
  314. x11_include_dir=''
  315. x11_lib_dir=''
  316. tk_wanted=yes
  317. @@ -73,18 +75,22 @@ while : ; do
  318. shift;;
  319. -host*|--host*)
  320. host_type=$2; shift;;
  321. - -cc*)
  322. + -bytecc*)
  323. ccoption="$2"; shift;;
  324. -as)
  325. asoption="$2"; shift;;
  326. -aspp)
  327. asppoption="$2"; shift;;
  328. + -cross-compile)
  329. + crosscompile="$2"; shift;;
  330. -lib*)
  331. cclibs="$2 $cclibs"; shift;;
  332. -no-curses)
  333. withcurses=no;;
  334. -no-shared-libs)
  335. withsharedlibs=no;;
  336. + -no-x11)
  337. + disablex11=yes;;
  338. -x11include*|--x11include*)
  339. x11_include_dir=$2; shift;;
  340. -x11lib*|--x11lib*)
  341. @@ -187,14 +193,20 @@ echo "Configuring for a $host ..."
  342. if test -z "$ccoption"; then
  343. if sh ./searchpath gcc; then
  344. echo "gcc found"
  345. - cc=gcc
  346. + cc="gcc"
  347. else
  348. - cc=cc
  349. + cc="cc"
  350. fi
  351. else
  352. cc="$ccoption"
  353. fi
  354.  
  355. +if test -z "$crosscompile"; then
  356. + trycc="$cc"
  357. +else
  358. + trycc="${crosscompile}gcc"
  359. +fi
  360. +
  361. # Check for buggy versions of GCC
  362.  
  363. buggycc="no"
  364. @@ -332,7 +344,7 @@ esac
  365. # Configure compiler to use in further tests
  366.  
  367. cc="$bytecc -O $bytecclinkopts"
  368. -export cc cclibs verbose
  369. +export trycc cc cclibs verbose
  370.  
  371. # Check C compiler
  372.  
  373. @@ -707,14 +719,18 @@ if $arch64; then
  374. esac
  375. fi
  376.  
  377. -if test -z "$ccoption"; then
  378. - case "$arch,$system,$cc" in
  379. - alpha,digital,gcc*) nativecc=cc;;
  380. - mips,*,gcc*) nativecc=cc;;
  381. - *) nativecc="$bytecc";;
  382. - esac
  383. +if test -z "$crosscompile"; then
  384. + if test -z "$ccoption"; then
  385. + case "$arch,$system,$cc" in
  386. + alpha,digital,gcc*) nativecc=cc;;
  387. + mips,*,gcc*) nativecc=cc;;
  388. + *) nativecc="$bytecc";;
  389. + esac
  390. + else
  391. + nativecc="$ccoption"
  392. + fi
  393. else
  394. - nativecc="$ccoption"
  395. + nativecc="gcc"
  396. fi
  397.  
  398. nativecccompopts=''
  399. @@ -1249,143 +1265,149 @@ fi
  400. x11_include="not found"
  401. x11_link="not found"
  402.  
  403. -for dir in \
  404. - $x11_include_dir \
  405. - \
  406. - /usr/X11R7/include \
  407. - /usr/include/X11R7 \
  408. - /usr/local/X11R7/include \
  409. - /usr/local/include/X11R7 \
  410. - /opt/X11R7/include \
  411. - \
  412. - /usr/X11R6/include \
  413. - /usr/include/X11R6 \
  414. - /usr/local/X11R6/include \
  415. - /usr/local/include/X11R6 \
  416. - /opt/X11R6/include \
  417. - \
  418. - /usr/X11/include \
  419. - /usr/include/X11 \
  420. - /usr/local/X11/include \
  421. - /usr/local/include/X11 \
  422. - /opt/X11/include \
  423. - \
  424. - /usr/X11R5/include \
  425. - /usr/include/X11R5 \
  426. - /usr/local/X11R5/include \
  427. - /usr/local/include/X11R5 \
  428. - /usr/local/x11r5/include \
  429. - /opt/X11R5/include \
  430. - \
  431. - /usr/X11R4/include \
  432. - /usr/include/X11R4 \
  433. - /usr/local/X11R4/include \
  434. - /usr/local/include/X11R4 \
  435. - \
  436. - /usr/X386/include \
  437. - /usr/x386/include \
  438. - /usr/XFree86/include/X11 \
  439. - \
  440. - /usr/include \
  441. - /usr/local/include \
  442. - /usr/unsupported/include \
  443. - /usr/athena/include \
  444. - /usr/lpp/Xamples/include \
  445. - \
  446. - /usr/openwin/include \
  447. - /usr/openwin/share/include \
  448. - ; \
  449. -do
  450. - if test -f $dir/X11/X.h; then
  451. - x11_include=$dir
  452. - break
  453. - fi
  454. -done
  455. -
  456. -if test "$x11_include" = "not found"; then
  457. - x11_try_lib_dir=''
  458. -else
  459. - x11_try_lib_dir=`echo $x11_include | sed -e 's|include|lib|'`
  460. -fi
  461. -
  462. -for dir in \
  463. - $x11_lib_dir \
  464. - $x11_try_lib_dir \
  465. - \
  466. - /usr/X11R6/lib64 \
  467. - /usr/X11R6/lib \
  468. - /usr/lib/X11R6 \
  469. - /usr/local/X11R6/lib \
  470. - /usr/local/lib/X11R6 \
  471. - /opt/X11R6/lib \
  472. - \
  473. - /usr/X11/lib \
  474. - /usr/lib/X11 \
  475. - /usr/local/X11/lib \
  476. - /usr/local/lib/X11 \
  477. - /opt/X11/lib \
  478. - \
  479. - /usr/X11R5/lib \
  480. - /usr/lib/X11R5 \
  481. - /usr/local/X11R5/lib \
  482. - /usr/local/lib/X11R5 \
  483. - /usr/local/x11r5/lib \
  484. - /opt/X11R5/lib \
  485. - \
  486. - /usr/X11R4/lib \
  487. - /usr/lib/X11R4 \
  488. - /usr/local/X11R4/lib \
  489. - /usr/local/lib/X11R4 \
  490. - \
  491. - /usr/X386/lib \
  492. - /usr/x386/lib \
  493. - /usr/XFree86/lib/X11 \
  494. - \
  495. - /usr/lib64 \
  496. - /usr/lib \
  497. - /usr/local/lib \
  498. - /usr/unsupported/lib \
  499. - /usr/athena/lib \
  500. - /usr/lpp/Xamples/lib \
  501. - /lib/usr/lib/X11 \
  502. - \
  503. - /usr/openwin/lib \
  504. - /usr/openwin/share/lib \
  505. - ; \
  506. -do
  507. - if test -f $dir/libX11.a || \
  508. - test -f $dir/libX11.so || \
  509. - test -f $dir/libX11.dll.a || \
  510. - test -f $dir/libX11.dylib || \
  511. - test -f $dir/libX11.sa; then
  512. - if test $dir = /usr/lib; then
  513. - x11_link="-lX11"
  514. +if test "$disablex11" = "no"; then
  515. + for dir in \
  516. + $x11_include_dir \
  517. + \
  518. + /usr/X11R7/include \
  519. + /usr/include/X11R7 \
  520. + /usr/local/X11R7/include \
  521. + /usr/local/include/X11R7 \
  522. + /opt/X11R7/include \
  523. + \
  524. + /usr/X11R6/include \
  525. + /usr/include/X11R6 \
  526. + /usr/local/X11R6/include \
  527. + /usr/local/include/X11R6 \
  528. + /opt/X11R6/include \
  529. + \
  530. + /usr/X11/include \
  531. + /usr/include/X11 \
  532. + /usr/local/X11/include \
  533. + /usr/local/include/X11 \
  534. + /opt/X11/include \
  535. + \
  536. + /usr/X11R5/include \
  537. + /usr/include/X11R5 \
  538. + /usr/local/X11R5/include \
  539. + /usr/local/include/X11R5 \
  540. + /usr/local/x11r5/include \
  541. + /opt/X11R5/include \
  542. + \
  543. + /usr/X11R4/include \
  544. + /usr/include/X11R4 \
  545. + /usr/local/X11R4/include \
  546. + /usr/local/include/X11R4 \
  547. + \
  548. + /usr/X386/include \
  549. + /usr/x386/include \
  550. + /usr/XFree86/include/X11 \
  551. + \
  552. + /usr/include \
  553. + /usr/local/include \
  554. + /usr/unsupported/include \
  555. + /usr/athena/include \
  556. + /usr/lpp/Xamples/include \
  557. + \
  558. + /usr/openwin/include \
  559. + /usr/openwin/share/include \
  560. + ; \
  561. + do
  562. + if test -f $dir/X11/X.h; then
  563. + x11_include=$dir
  564. + break
  565. + fi
  566. + done
  567. +
  568. + if test "$x11_include" = "not found"; then
  569. + x11_try_lib_dir=''
  570. else
  571. - x11_libs="-L$dir"
  572. - case "$host" in
  573. - *-*-*bsd*) x11_link="-R$dir -L$dir -lX11";;
  574. - *) x11_link="-L$dir -lX11";;
  575. - esac
  576. + x11_try_lib_dir=`echo $x11_include | sed -e 's|include|lib|'`
  577. fi
  578. - break
  579. - fi
  580. -done
  581. -
  582.  
  583. -if test "$x11_include" = "not found" || test "$x11_link" = "not found"
  584. -then
  585. - echo "X11 not found, the \"graph\" library will not be supported."
  586. - x11_include=""
  587. + for dir in \
  588. + $x11_lib_dir \
  589. + $x11_try_lib_dir \
  590. + \
  591. + /usr/X11R6/lib64 \
  592. + /usr/X11R6/lib \
  593. + /usr/lib/X11R6 \
  594. + /usr/local/X11R6/lib \
  595. + /usr/local/lib/X11R6 \
  596. + /opt/X11R6/lib \
  597. + \
  598. + /usr/X11/lib \
  599. + /usr/lib/X11 \
  600. + /usr/local/X11/lib \
  601. + /usr/local/lib/X11 \
  602. + /opt/X11/lib \
  603. + \
  604. + /usr/X11R5/lib \
  605. + /usr/lib/X11R5 \
  606. + /usr/local/X11R5/lib \
  607. + /usr/local/lib/X11R5 \
  608. + /usr/local/x11r5/lib \
  609. + /opt/X11R5/lib \
  610. + \
  611. + /usr/X11R4/lib \
  612. + /usr/lib/X11R4 \
  613. + /usr/local/X11R4/lib \
  614. + /usr/local/lib/X11R4 \
  615. + \
  616. + /usr/X386/lib \
  617. + /usr/x386/lib \
  618. + /usr/XFree86/lib/X11 \
  619. + \
  620. + /usr/lib64 \
  621. + /usr/lib \
  622. + /usr/local/lib \
  623. + /usr/unsupported/lib \
  624. + /usr/athena/lib \
  625. + /usr/lpp/Xamples/lib \
  626. + /lib/usr/lib/X11 \
  627. + \
  628. + /usr/openwin/lib \
  629. + /usr/openwin/share/lib \
  630. + ; \
  631. + do
  632. + if test -f $dir/libX11.a || \
  633. + test -f $dir/libX11.so || \
  634. + test -f $dir/libX11.dll.a || \
  635. + test -f $dir/libX11.dylib || \
  636. + test -f $dir/libX11.sa; then
  637. + if test $dir = /usr/lib; then
  638. + x11_link="-lX11"
  639. + else
  640. + x11_libs="-L$dir"
  641. + case "$host" in
  642. + *-*-*bsd*) x11_link="-R$dir -L$dir -lX11";;
  643. + *) x11_link="-L$dir -lX11";;
  644. + esac
  645. + fi
  646. + break
  647. + fi
  648. + done
  649. +
  650. +
  651. + if test "$x11_include" = "not found" || test "$x11_link" = "not found"
  652. + then
  653. + echo "X11 not found, the \"graph\" library will not be supported."
  654. + x11_include=""
  655. + else
  656. + echo "Location of X11 include files: $x11_include/X11"
  657. + echo "Options for linking with X11: $x11_link"
  658. + otherlibraries="$otherlibraries graph"
  659. + if test "$x11_include" = "/usr/include"; then
  660. + x11_include=""
  661. + else
  662. + x11_include="-I$x11_include"
  663. + fi
  664. + fi
  665. else
  666. - echo "Location of X11 include files: $x11_include/X11"
  667. - echo "Options for linking with X11: $x11_link"
  668. - otherlibraries="$otherlibraries graph"
  669. - if test "$x11_include" = "/usr/include"; then
  670. x11_include=""
  671. - else
  672. - x11_include="-I$x11_include"
  673. - fi
  674. + x11_link=""
  675. fi
  676. +
  677. echo "X11_INCLUDES=$x11_include" >> Makefile
  678. echo "X11_LINK=$x11_link" >> Makefile
  679.  
  680. @@ -1603,25 +1625,29 @@ echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile
  681. echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile
  682. echo "MKSHAREDLIBRPATH=$mksharedlibrpath" >> Makefile
  683. echo "NATDYNLINKOPTS=$natdynlinkopts" >> Makefile
  684. +echo "TARGETAR=${crosscompile}ar" >> Makefile
  685. +echo "TARGETRANLIB=${crosscompile}ranlib" >> Makefile
  686. cat >> Makefile <<EOF
  687. SYSLIB=-l\$(1)
  688. #ml let syslib x = "-l"^x;;
  689.  
  690. ### How to build a static library
  691. +TARGETMKLIB=\$(TARGETAR) rc \$(1) \$(2); \$(TARGETRANLIB) \$(1)
  692. +#ml let targetmklib out files opts = Printf.sprintf "${crosscompile}ar rc %s %s %s; ${crosscompile}ranlib %s" out opts files out;;
  693. MKLIB=ar rc \$(1) \$(2); ranlib \$(1)
  694. #ml let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
  695. EOF
  696. echo "ARCH=$arch" >> Makefile
  697. echo "MODEL=$model" >> Makefile
  698. echo "SYSTEM=$system" >> Makefile
  699. -echo "NATIVECC=$nativecc" >> Makefile
  700. +echo "NATIVECC=${crosscompile}$nativecc" >> Makefile
  701. echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile
  702. echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile
  703. echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
  704. echo "NATIVECCRPATH=$nativeccrpath" >> Makefile
  705. echo "NATIVECCLIBS=$cclibs $dllib" >> Makefile
  706. -echo "ASM=$as" >> Makefile
  707. -echo "ASPP=$aspp" >> Makefile
  708. +echo "ASM=${crosscompile}$as" >> Makefile
  709. +echo "ASPP=${crosscompile}$aspp" >> Makefile
  710. echo "ASPPPROFFLAGS=$asppprofflags" >> Makefile
  711. echo "PROFILING=$profiling" >> Makefile
  712. echo "DYNLINKOPTS=$dllib" >> Makefile
  713. @@ -1629,7 +1655,7 @@ echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
  714. echo "DEBUGGER=$debugger" >> Makefile
  715. echo "CC_PROFILE=$cc_profile" >> Makefile
  716. echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
  717. -echo "PARTIALLD=$partialld" >> Makefile
  718. +echo "PARTIALLD=${crosscompile}$partialld" >> Makefile
  719. echo "PACKLD=\$(PARTIALLD) \$(NATIVECCLINKOPTS) -o " \
  720. | sed -e 's/ $/\\ /' >> Makefile
  721. echo "DLLCCCOMPOPTS=$dllccompopts" >> Makefile
  722. @@ -1647,8 +1673,11 @@ echo "TOOLCHAIN=cc" >> Makefile
  723. echo "NATDYNLINK=$natdynlink" >> Makefile
  724. echo "CMXS=$cmxs" >> Makefile
  725. echo "MKEXE=$mkexe" >> Makefile
  726. +echo "TARGETMKEXE=${crosscompile}gcc" >> Makefile
  727. echo "MKDLL=$mksharedlib" >> Makefile
  728. +echo "TARGETMKDLL=${crosscompile}gcc -shared" >> Makefile
  729. echo "MKMAINDLL=$mkmaindll" >> Makefile
  730. +echo "TARGETMKMAINDLL=${crosscompile}gcc -shared" >> Makefile
  731.  
  732. rm -f tst hasgot.c
  733. rm -f ../m.h ../s.h ../Makefile
  734. diff --git a/otherlibs/Makefile.shared b/otherlibs/Makefile.shared
  735. index 7e6780b..eed147b 100644
  736. --- a/otherlibs/Makefile.shared
  737. +++ b/otherlibs/Makefile.shared
  738. @@ -22,7 +22,7 @@ include $(ROOTDIR)/config/Makefile
  739. CC=$(BYTECC)
  740. CAMLRUN=$(ROOTDIR)/boot/ocamlrun
  741. COMPFLAGS=-warn-error A -g $(EXTRACAMLFLAGS)
  742. -MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib
  743. +MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib $(HOST)
  744.  
  745. # Variables to be defined by individual libraries:
  746. #LIBNAME=
  747. @@ -59,14 +59,15 @@ lib$(CLIBNAME).$(A): $(COBJS)
  748. install::
  749. if test -f dll$(CLIBNAME)$(EXT_DLL); then \
  750. cp dll$(CLIBNAME)$(EXT_DLL) $(STUBLIBDIR)/; fi
  751. - cp lib$(CLIBNAME).$(A) $(LIBDIR)/
  752. - cd $(LIBDIR); $(RANLIB) lib$(CLIBNAME).$(A)
  753. + cp lib$(CLIBNAME).$(A) $(LIBDIR)/host/
  754. + cd $(LIBDIR)/host; $(RANLIB) lib$(CLIBNAME).$(A)
  755. cp $(LIBNAME).cma $(CMIFILES) $(CMIFILES:.cmi=.mli) $(LIBDIR)/
  756. if test -n "$(HEADERS)"; then cp $(HEADERS) $(LIBDIR)/caml/; fi
  757.  
  758. installopt:
  759. - cp $(CAMLOBJS_NAT) $(LIBNAME).cmxa $(LIBNAME).$(A) $(LIBDIR)/
  760. - cd $(LIBDIR); $(RANLIB) $(LIBNAME).a
  761. + cp $(CAMLOBJS_NAT) $(LIBNAME).cmxa $(LIBNAME).$(A) $(CMIFILES) \
  762. + $(CMIFILES:.cmi=.mli) lib$(CLIBNAME).$(A) $(LIBDIR)/
  763. + cd $(LIBDIR); $(TARGETRANLIB) $(LIBNAME).a; $(TARGETRANLIB) lib$(CLIBNAME).$(A)
  764. if test -f $(LIBNAME).cmxs; then cp $(LIBNAME).cmxs $(LIBDIR)/; fi
  765.  
  766. partialclean:
  767. @@ -87,4 +88,4 @@ clean:: partialclean
  768. $(CAMLOPT) -c $(COMPFLAGS) $<
  769.  
  770. .c.$(O):
  771. - $(BYTECC) $(BYTECCCOMPOPTS) $(CFLAGS) -c $<
  772. + $(NATIVECC) $(BYTECCCOMPOPTS) $(CFLAGS) -c $<
  773. diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile
  774. index 3da485f..71c9b8b 100644
  775. --- a/otherlibs/dynlink/Makefile
  776. +++ b/otherlibs/dynlink/Makefile
  777. @@ -72,7 +72,7 @@ install:
  778. installopt:
  779. if $(NATDYNLINK); then \
  780. cp $(NATOBJS) dynlink.cmxa dynlink.$(A) $(LIBDIR) && \
  781. - cd $(LIBDIR) && $(RANLIB) dynlink.$(A); \
  782. + cd $(LIBDIR) && $(TARGETRANLIB) dynlink.$(A); \
  783. fi
  784.  
  785. partialclean:
  786. diff --git a/otherlibs/labltk/lib/Makefile b/otherlibs/labltk/lib/Makefile
  787. index b82bcdd..9cff7b5 100644
  788. --- a/otherlibs/labltk/lib/Makefile
  789. +++ b/otherlibs/labltk/lib/Makefile
  790. @@ -78,6 +78,6 @@ install:
  791. installopt:
  792. @if test -d $(INSTALLDIR); then : ; else mkdir $(INSTALLDIR); fi
  793. cp $(LIBNAME).cmxa $(LIBNAME).$(A) $(INSTALLDIR)
  794. - cd $(INSTALLDIR); $(RANLIB) $(LIBNAME).$(A)
  795. + cd $(INSTALLDIR); $(TARGETRANLIB) $(LIBNAME).$(A)
  796. chmod 644 $(INSTALLDIR)/$(LIBNAME).cmxa
  797. chmod 644 $(INSTALLDIR)/$(LIBNAME).$(A)
  798. diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile
  799. index f5c80c0..075ce7a 100644
  800. --- a/otherlibs/systhreads/Makefile
  801. +++ b/otherlibs/systhreads/Makefile
  802. @@ -17,7 +17,7 @@ include ../../config/Makefile
  803.  
  804. CAMLC=../../ocamlcomp.sh -I ../unix
  805. CAMLOPT=../../ocamlcompopt.sh -I ../unix
  806. -MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
  807. +MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib $(HOST)
  808. COMPFLAGS=-warn-error A -g
  809.  
  810. BYTECODE_C_OBJS=st_stubs_b.o
  811. @@ -71,8 +71,8 @@ clean: partialclean
  812.  
  813. install:
  814. if test -f dllthreads.so; then cp dllthreads.so $(STUBLIBDIR)/dllthreads.so; fi
  815. - cp libthreads.a $(LIBDIR)/libthreads.a
  816. - cd $(LIBDIR); $(RANLIB) libthreads.a
  817. + cp libthreads.a $(LIBDIR)/host/libthreads.a
  818. + cd $(LIBDIR)/host; $(RANLIB) libthreads.a
  819. if test -d $(LIBDIR)/threads; then :; else mkdir $(LIBDIR)/threads; fi
  820. cp $(THREAD_OBJS:.cmo=.cmi) threads.cma $(LIBDIR)/threads
  821. rm -f $(LIBDIR)/threads/stdlib.cma
  822. @@ -81,9 +81,9 @@ install:
  823.  
  824. installopt:
  825. cp libthreadsnat.a $(LIBDIR)/libthreadsnat.a
  826. - cd $(LIBDIR); $(RANLIB) libthreadsnat.a
  827. + cd $(LIBDIR); $(TARGETRANLIB) libthreadsnat.a
  828. cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.a $(LIBDIR)/threads
  829. - cd $(LIBDIR)/threads; $(RANLIB) threads.a
  830. + cd $(LIBDIR)/threads; $(TARGETRANLIB) threads.a
  831.  
  832. .SUFFIXES: .ml .mli .cmo .cmi .cmx
  833.  
  834. diff --git a/otherlibs/threads/Makefile b/otherlibs/threads/Makefile
  835. index 0e6ef86..da89aaa 100644
  836. --- a/otherlibs/threads/Makefile
  837. +++ b/otherlibs/threads/Makefile
  838. @@ -18,7 +18,7 @@ include ../../config/Makefile
  839. CC=$(BYTECC)
  840. CFLAGS=-I../../byterun -O $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -g
  841. CAMLC=../../ocamlcomp.sh -I ../unix
  842. -MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
  843. +MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib $(HOST)
  844. COMPFLAGS=-warn-error A
  845.  
  846. C_OBJS=scheduler.o
  847. diff --git a/stdlib/Makefile b/stdlib/Makefile
  848. index 874dcf6..734028f 100644
  849. --- a/stdlib/Makefile
  850. +++ b/stdlib/Makefile
  851. @@ -23,10 +23,11 @@ allopt-prof: stdlib.p.cmxa std_exit.p.cmx
  852. rm -f std_exit.p.cmi
  853.  
  854. installopt: installopt-default installopt-$(PROFILING)
  855. + cp *.cmi *.mli *.ml $(LIBDIR)
  856.  
  857. installopt-default:
  858. cp stdlib.cmxa stdlib.a std_exit.o *.cmx $(LIBDIR)
  859. - cd $(LIBDIR); $(RANLIB) stdlib.a
  860. + cd $(LIBDIR); $(TARGETRANLIB) stdlib.a
  861.  
  862. installopt-noprof:
  863. rm -f $(LIBDIR)/stdlib.p.cmxa; ln -s stdlib.cmxa $(LIBDIR)/stdlib.p.cmxa
  864. @@ -37,7 +38,7 @@ installopt-noprof:
  865.  
  866. installopt-prof:
  867. cp stdlib.p.cmxa stdlib.p.a std_exit.p.cmx std_exit.p.o $(LIBDIR)
  868. - cd $(LIBDIR); $(RANLIB) stdlib.p.a
  869. + cd $(LIBDIR); $(TARGETRANLIB) stdlib.p.a
  870.  
  871. stdlib.p.cmxa: $(OBJS:.cmo=.p.cmx)
  872. $(CAMLOPT) -a -o stdlib.p.cmxa $(OBJS:.cmo=.p.cmx)
  873. diff --git a/tools/Makefile.shared b/tools/Makefile.shared
  874. index 12bf76f..8d4c32d 100644
  875. --- a/tools/Makefile.shared
  876. +++ b/tools/Makefile.shared
  877. @@ -112,6 +112,7 @@ ocamlmklib.ml: ocamlmklib.mlp ../config/Makefile
  878. -e "s|%%NATIVECCRPATH%%|$(NATIVECCRPATH)|" \
  879. -e "s|%%MKSHAREDLIBRPATH%%|$(MKSHAREDLIBRPATH)|" \
  880. -e "s|%%RANLIB%%|$(RANLIB)|" \
  881. + -e "s|%%TARGETRANLIB%%|$(TARGETRANLIB)|" \
  882. ocamlmklib.mlp >> ocamlmklib.ml
  883.  
  884. beforedepend:: ocamlmklib.ml
  885. diff --git a/tools/ocamlmklib.mlp b/tools/ocamlmklib.mlp
  886. index 737749c..7cb7217 100644
  887. --- a/tools/ocamlmklib.mlp
  888. +++ b/tools/ocamlmklib.mlp
  889. @@ -36,6 +36,7 @@ and output = ref "a" (* Output name for Caml part of library *)
  890. and output_c = ref "" (* Output name for C part of library *)
  891. and rpath = ref [] (* rpath options *)
  892. and verbose = ref false
  893. +and host = ref false
  894.  
  895. let starts_with s pref =
  896. String.length s >= String.length pref &&
  897. @@ -119,6 +120,8 @@ let parse_arguments argv =
  898. rpath := chop_prefix s "-Wl,-R" :: !rpath
  899. else if s = "-v" || s = "-verbose" then
  900. verbose := true
  901. + else if s = "-host" then
  902. + host := true
  903. else if s = "-version" then
  904. print_version ()
  905. else if s = "-vnum" then
  906. @@ -223,7 +226,7 @@ let build_libs () =
  907. if !dynlink then begin
  908. let retcode = command
  909. (Printf.sprintf "%s -o %s %s %s %s %s %s"
  910. - mkdll
  911. + (if !host then mkdll else targetmkdll)
  912. (prepostfix "dll" !output_c ext_dll)
  913. (String.concat " " !c_objs)
  914. (String.concat " " !c_opts)
  915. @@ -236,7 +239,8 @@ let build_libs () =
  916. end;
  917. safe_remove (prepostfix "lib" !output_c ext_lib);
  918. scommand
  919. - (mklib (prepostfix "lib" !output_c ext_lib)
  920. + ((if !host then mklib else targetmklib)
  921. + (prepostfix "lib" !output_c ext_lib)
  922. (String.concat " " !c_objs) "");
  923. end;
  924. if !bytecode_objs <> [] then
  925. diff --git a/utils/ccomp.ml b/utils/ccomp.ml
  926. index 94a2921..2e27343 100644
  927. --- a/utils/ccomp.ml
  928. +++ b/utils/ccomp.ml
  929. @@ -53,7 +53,7 @@ let quote_optfile = function
  930. let compile_file name =
  931. command
  932. (Printf.sprintf
  933. - "%s -c %s %s %s %s"
  934. + "%s -c %s %s %s %s %s"
  935. (match !Clflags.c_compiler with
  936. | Some cc -> cc
  937. | None ->
  938. @@ -63,6 +63,9 @@ let compile_file name =
  939. (String.concat " " (List.rev !Clflags.ccopts))
  940. (quote_prefixed "-I" (List.rev !Clflags.include_dirs))
  941. (Clflags.std_include_flag "-I")
  942. + (if !Clflags.native_code
  943. + then Clflags.std_include_flag "-I"
  944. + else Clflags.std_host_include_flag "-I")
  945. (Filename.quote name))
  946.  
  947. let create_archive archive file_list =
  948. @@ -98,7 +101,7 @@ type link_mode =
  949. | MainDll
  950. | Partial
  951.  
  952. -let call_linker mode output_name files extra =
  953. +let call_linker target mode output_name files extra =
  954. let files = quote_files files in
  955. let cmd =
  956. if mode = Partial then
  957. @@ -109,12 +112,15 @@ let call_linker mode output_name files extra =
  958. extra
  959. else
  960. Printf.sprintf "%s -o %s %s %s %s %s %s %s"
  961. - (match !Clflags.c_compiler, mode with
  962. - | Some cc, _ -> cc
  963. - | None, Exe -> Config.mkexe
  964. - | None, Dll -> Config.mkdll
  965. - | None, MainDll -> Config.mkmaindll
  966. - | None, Partial -> assert false
  967. + (match !Clflags.c_compiler, mode, target with
  968. + | Some cc, _, _ -> cc
  969. + | None, Exe, false -> Config.mkexe
  970. + | None, Dll, false -> Config.mkdll
  971. + | None, MainDll, false -> Config.mkmaindll
  972. + | None, Exe, true -> Config.target_mkexe
  973. + | None, Dll, true -> Config.target_mkdll
  974. + | None, MainDll, true -> Config.target_mkmaindll
  975. + | None, Partial, _ -> assert false
  976. )
  977. (Filename.quote output_name)
  978. (if !Clflags.gprofile then Config.cc_profile else "")
  979. diff --git a/utils/ccomp.mli b/utils/ccomp.mli
  980. index 72ae713..d467d82 100644
  981. --- a/utils/ccomp.mli
  982. +++ b/utils/ccomp.mli
  983. @@ -29,4 +29,4 @@ type link_mode =
  984. | MainDll
  985. | Partial
  986.  
  987. -val call_linker: link_mode -> string -> string list -> string -> bool
  988. +val call_linker: bool -> link_mode -> string -> string list -> string -> bool
  989. diff --git a/utils/clflags.ml b/utils/clflags.ml
  990. index 1074d36..c806728 100644
  991. --- a/utils/clflags.ml
  992. +++ b/utils/clflags.ml
  993. @@ -86,8 +86,13 @@ let std_include_flag prefix =
  994. else (prefix ^ (Filename.quote Config.standard_library))
  995. ;;
  996.  
  997. +let std_host_include_flag prefix =
  998. + if !no_std_include then ""
  999. + else (prefix ^ (Filename.quote Config.standard_library) ^ "/host")
  1000. +;;
  1001. +
  1002. let std_include_dir () =
  1003. - if !no_std_include then [] else [Config.standard_library]
  1004. + if !no_std_include then [] else [Config.standard_library; Config.standard_library ^ "/host"]
  1005. ;;
  1006.  
  1007. let shared = ref false (* -shared *)
  1008. diff --git a/utils/clflags.mli b/utils/clflags.mli
  1009. index d5357ef..658873b 100644
  1010. --- a/utils/clflags.mli
  1011. +++ b/utils/clflags.mli
  1012. @@ -73,6 +73,7 @@ val native_code : bool ref
  1013. val inline_threshold : int ref
  1014. val dont_write_files : bool ref
  1015. val std_include_flag : string -> string
  1016. +val std_host_include_flag : string -> string
  1017. val std_include_dir : unit -> string list
  1018. val shared : bool ref
  1019. val dlcode : bool ref
  1020. diff --git a/utils/config.mli b/utils/config.mli
  1021. index da39808..3ffadf5 100644
  1022. --- a/utils/config.mli
  1023. +++ b/utils/config.mli
  1024. @@ -47,6 +47,14 @@ val mkmaindll: string
  1025. (* The linker command line to build main programs as dlls. *)
  1026. val ranlib: string
  1027. (* Command to randomize a library, or "" if not needed *)
  1028. +val target_mkdll: string
  1029. + (* The linker command line to build dynamic libraries (for 'target' platform). *)
  1030. +val target_mkexe: string
  1031. + (* The linker command line to build executables (for 'target' platform). *)
  1032. +val target_mkmaindll: string
  1033. + (* The linker command line to build main programs as dlls (for 'target' platform). *)
  1034. +val target_ranlib: string
  1035. + (* Command to randomize a library, or "" if not needed (for 'target' platform) *)
  1036. val cc_profile : string
  1037. (* The command line option to the C compiler to enable profiling. *)
  1038.  
  1039. diff --git a/utils/config.mlp b/utils/config.mlp
  1040. index 4cabf90..b2f1f6a 100644
  1041. --- a/utils/config.mlp
  1042. +++ b/utils/config.mlp
  1043. @@ -44,10 +44,14 @@ let native_c_compiler = "%%NATIVECC%%"
  1044. let native_c_libraries = "%%NATIVECCLIBS%%"
  1045. let native_pack_linker = "%%PACKLD%%"
  1046. let ranlib = "%%RANLIBCMD%%"
  1047. +let target_ranlib = "%%TARGETRANLIBCMD%%"
  1048. let cc_profile = "%%CC_PROFILE%%"
  1049. let mkdll = "%%MKDLL%%"
  1050. let mkexe = "%%MKEXE%%"
  1051. let mkmaindll = "%%MKMAINDLL%%"
  1052. +let target_mkdll = "%%TARGETMKDLL%%"
  1053. +let target_mkexe = "%%TARGETMKEXE%%"
  1054. +let target_mkmaindll = "%%TARGETMKMAINDLL%%"
  1055.  
  1056. let exec_magic_number = "Caml1999X008"
  1057. and cmi_magic_number = "Caml1999I012"
  1058. --
  1059. 1.7.3.4
Add Comment
Please, Sign In to add comment