1AC_INIT(asio, [1.11.0]) 2AC_CONFIG_SRCDIR(include/asio.hpp) 3AM_MAINTAINER_MODE 4AM_INIT_AUTOMAKE([tar-ustar]) 5 6AC_CANONICAL_HOST 7AM_PROG_CC_C_O 8AC_PROG_CXX 9AC_LANG(C++) 10AC_PROG_RANLIB 11 12AC_DEFINE(_REENTRANT, [1], [Define this]) 13 14AC_ARG_WITH(boost, 15 AC_HELP_STRING([--with-boost=DIR],[location of boost distribution]), 16[ 17 if test "${withval}" = no; then 18 STANDALONE="yes" 19 else 20 CPPFLAGS="$CPPFLAGS -I${withval} -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING" 21 LIBS="$LIBS -L${withval}/stage/lib" 22 fi 23], 24[ 25 BOOSTDIR=`ls -1d ../boost_*_*_*/ 2>/dev/null | sort -t "_" -k 2nr -k 3nr -k 4nr | head -n 1 | sed -e 's/\/$//'` 26 if test "${BOOSTDIR}" != ""; then 27 BOOSTDIR="`pwd`/${BOOSTDIR}" 28 if test -d "${BOOSTDIR}"; then 29 echo "using automatically detected boost from ${BOOSTDIR}" 30 CPPFLAGS="$CPPFLAGS -I${BOOSTDIR} -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING" 31 LIBS="$LIBS -L${BOOSTDIR}/stage/lib" 32 fi 33 fi 34]) 35 36AC_ARG_ENABLE(separate-compilation, 37[ --enable-separate-compilation separate compilation of asio source], 38[ 39 SEPARATE_COMPILATION=yes 40]) 41 42AC_ARG_ENABLE(boost-coroutine, 43[ --enable-boost-coroutine use Boost.Coroutine to implement stackful coroutines], 44[ 45 HAVE_BOOST_COROUTINE=yes 46]) 47 48if test "$STANDALONE" != yes; then 49 AC_CHECK_HEADER([boost/noncopyable.hpp],, 50 [ 51 echo "Can't find boost headers. Please check the location of the boost" 52 echo "distribution and rerun configure using the --with-boost=DIR option." 53 exit 1 54 ],[]) 55fi 56 57AC_ARG_WITH(openssl, 58 AC_HELP_STRING([--with-openssl=DIR],[location of openssl]), 59[ 60 CPPFLAGS="$CPPFLAGS -I${withval}/include" 61 LIBS="$LIBS -L${withval}/lib" 62],[]) 63 64AC_CHECK_HEADER([openssl/ssl.h],, 65[ 66 OPENSSL_FOUND=no 67],[]) 68 69if test x$OPENSSL_FOUND != xno; then 70 LIBS="$LIBS -lssl -lcrypto" 71fi 72 73AM_CONDITIONAL(HAVE_OPENSSL,test x$OPENSSL_FOUND != xno) 74 75WINDOWS=no 76case $host in 77 *-*-linux*) 78 CXXFLAGS="$CXXFLAGS -pthread" 79 LDFLAGS="$LDFLAGS -pthread" 80 LIBS="$LIBS -lrt" 81 ;; 82 *-*-solaris*) 83 if test "$GXX" = yes; then 84 CXXFLAGS="$CXXFLAGS -D_PTHREADS" 85 else 86 # We'll assume Sun's CC. 87 CXXFLAGS="$CXXFLAGS -mt" 88 fi 89 LIBS="$LIBS -lsocket -lnsl -lpthread" 90 ;; 91 *-*-mingw32*) 92 CXXFLAGS="$CXXFLAGS -mthreads" 93 LDFLAGS="$LDFLAGS -mthreads" 94 LIBS="$LIBS -lws2_32 -lmswsock" 95 WINDOWS=yes 96 ;; 97 *-*-mingw64*) 98 CXXFLAGS="$CXXFLAGS -mthreads" 99 LDFLAGS="$LDFLAGS -mthreads" 100 LIBS="$LIBS -lws2_32 -lmswsock" 101 WINDOWS=yes 102 ;; 103 *-pc-cygwin*) 104 CXXFLAGS="$CXXFLAGS -D__USE_W32_SOCKETS -D_WIN32_WINNT=0x0501" 105 LIBS="$LIBS -lws2_32 -lmswsock" 106 WINDOWS=yes 107 ;; 108 *-apple-darwin*) 109 CXXFLAGS="$CXXFLAGS" 110 LDFLAGS="$LDFLAGS" 111 ;; 112 *-*-freebsd*) 113 CXXFLAGS="$CXXFLAGS -pthread" 114 LDFLAGS="$LDFLAGS -pthread" 115 ;; 116 *-*-netbsd*) 117 CXXFLAGS="$CXXFLAGS -pthread" 118 LDFLAGS="$LDFLAGS -pthread" 119 ;; 120esac 121 122if test "$GXX" = yes; then 123 CXXFLAGS="$CXXFLAGS -ftemplate-depth-256" 124 if test "$STANDALONE" = yes; then 125 CPPFLAGS="-std=c++0x $CPPFLAGS" 126 fi 127fi 128 129if test "$STANDALONE" = yes; then 130 CPPFLAGS="$CPPFLAGS -DASIO_STANDALONE" 131fi 132 133if test "$SEPARATE_COMPILATION" = yes; then 134 CPPFLAGS="$CPPFLAGS -DASIO_SEPARATE_COMPILATION" 135fi 136 137AM_CONDITIONAL(STANDALONE,test x$STANDALONE = xyes) 138 139AM_CONDITIONAL(SEPARATE_COMPILATION,test x$SEPARATE_COMPILATION = xyes) 140 141AM_CONDITIONAL(HAVE_BOOST_COROUTINE,test x$HAVE_BOOST_COROUTINE = xyes) 142 143AM_CONDITIONAL(WINDOWS_TARGET,test x$WINDOWS != xno) 144 145AC_OUTPUT([ 146 Makefile 147 include/Makefile 148 src/Makefile 149 src/tests/Makefile 150 src/examples/cpp03/Makefile 151 src/examples/cpp11/Makefile 152 src/examples/cpp14/Makefile]) 153