~ubuntu-branches/ubuntu/oneiric/ocsigen/oneiric

« back to all changes in this revision

Viewing changes to myocamlfind.ml

  • Committer: Bazaar Package Importer
  • Author(s): Stephane Glondu
  • Date: 2009-07-02 10:02:08 UTC
  • mfrom: (1.1.9 upstream) (4.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090702100208-n158b1sqwzn0asil
Tags: 1.2.0-2
Fix build on non-native architectures

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(* Ocsigen
 
2
 * http://www.ocsigen.org
 
3
 * ocamlfind/ocamlducefind wrapper
 
4
 * Copyright (C) 2009 St�phane Glondu
 
5
 * Laboratoire PPS - CNRS Universit� Paris Diderot
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU Lesser General Public License
 
9
 * as published by the Free Software Foundation, with linking
 
10
 * exception; either version 2.1 of the License, or (at your option)
 
11
 * any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful, but
 
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Lesser General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public
 
19
 * License along with this program; if not, write to the Free Software
 
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
21
 * 02111-1307, USA.
 
22
 *)
 
23
 
 
24
let rec argv_pick_duce res accu i =
 
25
  if i <= 0 then
 
26
    (res, accu)
 
27
  else if Sys.argv.(i) = "-duce" then
 
28
    argv_pick_duce true accu (i-1)
 
29
  else
 
30
    argv_pick_duce res (Sys.argv.(i)::accu) (i-1)
 
31
 
 
32
let _ =
 
33
  let (duce, argv) = argv_pick_duce false [] (Array.length Sys.argv-1) in
 
34
  let command = if duce then "ocamlducefind" else "ocamlfind" in
 
35
  let argv = Array.of_list (command::argv) in
 
36
  Unix.execvp command argv