blob: 63c574c63de81125ab231cadabacf795020c8378 [file] [log] [blame]
dnl Copyright (c) 2008 Hunter Morris <huntermorris@gmail.com>
dnl
dnl Permission to use, copy, modify, and distribute this software for any
dnl purpose with or without fee is hereby granted, provided that the above
dnl copyright notice and this permission notice appear in all copies.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_INIT([LOCAL_PACKAGE_NAME], [LOCAL_VERSION], [], [LOCAL_PACKAGE_TARNAME])
AC_PREREQ([2.59])
AC_CONFIG_SRCDIR([README])
AC_CONFIG_AUX_DIR([build-aux])
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.6.3 foreign])
AC_GNU_SOURCE
AC_ENABLE_SHARED
AC_DISABLE_STATIC
AM_PROG_AS
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_MSG_CHECKING([for pthread_create in -lpthread])
original_LIBS="$LIBS"
LIBS="-lpthread $original_LIBS"
AC_TRY_LINK([#include<pthread.h>],
[pthread_create((void *)0, (void *)0, (void *)0, (void *)0)],
[pthread=yes], [pthread=no])
if test x${pthread} = xyes; then
AC_MSG_RESULT([yes])
else
LIBS="$original_LIBS"
AC_MSG_RESULT([no])
fi
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"
])
AC_ARG_WITH([erl_interface], [AC_HELP_STRING([--with-erl-interface=PATH],
[set PATH to the erl_interface directory])], [
ERLANG_FLAGS="$ERLANG_FLAGS -I$withval/include -L$withval/lib"
], [
ERLANG_FLAGS="$ERLANG_FLAGS"
])
# XP_UNIX required for various things and has been tested to work on Linux and Darwin.
LIB_FLAGS="-L/usr/local/lib -L/opt/local/lib"
LIBS="$LIB_FLAGS $LIBS"
FLAGS="$LIB_FLAGS $ERLANG_FLAGS -DXP_UNIX $FLAGS"
CPPFLAGS="$FLAGS $CPPFLAGS"
LDFLAGS="$FLAGS $LDFLAGS"
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.0 (R12B)."
version="`${ERL} -version 2>&1 | ${SED} "s/[[^0-9]]/ /g"`"
if test `echo $version | ${AWK} "{print \\$1}"` -lt 5; then
AC_MSG_ERROR([$erlang_version_error])
fi
if test `echo $version | ${AWK} "{print \\$2}"` -lt 6; then
AC_MSG_ERROR([$erlang_version_error])
fi
AC_PATH_PROG([ERLC], [erlc])
if test x${ERLC} = x; then
AC_MSG_ERROR([Could not find the `erlc' executable. Is Erlang installed?])
fi
AC_CHECK_HEADER([erl_driver.h], [], [
AC_MSG_ERROR([Could not find the `erl_driver.h' header.
Are the Erlang headers installed? Use the `--with-erlang' option to specify
the path to the Erlang directory.])])
AC_CHECK_HEADER([erl_interface.h], [], [
AC_MSG_ERROR([Could not find the `erl_interface.h' header.
Are the erl_interface headers installed? Use the `--with-erl-interface'
option to specify the path to erl_interface directory.])])
AC_ARG_VAR([ERL_EXECUTABLE], [path to the `erl' executable])
AC_ARG_VAR([ERLC_EXECUTABLE], [path to the `erlc' executable])
AC_SUBST([package_author_name], ["LOCAL_PACKAGE_AUTHOR_NAME"])
AC_SUBST([package_author_address], ["LOCAL_PACKAGE_AUTHOR_ADDRESS"])
AC_SUBST([package_identifier], ["LOCAL_PACKAGE_IDENTIFIER"])
AC_SUBST([package_tarname], ["LOCAL_PACKAGE_TARNAME"])
AC_SUBST([package_name], ["LOCAL_PACKAGE_NAME"])
AC_SUBST([version], ["LOCAL_VERSION"])
AC_SUBST([version_major], ["LOCAL_VERSION_MAJOR"])
AC_SUBST([version_minor], ["LOCAL_VERSION_MINOR"])
AC_SUBST([version_revision], ["LOCAL_VERSION_REVISION"])
AC_SUBST([version_stage], ["LOCAL_VERSION_STAGE"])
AC_SUBST([version_release], ["LOCAL_VERSION_RELEASE"])
AC_SUBST([bug_uri], ["LOCAL_BUG_URI"])
AC_SUBST([localconfdir], [${sysconfdir}/${package_identifier}])
AC_SUBST([localdatadir], [${datadir}/${package_identifier}])
AC_SUBST([localdocdir], [${datadir}/doc/${package_identifier}])
AC_SUBST([locallibdir], [${libdir}/${package_identifier}])
AC_SUBST([localstatelibdir], [${localstatedir}/lib/${package_identifier}])
AC_SUBST([localstatelogdir], [${localstatedir}/log/${package_identifier}])
AC_SUBST([locallibbindir], [${locallibdir}/bin])
AC_SUBST([localerlangbindir], [${locallibdir}/erlang/bin])
AC_SUBST([localerlanglibdir], [${locallibdir}/erlang/lib])
AC_REVISION([LOCAL_VERSION])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([lib/bcrypt/Makefile])
AC_OUTPUT