Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

329 lines (261 sloc) 8.903 kb
DNA define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
AC_INIT(Makefile)
dnl work out who the cpu, vendor and OS are
AC_CANONICAL_SYSTEM
AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$host")
AC_ERLANG_NEED_ERL
AC_PATH_PROG(ERLC, erlc)
AC_SUBST(ERL)
AC_SUBST(ERLC)
AC_ARG_WITH(defaultcharset,
AS_HELP_STRING([--with-defaultcharset=String], [specify default charset, i.e UTF-8]))
if test "x$with_defaultcharset" = "x" ; then
DEFAULT_CHARSET=
else
DEFAULT_CHARSET=${with_defaultcharset}
fi
AC_SUBST(DEFAULT_CHARSET)
AC_ARG_WITH(extrainclude,
AS_HELP_STRING([--with-extrainclude=DIR], [dir to include if e.g. pam is installed in some odd place]))
if test "x$with_extrainclude" = "x" ; then
EXTRAINCLUDE=
else
EXTRAINCLUDE=-I${with_extrainclude}
fi
AC_SUBST(EXTRAINCLUDE)
AC_ARG_ENABLE(pam, AS_HELP_STRING([--disable-pam], [disables pam auth]), EPAM=, EPAM=../priv/epam)
AC_SUBST(EPAM)
dnl ----------------------------------------------------------------------
dnl
dnl BT_ERL_LIB_VSN figures out version of an erlang application
dnl and substitutes it as "APPNAME"_VSN
dnl
dnl Note that in the non-erts case, if checking ERLDIR for a versioned
dnl directory fails, it could be because the user is using a git clone
dnl of the Erlang/OTP repository. In that case, check for a vsn.mk file
dnl in the application subdirectory under the repository lib directory,
dnl and if found use the version found there.
AC_DEFUN([BT_ERL_LIB_VSN],
[
AC_MSG_CHECKING([$1 version])
AC_CACHE_VAL(bt_cv_$1_vsn,
[case "$1" in
erts)
bt_cv_$1_vsn=`"${ERL}" -noshell -eval 'io:format("~s~n",[[erlang:system_info(version)]]), erlang:halt().' | tail -1`
;;
*)
bt_cv_$1_vsn=`ls -1 "${ERLDIR}" "${ERLDIR}/lib" | \
awk -F- '/^$1-/ { if ([$]2 > v) v=[$]2; }
END { print v; }'`
if test -z "$bt_cv_$1_vsn" ; then
bt_cv_$1_vsn=`sed -e 's/^.*= *//' "${ERLDIR}/lib/$1/vsn.mk" 2>/dev/null`
fi
;;
esac
case "$bt_cv_$1_vsn" in
"")
AC_MSG_ERROR("Could not figure out version Erlang library: $1")
;;
*)
;;
esac])
translit($1, [a-z], [A-Z])_VSN=$bt_cv_$1_vsn
AC_SUBST(translit($1, [a-z], [A-Z])_VSN)dnl
AC_MSG_RESULT($bt_cv_$1_vsn)
])dnl
ERLDIR=`"${ERL}" -noshell -eval 'io:format("~s~n",[[code:root_dir()]]), erlang:halt().' | tail -1`
ERLBINDIR="${ERLDIR}/bin"
ERL_DLL_LIB="${ERLDIR}/usr/lib/erl_dll.lib"
if test ! -d "$ERLDIR" ; then
AC_MSG_ERROR([Broken Erlang installation, $ERLDIR does not exist!])
fi
AC_SUBST(ERLDIR)
AC_SUBST(ERLBINDIR)
AC_SUBST(ERL_DLL_LIB)
BT_ERL_LIB_VSN(erts)
ERTS_MINOR=`echo $bt_cv_erts_vsn | sed -e 's/^.\.//' -e 's/\..*//'`
ERTS_MAJOR=`echo $bt_cv_erts_vsn | sed 's/\..*//'`
AC_SUBST(ERTS_MINOR)
AC_SUBST(ERTS_MAJOR)
if test $ERTS_MAJOR -gt 5 -o '(' $ERTS_MAJOR -eq 5 -a $ERTS_MINOR -gt 6 ')'; then
BITS_SUPPORT=true
fi
AC_SUBST(BITS_SUPPORT)
BT_ERL_LIB_VSN(kernel)
BT_ERL_LIB_VSN(stdlib)
BT_ERL_LIB_VSN(sasl)
BT_ERL_LIB_VSN(ssl)
BT_ERL_LIB_VSN(mnesia)
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
dnl ===============================================================
dnl Checks for programs.
dnl ===============================================================
case "$host_os" in
*cygwin*)
WIN32=win32
cat >> confdefs.h << EOF
#define WIN32 1
EOF
LD_SHARED="$CC -shared"
DLL=dll
DLL_LIBS="-lc \"$ERL_DLL_LIB\""
EXE=.exe
AC_SUBST(EXE)
DLL=dll
AC_SUBST(DLL)
OBJ=obj
AC_SUBST(OBJ)
;;
*)
LINKER=$CC
AC_SUBST(LINKER)
AC_SUBST(CFLAGS)
OUT="-o "
AC_SUBST(OUT)
DLL=so
AC_SUBST(DLL)
OBJ=o
AC_SUBST(OBJ)
;;
esac
AC_SUBST(DLL_LIBS)
AC_PROG_MAKE_SET
AC_PROG_INSTALL
dnl Make LaTeX and related commands configurable
dnl
dnl We might want to check whether latex is pdflatex and creates
dnl PDF instead of DVI without being given -output-format=dvi.
dnl However, this at least allows to give the working command at
dnl configure time.
AC_ARG_VAR([DVILATEX], [(pdf)latex command creating DVI file])
AC_CHECK_PROG([DVILATEX], [latex], [latex])
AC_ARG_VAR([DVIPS], [dvips command])
AC_CHECK_PROG([DVIPS], [dvips], [dvips])
AC_ARG_VAR([PDFLATEX], [(pdf)latex command creating PDF file])
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
AC_ARG_VAR([EPSTOPDF], [epstopdf command])
AC_CHECK_PROG([EPSTOPDF], [epstopdf], [epstopdf])
AS_IF([test "x$DVILATEX" = "xno" || test "x$DVIPS" = "xno"],
[AC_SUBST([COND_DVILATEX], ["-"])],
[AC_SUBST([COND_DVILATEX], [""])])
AS_IF([test "x$PDFLATEX" = "xno" || test "x$EPSTOPDF" = "xno"],
[AC_SUBST([COND_PDFLATEX], ["-"])],
[AC_SUBST([COND_PDFLATEX], [""])])
dnl Sigh, pam headers do not seem to have a standard place. On FreeBSD and
dnl Linuces I've seen they are in /usr/include/security, but MacOS has them
dnl in /usr/include/pam... I'm too sick of M4 at this very moment to write
dnl a test that searches for the files, so hard coded for now...
dnl or use --with-extrainclude=....
CFLAGS="$CFLAGS -I/usr/include/security"
HAVE_SENDFILE=false
case "$host_os" in
*linux*)
AC_DEFINE(LINUX)
AC_LANG(Erlang)
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],[dnl
halt(try erlang:system_info({wordsize,external}) of
8 -> 0; 4 -> 1
catch _:badarg ->
case erlang:system_info(wordsize) of
8 -> 0; 4 -> 1
end end)])],
[AC_MSG_NOTICE(found 64-bit Erlang)
case "$host_cpu" in
x86_64) CBIT= ;;
*) CBIT=-m64 ;;
esac],
[AC_MSG_NOTICE(found 32-bit Erlang)
case "$host_cpu" in
i?86) CBIT= ;;
*) CBIT=-m32 ;;
esac])
CFLAGS="$CFLAGS $CBIT"
LD_SHARED="$CC $CBIT -shared"
AC_SUBST(LD_SHARED)
FPIC=-fpic
AC_SUBST(FPIC)
HAVE_SENDFILE=true
;;
*solaris*)
AC_DEFINE(SOLARIS)
LD_SHARED="ld -G"
AC_SUBST(LD_SHARED)
LIBS="$LIBS -lsocket -lnsl -lresolv"
AC_SUBST(LIBS)
FPIC=-fpic
AC_SUBST(FPIC)
;;
*bsd*)
AC_DEFINE(BSD)
case "$host_os" in
freebsd*)
HAVE_SENDFILE=true
;;
bsdi*)
BSDI=bsdi
AC_DEFINE(BSDI)
AC_SUBST(BSDI)
;;
esac
LD_SHARED="ld -Bshareable"
AC_SUBST(LD_SHARED)
FPIC=-fpic
AC_SUBST(FPIC)
;;
*darwin*)
AC_LANG(C)
AC_CHECK_LIB([c],[sendfile],[HAVE_SENDFILE=true])
case "$host_os" in
darwin10*)
AC_LANG(Erlang)
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],[dnl
halt(try erlang:system_info({wordsize,external}) of
8 -> 0; 4 -> 1
catch _:badarg ->
case erlang:system_info(wordsize) of
8 -> 0; 4 -> 1
end end)])],
[AC_MSG_NOTICE(found 64-bit Erlang)
CBIT=-m64],
[AC_MSG_NOTICE(found 32-bit Erlang)
CBIT=-m32])
;;
*)
CBIT=""
;;
esac
CFLAGS="$CFLAGS $CBIT -I/usr/include/pam"
LD_SHARED="$CC $CBIT -bundle -fPIC -flat_namespace -undefined suppress"
AC_SUBST(LD_SHARED)
FPIC=-fPIC
AC_SUBST(FPIC)
;;
*cygwin*)
AC_PATH_PROG(WERL, werl)
AC_SUBST(WERL)
AC_DEFINE(WIN32)
FPIC=-fpic
AC_SUBST(FPIC)
AC_SUBST(WIN32)
;;
*)
AC_MSG_RESULT(unknown)
AC_MSG_ERROR(Unsupported host OS!)
;;
esac
AC_ARG_ENABLE(sendfile, AS_HELP_STRING([--disable-sendfile], [disables use of sendfile system call]),
[ test "$enableval" = no && HAVE_SENDFILE=false ])
AC_SUBST(HAVE_SENDFILE)
YTOP=`pwd`
AC_SUBST(YTOP)
AC_OUTPUT(include.mk)
AC_OUTPUT(test/support/include.mk)
AC_OUTPUT(test/support/include.sh)
dnl pkg-config support
. ./vsn.mk
AC_SUBST(YAWS_VSN)
AC_OUTPUT(yaws.pc)
Jump to Line
Something went wrong with that request. Please try again.