Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

269 lines (204 sloc) 6.3 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, "$target")
AC_PATH_PROG(ERL, erl)
AC_PATH_PROG(ERLC, erlc)
ERLBINDIR=`dirname "$ERL"` ; ERLBINDIR=`dirname "$ERLBINDIR"`/lib/erlang/bin
AC_SUBST(ERL)
AC_SUBST(ERLC)
AC_SUBST(ERLBINDIR)
AC_ARG_WITH(default-charset,
[ --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,
[ --with-extrainclude= 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, [--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
AC_DEFUN(BT_ERL_LIB_VSN,
[
AC_MSG_CHECKING([$1 version])
AC_CACHE_VAL(bt_cv_$1_vsn,
[bt_cv_$1_vsn="`ls \"${ERLDIR}\" \"${ERLDIR}/lib\" | \
awk -F- '/^$1-/ { if ([$]2 > v) v=[$]2; }
END { print v; }'`"
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
dnl
dnl I keep the cugwin dll code in case I later learn how to
dnl compile a linked in driver on windows using gcc
dnl
case "$target_os" in
*cygwin*)
ERLDIR=`echo "${ERL}" | sed 's/\/bin\/*erl.*//'`
ERL_DLL_LIB="${ERLDIR}/usr/lib/erl_dll.lib"
AC_SUBST(ERL_DLL_LIB)
;;
*)
ERLDIR=`awk -F= '/ROOTDIR=/ { print [$]2; exit; }' $ERL`;;
esac
if test ! -d "$ERLDIR" ; then
AC_MSG_ERROR([Broken Erlang installation, $ERLDIR does not exist!])
fi
AC_SUBST(ERLDIR)
AC_SUBST(ERL_DLL_LIB)
BT_ERL_LIB_VSN(erts)
BT_ERL_LIB_VSN(kernel)
BT_ERL_LIB_VSN(stdlib)
BT_ERL_LIB_VSN(sasl)
BT_ERL_LIB_VSN(mnesia)
AC_PROG_CC
AC_PROG_GCC_TRADITIONAL
dnl ===============================================================
dnl Checks for programs.
dnl ===============================================================
dnl
dnl cygwin code here is broken and not used ....
dnl
case "$target_os" in
*cygwin*)
WIN32=win32
cat >> confdefs.h <<\EOF
#define WIN32 1
EOF
LD_SHARED="gcc -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 to 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 "$target_os" in
*linux*)
AC_DEFINE(LINUX)
LD_SHARED="gcc -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 "$target_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*)
HAVE_SENDFILE=true
CFLAGS="$CFLAGS -I/usr/include/pam"
LD_SHARED="gcc -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(Non-supported target OS!)
;;
esac
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)
Jump to Line
Something went wrong with that request. Please try again.