Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Makes it easier to compile with a "local" version of llvm (let me kno…

…w if this breaks your build)
  • Loading branch information...
commit 10d59fef07a19892d0a99c3b54a4a58e86c4768f 1 parent 00862c1
@pikatchu authored
Showing with 55 additions and 30 deletions.
  1. +55 −30 configure
View
85 configure
@@ -2,22 +2,22 @@
# Copyright (c) 2011, Julien Verlaguet
# All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
-#
+#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the
# distribution.
-#
+#
# 3. Neither the name of Julien Verlaguet nor the names of
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -41,7 +41,7 @@ ocamlyacc=""
llc=""
llbindings=""
-llvm_cma="$(ocamlc -where)/llvm.cma"
+llvm_cma=""
llvm_analysis_cma=""
llvm_bitwriter_cma=""
llvm_scalar_opts_cma=""
@@ -65,25 +65,25 @@ do
case "$1" in
"") break;;
- --cpp)
+ --cpp)
cpp=$2 ; shift ;;
- --cc)
+ --cc)
cc=$2 ; shift ;;
- --ar)
+ --ar)
ar=$2 ; shift ;;
- --ocamlc)
+ --ocamlc)
ocamlc=$2 ; shift ;;
- --ocamlopt)
+ --ocamlopt)
ocamlopt=$2 ; shift ;;
- --ocamldep)
+ --ocamldep)
ocamldep=$2 ; shift ;;
- --ocamllex)
+ --ocamllex)
ocamllex=$2 ; shift ;;
- --ocamlyacc)
+ --ocamlyacc)
ocamlyacc=$2 ; shift ;;
- --bindir)
+ --bindir)
bindir=$ ; shift ;;
- --libdir)
+ --libdir)
libdir=$2 ; shift ;;
--llc)
llc=$2 ; shift ;;
@@ -104,7 +104,7 @@ fi
if test -z "$cc"; then
cc=`which gcc`;
if test -z "$cc"; then
- echo "Couldn't find a C compiler please use --cc";
+ echo "Couldn't find a C compiler please use --cc";
exit 2
fi
echo -e "Found cc\t: $cc"
@@ -113,7 +113,7 @@ fi
if test -z "$ar"; then
ar=`which ar`;
if test -z "$ar"; then
- echo "Couldn't find ar please use --ar";
+ echo "Couldn't find ar please use --ar";
exit 2
fi
echo -e "Found ar\t: $ar"
@@ -122,7 +122,7 @@ fi
if test -z "$cpp"; then
cpp=`which g++`;
if test -z "$cpp"; then
- echo "Couldn't find a C++ compiler please use --cpp";
+ echo "Couldn't find a C++ compiler please use --cpp";
exit 2
fi
echo -e "Found cpp\t: $cpp"
@@ -133,7 +133,7 @@ if test -z "$ocamlc"; then
if test -z "$ocamlc"; then
ocamlc=`which ocamlc`;
if test -z "$ocamlc"; then
- echo "Couldn't find ocamlc compiler please use --ocamlc";
+ echo "Couldn't find ocamlc compiler please use --ocamlc";
exit 2
fi
fi
@@ -145,7 +145,7 @@ if test -z "$ocamlopt"; then
if test -z "$ocamlopt"; then
ocamlopt=`which ocamlopt`;
if test -z "$ocamlopt"; then
- echo "Couldn't find ocamlopt please use --ocamlopt";
+ echo "Couldn't find ocamlopt please use --ocamlopt";
exit 2
fi
fi
@@ -181,14 +181,14 @@ if test -z "$llc"; then
if test -z "$llc"; then
llc=`which llc`;
if test -z "$llc"; then
- echo "Couldn't find a llc (llvm compiler) please use --llc";
+ echo "Couldn't find a llc (llvm compiler) please use --llc";
exit 2
fi
fi
echo -e "Found llc\t: $llc"
fi
-if [ $os = "Darwin" ]; then
+if [ $os = "Darwin" ]; then
llvm_cma="`ocamlc -where`/llvm.cma"
llbindings=`dirname $llvm_cma`
llvm_analysis_cma="$llbindings/llvm_analysis.cma"
@@ -201,6 +201,31 @@ if [ $os = "Darwin" ]; then
llvm_target_cma_base="target"
fi
+if test "$llbindings"; then
+ llvm_cma="$llbindings/llvm.cma";
+ llvm_analysis_cma="$llbindings/llvm_analysis.cma"
+ llvm_bitwriter_cma="$llbindings/llvm_bitwriter.cma"
+ llvm_scalar_opts_cma="$llbindings/llvm_scalar_opts.cma"
+ llvm_target_cma="$llbindings/llvm_target.cma"
+
+ if ! test -e "$llbindings/llvm.cma"; then
+ echo "Couldn't find: $llvm_cma"; exit 2;
+ fi
+ if ! test -e $llvm_analysis_cma; then
+ echo "Couldn't find: $llvm_analysis_cma"; exit 2;
+ fi
+ if ! test -e $llvm_bitwriter_cma; then
+ echo "Couldn't find: $llvm_bitwriter_cma"; exit 2;
+ fi
+ if ! test -e $llvm_scalar_opts_cma; then
+ echo "Couldn't find: $llvm_scalar_opts_cma"; exit 2;
+ fi
+ if ! test -e $llvm_target_cma; then
+ echo "Couldn't find: $llvm_target_cma"; exit 2;
+ fi
+else $llbindings=$(ocamlc -where)
+fi
+
if test -z "$llbindings"; then
if test -z "$llvm_cma"; then
llvm_cma="/usr/lib/ocaml/llvm-2.8/llvm.cma"
@@ -216,7 +241,7 @@ if test -z "$llbindings"; then
echo "Could not find ocaml bindings for llvm!" ; exit 2
fi
fi
- fi
+ fi
fi
llbindings=`dirname $llvm_cma`
@@ -284,7 +309,7 @@ echo ""
llc_version=`$llc -version | grep version` ;
if [[ "$llc_version" =~ .*version.2.[8|9].* ]]; then
echo -e "Checking llc \t: OK$llc_version"
-else
+else
echo "Bad version of llc (expected version 2.8): $version" 2>&1;
exit 2
fi
@@ -292,7 +317,7 @@ fi
ocamlc_version=`$ocamlc -version` ;
if [[ "$ocamlc_version" =~ 3.1[^0].* ]]; then
echo -e "Checking ocamlc \t: OK $ocamlc_version"
-else
+else
echo "Bad version of ocamlc (< 3.11): $version" 2>&1;
exit 2
fi
@@ -300,7 +325,7 @@ fi
ocamlopt_version=`$ocamlopt -version` ;
if [[ "$ocamlopt_version" =~ 3.1[^0].* ]]; then
echo -e "Checking ocamlopt\t: OK $ocamlopt_version"
-else
+else
echo "Bad version of ocamlopt (< 3.11): $version" 2>&1;
exit 2
fi
@@ -308,7 +333,7 @@ fi
ocamllex_version=`$ocamllex -version` ;
if [[ "$ocamllex_version" =~ 3.1[^0].* ]]; then
echo -e "Checking ocamllex\t: OK $ocamllex_version"
-else
+else
echo "Bad version of ocamllex (< 3.11): $version" 2>&1;
exit 2
fi
@@ -316,7 +341,7 @@ fi
ocamlyacc_version=`$ocamlyacc -version` ;
if [[ "$ocamlyacc_version" =~ 3.1[^0].* ]]; then
echo -e "Checking ocamlyacc\t: OK $ocamlyacc_version"
-else
+else
echo "Bad version of ocamlyacc (< 3.11): $version" 2>&1;
exit 2
fi
@@ -324,7 +349,7 @@ fi
ocamldep_version=`$ocamldep -version` ;
if [[ "$ocamldep_version" =~ 3.1[^0].* ]]; then
echo -e "Checking ocamldep\t: OK $ocamldep_version"
-else
+else
echo "Bad version of ocamldep (< 3.11): $version" 2>&1;
exit 2
fi
@@ -338,7 +363,7 @@ if [[ "$march" == "ARCH_32" ]]; then
echo -e "Architecture\t: 32 bits"
else if [[ "$march" == "ARCH_64" ]]; then
echo -e "Architecture\t: 64 bits"
-else echo "Unknown architecture!" ; exit 2
+else echo "Unknown architecture!" ; exit 2
fi
fi
Please sign in to comment.
Something went wrong with that request. Please try again.