annotate configure.ac @ 2281:75cb60a7f6f1

Simplify C interface.
author Ziv Scully <ziv@mit.edu>
date Thu, 12 Nov 2015 09:15:50 -0500
parents d25c42e5d8f4
children 1d6e7e3405f6
rev   line source
adam@2179 1 AC_INIT([urweb], [20151018])
adam@2182 2 WORKING_VERSION=1
adamc@1149 3 AC_USE_SYSTEM_EXTENSIONS
adam@1760 4
adam@1760 5 # automake 1.12 requires this, but automake 1.11 doesn't recognize it
adam@1762 6 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
adam@1760 7
adamc@1148 8 AM_INIT_AUTOMAKE([-Wall -Werror foreign no-define])
adamc@1132 9 AC_PROG_CC()
adamc@1132 10 AC_PROG_LIBTOOL()
adamc@1141 11 AC_CONFIG_MACRO_DIR([m4])
ezyang@1739 12 AC_CONFIG_HEADERS([include/urweb/config.h])
adamc@378 13
adam@1528 14 AX_PTHREAD([echo >/dev/null], [echo "Your C compiler does not support POSIX threads."; exit 1])
adam@1528 15
adam@1369 16 AX_CHECK_OPENSSL([echo >/dev/null], [echo "You must install OpenSSL development files."; exit 1])
adamc@1165 17
adamc@1165 18 AC_CHECK_PROG(MLTON, mlton, yes, [])
adamc@1165 19
adamc@1165 20 if test [-z $MLTON]; then
adamc@1165 21 echo "You must install MLton."
adamc@1165 22 exit 1
adamc@1165 23 fi
adamc@1165 24
adamc@1165 25 AC_CHECK_PROG(MLLEX, mllex, yes, [])
adamc@1165 26
adamc@1165 27 if test [-z $MLLEX]; then
adamc@1165 28 echo "You must install MLton (to get mllex)."
adamc@1165 29 exit 1
adamc@1165 30 fi
adamc@1165 31
adamc@1165 32 AC_CHECK_PROG(MLYACC, mlyacc, yes, [])
adamc@1165 33
adamc@1165 34 if test [-z $MLYACC]; then
adamc@1165 35 echo "You must install MLton (to get mlyacc)."
adamc@1165 36 exit 1
adamc@1165 37 fi
adamc@1165 38
adamc@429 39 if test [$prefix = "NONE"]; then
adamc@429 40 prefix=/usr/local
adamc@429 41 fi
adamc@429 42
adamc@378 43 if test [-z $BIN]; then
adamc@429 44 BIN=$prefix/bin
adamc@378 45 fi
adamc@378 46
adamc@378 47 if test [-z $LIB]; then
ezyang@1739 48 LIB=$prefix/lib
ezyang@1739 49 fi
ezyang@1739 50
ezyang@1739 51 if test [-z $SRCLIB]; then
ezyang@1739 52 SRCLIB=$prefix/lib/urweb
adamc@378 53 fi
adamc@378 54
adamc@378 55 if test [-z $INCLUDE]; then
adamc@429 56 INCLUDE=$prefix/include/urweb
adamc@378 57 fi
adamc@378 58
adamc@378 59 if test [-z $SITELISP]; then
adamc@429 60 SITELISP=$prefix/share/emacs/site-lisp/urweb-mode
adamc@378 61 fi
adamc@378 62
adam@1441 63 AC_ARG_WITH([emacs],
adam@1441 64 [AS_HELP_STRING([--without-emacs],
adam@1441 65 [disable installation of Emacs mode])],
adam@1441 66 [],
adam@1441 67 [with_emacs=yes])
adam@1441 68
adam@1441 69 AM_CONDITIONAL(USE_EMACS, test "x$with_emacs" = xyes)
adam@1441 70
adam@1464 71 if test [-z $PGHEADER]; then
adam@1464 72 AC_CHECK_HEADERS([postgresql/libpq-fe.h],
adam@1464 73 [PGHEADER=postgresql/libpq-fe.h])
adam@1464 74 fi
adam@1464 75
adam@1464 76 if test [-z $PGHEADER]; then
adam@1464 77 PGHEADER=libpq-fe.h
adam@1464 78 fi
adam@1464 79
adam@1464 80 if test [-z $MSHEADER]; then
adam@1464 81 AC_CHECK_HEADERS([mysql/mysql.h],
adam@1464 82 [MSHEADER=mysql/mysql.h])
adam@1464 83 fi
adam@1464 84
adam@1464 85 if test [-z $MSHEADER]; then
adam@1464 86 MSHEADER=mysql.h
adam@1464 87 fi
adam@1464 88
adam@1464 89 if test [-z $SQHEADER]; then
adam@1464 90 SQHEADER=sqlite3.h
adam@1464 91 fi
adam@1464 92
adam@1520 93 if test [$WORKING_VERSION = "1"]; then
adam@1526 94 VERSION="$VERSION + `hg identify || (cat .hg_archival.txt | grep 'node\:') || echo ?`"
adam@1520 95 fi
adam@1520 96
mad@1825 97 # Clang does not like being passed -pthread, since it's implicit on OS X.
mad@1825 98 # So let's get rid of that! Here's to hoping it doesn't break Clang
mad@1825 99 # on other platforms.
mad@1825 100 AC_MSG_CHECKING([if compiling with clang])
mad@1825 101 AC_COMPILE_IFELSE(
mad@1825 102 [AC_LANG_PROGRAM([], [[
mad@1825 103 #ifndef __clang__
mad@1825 104 not clang
mad@1825 105 #endif
mad@1825 106 ]])],
mad@1825 107 [CLANG=yes], [CLANG=no])
mad@1825 108 AC_MSG_RESULT([$CLANG])
mad@1825 109
mad@1825 110 if test [$CLANG = "yes"]; then
mad@1825 111 PTHREAD_CFLAGS=""
mad@1825 112 PTHREAD_LIBS=""
mad@1825 113 fi
mad@1825 114
bbaren@2174 115 # Check if pthread_t is a scalar or pointer type so we can use the correct
bbaren@2174 116 # OpenSSL functions on it.
bbaren@2174 117 AC_MSG_CHECKING([if pthread_t is a pointer type])
bbaren@2174 118 AC_COMPILE_IFELSE(
bbaren@2174 119 [AC_LANG_PROGRAM(
bbaren@2174 120 [[
bbaren@2174 121 #include <pthread.h>
bbaren@2174 122 ]],
bbaren@2174 123 [[
bbaren@2174 124 pthread_t a;
bbaren@2174 125 *a;
bbaren@2174 126 ]])],
bbaren@2174 127 AC_DEFINE([PTHREAD_T_IS_POINTER], [1], [Define if pthread_t is a pointer.])
bbaren@2174 128 AC_MSG_RESULT(yes),
bbaren@2174 129 AC_MSG_RESULT(no))
bbaren@2174 130
adam@1474 131 AC_SUBST(CC)
adamc@378 132 AC_SUBST(BIN)
adamc@378 133 AC_SUBST(LIB)
ezyang@1739 134 AC_SUBST(SRCLIB)
adamc@378 135 AC_SUBST(INCLUDE)
adamc@378 136 AC_SUBST(SITELISP)
adam@1523 137 AC_SUBST(CCARGS)
jgross@1837 138 AC_SUBST(MLTONARGS)
adam@1464 139 AC_SUBST(PGHEADER)
adam@1464 140 AC_SUBST(MSHEADER)
adam@1464 141 AC_SUBST(SQHEADER)
adam@1520 142 AC_SUBST(VERSION)
adam@1528 143 AC_SUBST(PTHREAD_CFLAGS)
adam@1528 144 AC_SUBST(PTHREAD_LIBS)
adamc@378 145
adamc@1132 146 AC_CONFIG_FILES([
adamc@1132 147 Makefile
adamc@1132 148 src/c/Makefile
adamc@1132 149 src/config.sml
adamc@1132 150 ])
adamc@378 151
adamc@378 152 AC_OUTPUT()
adamc@378 153
adamc@378 154 cat <<EOF
adamc@378 155
adamc@378 156 Ur/Web configuration:
adam@1317 157 bin directory: BIN $BIN
adam@1317 158 lib directory: LIB $LIB
ezyang@1739 159 src lib directory: SRCLIB $SRCLIB
adam@1317 160 include directory: INCLUDE $INCLUDE
adam@1317 161 site-lisp directory: SITELISP $SITELISP
adam@1474 162 C compiler: CC $CC
adam@1523 163 Extra CC args: CCARGS $CCARGS
jgross@1837 164 Extra MLTON args: MLTONARGS $MLTONARGS
adam@1464 165 Postgres C header: PGHEADER $PGHEADER
adam@1464 166 MySQL C header: MSHEADER $MSHEADER
adam@1464 167 SQLite C header: SQHEADER $SQHEADER
adam@1661 168 OpenSSL: OPENSSL_LIBS $OPENSSL_LIBS
mad@1825 169 pthreads: PTHREAD_CFLAGS $PTHREAD_CFLAGS
mad@1825 170 PTHREAD_LIBS $PTHREAD_LIBS
adam@1520 171
adam@1520 172 Version: $VERSION
adamc@378 173 EOF