# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT([node], [0.3.0], [ryan@joyent.com]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/node.cc]) AC_CANONICAL_BUILD AC_CANONICAL_TARGET config_file=config.mak.autogen config_append=config.mak.append config_in=config.mak.in echo "# ${config_append}. Generated by configure." > "${config_append}" #dnl Search for pkg-config #AC_PATH_PROG(PKG_CONFIG, pkg-config) # TODO support options # --efence Build with -lefence for debugging [Default: False] # --without-snapshot Build without snapshotting V8 libraries. You might want to set this for cross-compiling. # [Default: False] # --without-ssl Build without SSL # --shared-v8 Link to a shared V8 DLL instead of static linking # --shared-v8-includes=SHARED_V8_INCLUDES # Directory containing V8 header files # --shared-v8-libpath=SHARED_V8_LIBPATH # A directory to search for the shared V8 DLL # --shared-v8-libname=SHARED_V8_LIBNAME # Alternative lib name to link to (default: 'v8') # --shared-cares Link to a shared C-Ares DLL instead of static linking # --shared-cares-includes=SHARED_CARES_INCLUDES # Directory containing C-Ares header files # --shared-cares-libpath=SHARED_CARES_LIBPATH # A directory to search for the shared C-Ares DLL # --shared-libev Link to a shared libev DLL instead of static linking # --shared-libev-includes=SHARED_LIBEV_INCLUDES # Directory containing libev header files # --shared-libev-libpath=SHARED_LIBEV_LIBPATH # A directory to search for the shared libev DLL # ------------------------------------------------------------------------------ # Checks # $arch (only those we support, i.e. lowest common denominator) # Customize by e.g: ./configure --target=i386-apple-darwin AC_MSG_CHECKING([target architecture identifier]) case "$target_cpu" in x64|x86_64|ia64) arch=x64 ;; ia32|i386|i486|i586|i686) arch=ia32 ;; arm|armeb) arch=arm ;; *) AC_MSG_ERROR([Unsupported target architecture: $target_cpu]) ;; esac AC_SUBST(arch,[${arch}]) AC_MSG_RESULT([$arch]) # CFLAGS += -m{32,64} if ( echo "$build_cpu" | egrep -q 'x64|x86_64|ia64' ); then if test "$arch" = "ia32"; then CFLAGS="${CFLAGS} -m32"; fi else if test "$arch" = "x64"; then CFLAGS="${CFLAGS} -m64" ;fi fi # $platform (only those we support, i.e. [[ -d deps/c-ares/${platform}-* ]]) AC_MSG_CHECKING([target platform identifier]) if test "$target_os" = "none"; then target_os="$build_os"; fi case "$target_os" in #android*) platform=android ;; cygwin*) platform=cygwin ;; darwin*) platform=darwin ;; freebsd*) platform=freebsd ;; linux*) platform=linux ;; openbsd*) platform=openbsd ;; *solaris*|sunos*) platform=solaris ;; #win32*) platform=win32 ;; *) AC_MSG_ERROR([Unsupported target platform: $target_os]) ;; esac AC_SUBST(platform,[${platform}]) AC_MSG_RESULT([$platform]) # Darwin cross-compilation target -arch flag if test "$platform" = "darwin"; then CFLAGS="${CFLAGS} -arch ${target_cpu}"; LDFLAGS="${LDFLAGS} -arch ${target_cpu}" fi # Checks for programs. AC_CHECK_PROGS(TAR, [gtar tar]) AC_CHECK_TOOLS(AR, [gar ar], :) AC_PROG_MKDIR_P AC_PROG_LN_S AC_PROG_INSTALL # Checks for header files AC_HEADER_STDC # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_C_CHAR_UNSIGNED AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T # Checks for library functions. AC_FUNC_FORK AC_FUNC_STAT AC_SEARCH_LIBS([dlopen], [dl dld], [], [ AC_MSG_ERROR([Unable to find the dlopen() function]) ]) # TODO FIXME: Check for OpenSSL -- expect it to exist for now AC_SUBST([HAVE_OPENSSL],[1]) # check for -lsocket on solaris AC_CHECK_LIB([c], [socket], [WANT_SOCKET=], [WANT_SOCKET=1]) AC_SUBST(WANT_SOCKET) # ------------------------------------------------------------------------------ # Embedded dependencies m4_include([deps/libev/libev.m4]) m4_include([deps/libeio/libeio.m4]) AC_CONFIG_HEADERS([build/deps/libev/config.h:deps/libev/config.h.in]) AC_CONFIG_HEADERS([build/deps/libeio/config.h:deps/libeio/config.h.in]) AC_CONFIG_FILES(["${config_file}":"${config_in}"]) mkdir -p build/debug/src build/release/src mkdir -p build/debug/deps/libev build/release/deps/libev mkdir -p build/debug/deps/libeio build/release/deps/libeio mkdir -p build/debug/deps/c-ares build/release/deps/c-ares mkdir -p build/debug/deps/http_parser build/release/deps/http_parser mkdir -p build/debug/deps/v8 build/release/deps/v8 mkdir -p build/debug/lib/pkgconfig build/release/lib/pkgconfig # ------------------------------------------------------------------------------ # Output files AC_OUTPUT # ------------------------------------------------------------------------------ # Cleanup rm -f "${config_append}"