adam@2003: AC_INIT([urweb], [20140426]) adam@2003: WORKING_VERSION=0 adamc@1149: AC_USE_SYSTEM_EXTENSIONS adam@1760: adam@1760: # automake 1.12 requires this, but automake 1.11 doesn't recognize it adam@1762: m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) adam@1760: adamc@1148: AM_INIT_AUTOMAKE([-Wall -Werror foreign no-define]) adamc@1132: AC_PROG_CC() adamc@1132: AC_PROG_LIBTOOL() adamc@1141: AC_CONFIG_MACRO_DIR([m4]) ezyang@1739: AC_CONFIG_HEADERS([include/urweb/config.h]) adamc@378: adam@1528: AX_PTHREAD([echo >/dev/null], [echo "Your C compiler does not support POSIX threads."; exit 1]) adam@1528: adam@1369: AX_CHECK_OPENSSL([echo >/dev/null], [echo "You must install OpenSSL development files."; exit 1]) adamc@1165: adamc@1165: AC_CHECK_PROG(MLTON, mlton, yes, []) adamc@1165: adamc@1165: if test [-z $MLTON]; then adamc@1165: echo "You must install MLton." adamc@1165: exit 1 adamc@1165: fi adamc@1165: adamc@1165: AC_CHECK_PROG(MLLEX, mllex, yes, []) adamc@1165: adamc@1165: if test [-z $MLLEX]; then adamc@1165: echo "You must install MLton (to get mllex)." adamc@1165: exit 1 adamc@1165: fi adamc@1165: adamc@1165: AC_CHECK_PROG(MLYACC, mlyacc, yes, []) adamc@1165: adamc@1165: if test [-z $MLYACC]; then adamc@1165: echo "You must install MLton (to get mlyacc)." adamc@1165: exit 1 adamc@1165: fi adamc@1165: adamc@429: if test [$prefix = "NONE"]; then adamc@429: prefix=/usr/local adamc@429: fi adamc@429: adamc@378: if test [-z $BIN]; then adamc@429: BIN=$prefix/bin adamc@378: fi adamc@378: adamc@378: if test [-z $LIB]; then ezyang@1739: LIB=$prefix/lib ezyang@1739: fi ezyang@1739: ezyang@1739: if test [-z $SRCLIB]; then ezyang@1739: SRCLIB=$prefix/lib/urweb adamc@378: fi adamc@378: adamc@378: if test [-z $INCLUDE]; then adamc@429: INCLUDE=$prefix/include/urweb adamc@378: fi adamc@378: adamc@378: if test [-z $SITELISP]; then adamc@429: SITELISP=$prefix/share/emacs/site-lisp/urweb-mode adamc@378: fi adamc@378: adam@1441: AC_ARG_WITH([emacs], adam@1441: [AS_HELP_STRING([--without-emacs], adam@1441: [disable installation of Emacs mode])], adam@1441: [], adam@1441: [with_emacs=yes]) adam@1441: adam@1441: AM_CONDITIONAL(USE_EMACS, test "x$with_emacs" = xyes) adam@1441: adam@1464: if test [-z $PGHEADER]; then adam@1464: AC_CHECK_HEADERS([postgresql/libpq-fe.h], adam@1464: [PGHEADER=postgresql/libpq-fe.h]) adam@1464: fi adam@1464: adam@1464: if test [-z $PGHEADER]; then adam@1464: PGHEADER=libpq-fe.h adam@1464: fi adam@1464: adam@1464: if test [-z $MSHEADER]; then adam@1464: AC_CHECK_HEADERS([mysql/mysql.h], adam@1464: [MSHEADER=mysql/mysql.h]) adam@1464: fi adam@1464: adam@1464: if test [-z $MSHEADER]; then adam@1464: MSHEADER=mysql.h adam@1464: fi adam@1464: adam@1464: if test [-z $SQHEADER]; then adam@1464: SQHEADER=sqlite3.h adam@1464: fi adam@1464: adam@1520: if test [$WORKING_VERSION = "1"]; then adam@1526: VERSION="$VERSION + `hg identify || (cat .hg_archival.txt | grep 'node\:') || echo ?`" adam@1520: fi adam@1520: mad@1825: # Clang does not like being passed -pthread, since it's implicit on OS X. mad@1825: # So let's get rid of that! Here's to hoping it doesn't break Clang mad@1825: # on other platforms. mad@1825: AC_MSG_CHECKING([if compiling with clang]) mad@1825: AC_COMPILE_IFELSE( mad@1825: [AC_LANG_PROGRAM([], [[ mad@1825: #ifndef __clang__ mad@1825: not clang mad@1825: #endif mad@1825: ]])], mad@1825: [CLANG=yes], [CLANG=no]) mad@1825: AC_MSG_RESULT([$CLANG]) mad@1825: mad@1825: if test [$CLANG = "yes"]; then mad@1825: PTHREAD_CFLAGS="" mad@1825: PTHREAD_LIBS="" mad@1825: fi mad@1825: adam@1474: AC_SUBST(CC) adamc@378: AC_SUBST(BIN) adamc@378: AC_SUBST(LIB) ezyang@1739: AC_SUBST(SRCLIB) adamc@378: AC_SUBST(INCLUDE) adamc@378: AC_SUBST(SITELISP) adam@1523: AC_SUBST(CCARGS) jgross@1837: AC_SUBST(MLTONARGS) adam@1464: AC_SUBST(PGHEADER) adam@1464: AC_SUBST(MSHEADER) adam@1464: AC_SUBST(SQHEADER) adam@1520: AC_SUBST(VERSION) adam@1528: AC_SUBST(PTHREAD_CFLAGS) adam@1528: AC_SUBST(PTHREAD_LIBS) adamc@378: adamc@1132: AC_CONFIG_FILES([ adamc@1132: Makefile adamc@1132: src/c/Makefile adamc@1132: src/config.sml adamc@1132: ]) adamc@378: adamc@378: AC_OUTPUT() adamc@378: adamc@378: cat <