2 # (C) Copyright 2015-2016 Red Hat Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 # See guestfs-hacking(1) section "HOW OCAML PROGRAMS ARE COMPILED AND LINKED"
20 # Hack automake to link OCaml-based binaries properly.
21 # There is no other way to add the -cclib parameter to the end of
25 # ./ocaml-link.sh -cclib '...' -- ARGS
26 # Pass the cclib argument separately, and the rest as separated
29 TEMP=`getopt -a -o '' --long 'cclib:' \
30 -n "$(basename $0)" -- "$@"`
31 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
38 -cclib|--cclib) cclib="$2" ; shift 2 ;;
40 *) echo "Internal error!" ; exit 1 ;;
44 exec "$@" -linkpkg -cclib "${cclib}"