diff options
author | Trond Norbye <trond.norbye@gmail.com> | 2011-09-21 09:13:02 +0200 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2011-10-30 17:53:08 +0100 |
commit | 5f906a39b7c21f74175b359d8874e457c5fcb6a7 (patch) | |
tree | 99f9d9d7c566b5bac3e1eec9c718c4e866bfdde2 /configure.ac | |
parent | 6cffccdfe08e6d859cc7e83be3bcc521bf68fd5a (diff) | |
download | couchdb-5f906a39b7c21f74175b359d8874e457c5fcb6a7.tar.gz |
Try to determine the location of erl_driver.h at configure time
Use the existence of erl in path to try to figure out where the
file should be located unless the user specified it.
Patch by Trond Norbye.
Closes COUCHDB-162
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index 202b76110..a470f94e6 100644 --- a/configure.ac +++ b/configure.ac @@ -112,14 +112,28 @@ 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_FLAGS="-I$withval" ], [ - 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_SUBST(ERLANG_FLAGS) @@ -356,11 +370,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)." |