Skip to content

Commit

Permalink
Try to determine the location of erl_driver.h at configure time
Browse files Browse the repository at this point in the history
Use the existence of erl in path to try to figure out where the
file should be located unless the user specified it.

Change-Id: I558d0b14a4f99c4f395e12816be7636602eaebc5
Reviewed-on: http://review.couchbase.org/9696
Reviewed-by: Jan Lehnardt <jan@apache.org>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
trondn committed Sep 27, 2011
1 parent 7f04a66 commit 94b9743
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions configure.ac
Expand Up @@ -108,16 +108,30 @@ else
AC_MSG_RESULT([no])
fi

AC_PATH_PROG([ERL], [erl])
AS_IF([test x${ERL} = x], [
AC_MSG_ERROR([Could not find the `erl' executable. Is Erlang installed?])
])

AC_ARG_WITH([erlang], [AC_HELP_STRING([--with-erlang=PATH],
[set PATH to the Erlang include directory])], [
ERLANG_INCLUDE="$withval"
ERLANG_FLAGS="-I$ERLANG_INCLUDE"
AC_SUBST(ERLANG_INCLUDE)
], [
ERLANG_FLAGS="-I${libdir}/erlang/usr/include"
ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/lib/erlang/usr/include"
ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/local/lib/erlang/usr/include"
ERLANG_FLAGS="$ERLANG_FLAGS -I/opt/local/lib/erlang/usr/include"
realerl=`readlink -f $ERL 2>/dev/null`
AS_IF([test $? -eq 0], [
erlbase=`dirname $realerl`
erlbase=`dirname $erlbase`
ERLANG_FLAGS="-I${erlbase}/usr/include"
], [
# Failed to figure out where erl is installed..
# try to add some default directories to search
ERLANG_FLAGS="-I${libdir}/erlang/usr/include"
ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/lib/erlang/usr/include"
ERLANG_FLAGS="$ERLANG_FLAGS -I/usr/local/lib/erlang/usr/include"
ERLANG_FLAGS="$ERLANG_FLAGS -I/opt/local/lib/erlang/usr/include"
])
])

AC_ARG_WITH([js-include], [AC_HELP_STRING([--with-js-include=PATH],
Expand Down Expand Up @@ -339,11 +353,6 @@ case "$(uname -s)" in
;;
esac

AC_PATH_PROG([ERL], [erl])

if test x${ERL} = x; then
AC_MSG_ERROR([Could not find the `erl' executable. Is Erlang installed?])
fi

erlang_version_error="The installed Erlang version is less than 5.6.5 (R12B05)."

Expand Down

0 comments on commit 94b9743

Please sign in to comment.