## # @file configure.ac # @brief an input file for autoconf tool # # (c) 2013-2015 by Mega Limited, Auckland, New Zealand # # This file is part of the MEGA SDK - Client Access Engine. # # Applications using the MEGA API must present a valid application key # and comply with the the rules set forth in the Terms of Service. # # The MEGA SDK is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # @copyright Simplified (2-clause) BSD License. # # You should have received a copy of the license along with this # program. ## # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. m4_include([m4/ax_prog_doxygen.m4]) m4_include([m4/curlchk.m4]) m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_check_link_flag.m4]) m4_include([m4/ax_cxx_compile_stdcxx.m4]) AC_PREREQ([2.61]) # The Mega SDK version number is generated into config.h. # The version in Git should reflect the *next* version planned. m4_define([mega_major_version], [$(cat include/mega/version.h | grep "define MEGA_MAJOR" | cut -d" " -f 3)]) m4_define([mega_minor_version], [$(cat include/mega/version.h | grep "define MEGA_MINOR" | cut -d" " -f 3)]) m4_define([mega_micro_version], [$(cat include/mega/version.h | grep "define MEGA_MICRO" | cut -d" " -f 3)]) m4_define([mega_version], [mega_major_version.mega_minor_version.mega_micro_version]) # libtool interface versioning m4_define([mega_lt_revision], [0]) m4_define([mega_lt_current], [$(grep define = '3.0.0') else AM_PATH_PYTHON AX_PYTHON_DEVEL fi AX_PKG_SWIG(2.0.0, [], [ AC_MSG_ERROR([SWIG executable not found!]) ]) AX_SWIG_ENABLE_CXX AX_SWIG_MULTI_MODULE_SUPPORT AX_SWIG_PYTHON if test -z "$SWIG"; then AC_MSG_ERROR([SWIG executable not found!]) fi if test -z "$PYTHON_VERSION"; then AC_MSG_ERROR([Python development files not found!]) fi fi AM_CONDITIONAL([BUILD_PYTHON], [test "$enable_python" = "yes"]) # PHP AC_MSG_CHECKING([if building PHP bindings]) AC_ARG_ENABLE(php, AS_HELP_STRING([--enable-php], [build PHP language bindings]), [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) enable_php=no] ) if test "x$enable_php" = "xyes" ; then AC_CHECK_PROGS(PHPCONFIG, php-config php5-config php-config5 php4-config php-config4) AC_MSG_CHECKING(for PHP header files) PHPINC="`$PHPCONFIG --includes 2>/dev/null`" if test "$PHPINC"; then AC_MSG_RESULT($PHPINC) else dirs="/usr/include/php /usr/local/include/php /usr/include/php5 /usr/local/include/php5 /usr/include/php4 /usr/local/include/php4 /usr/local/apache/php" for i in $dirs; do if test -r $i/main/php_config.h -o -r $i/main/php_version.h; then AC_MSG_RESULT($i is found) PHPEXT="$i" PHPINC="-I$PHPEXT -I$PHPEXT/main -I$PHPEXT/TSRM -I$PHPEXT/Zend" break; fi done fi if test -z "$PHPINC"; then AC_MSG_ERROR([PHP headers not found!]) fi AC_MSG_CHECKING(for PHP extension-dir) PHPLIBDIR="`$PHPCONFIG --extension-dir 2>/dev/null | sed "s#/lib/#/lib${LIBPOSTFIX}/#g"`" if test ! -z "$PHPLIBDIR"; then AC_MSG_RESULT($PHPLIBDIR) else AC_MSG_ERROR([PHP development files not found!]) fi AC_SUBST(PHPINC) AC_SUBST(PHPEXT) AC_SUBST(PHPLIBDIR) m4_define([php_version], [$(php-config --version | cut -d '.' -f 1)]) if test "x"php_version = "x7" ; then AX_PKG_SWIG(3.0.11, [SWIG_FLAGS_PHP='-php7'], AC_MSG_ERROR([PHP 7 requires SWIG >=3.0.11])) else SWIG_FLAGS_PHP='-php' fi #do AX_PKG_SWIG again to have $SWIG correctly defined, no only for >=3.0.11 AX_PKG_SWIG(2.0.0, [], [ AC_MSG_ERROR([SWIG executable not found!]) ]) AX_SWIG_ENABLE_CXX AX_SWIG_MULTI_MODULE_SUPPORT if test -z "$SWIG"; then AC_MSG_ERROR([SWIG executable not found!]) fi AC_SUBST([SWIG_FLAGS_PHP]) fi AM_CONDITIONAL([BUILD_PHP], [test "$enable_php" = "yes"]) AC_CHECK_LIB([stdc++fs], [main], [LDFLAGS="-lstdc++fs $LDFLAGS"], [] ) dnl ######################################################################### dnl Doxygen settings dnl ######################################################################### DX_INIT_DOXYGEN($PACKAGE_NAME, doc/Doxyfile, doc/api) DX_DOXYGEN_FEATURE(ON) DX_DOT_FEATURE(ON) DX_HTML_FEATURE(ON) DX_CHM_FEATURE(OFF) DX_CHI_FEATURE(OFF) DX_MAN_FEATURE(OFF) DX_RTF_FEATURE(OFF) DX_XML_FEATURE(OFF) DX_PDF_FEATURE(OFF) DX_PS_FEATURE(OFF) # Output AC_CONFIG_FILES([ Makefile include/Makefile libmega.pc doc/Doxyfile ]) AC_OUTPUT AC_MSG_NOTICE([Configured to build Mega SDK: SDK version: mega_version Host setup: ${host} Install prefix: $prefix Compiler: $CXX CXXFLAGS: $CXXFLAGS LDFLAGS: $LDFLAGS gcc hardening: $enable_gcc_hardening debug: $enable_debug static: $enable_static sync subsystem: $enable_sync chat: $enable_chat MEGA API $enable_megaapi MEGA API RPC $enable_megaapirpc example apps: $enable_examples Perf Logger: $enable_log_performance Drive Notif: $enable_drive_notifications MEGA_USE_C_ARES: $enable_mega_c_ares inotify: $enable_inotify posix threads: $enable_posix_threads Python bindings: $enable_python Python3 bindings: $USE_PYTHON3 PHP bindings: $enable_php SWIG_FLAGS_PHP: $SWIG_FLAGS_PHP Java bindings: $enable_java OpenSSL: $LIBSSL_FLAGS $LIBSSL_LDFLAGS $LIBSSL_LIBS Crypto++: $CRYPTO_CXXFLAGS $CRYPTO_LDFLAGS $CRYPTO_LIBS Sodium: $SODIUM_CXXFLAGS $SODIUM_LDFLAGS $SODIUM_LIBS Zlib: $ZLIB_CXXFLAGS $ZLIB_LDFLAGS $ZLIB_LIBS SQLite3: $DB_CXXFLAGS $DB_LDFLAGS $DB_LIBS c-ares: $CARES_FLAGS $CARES_LDFLAGS $CARES_LIBS cURL: $LIBCURL_FLAGS $LIBCURL_LIBS FreeImage: $FI_CXXFLAGS $FI_LDFLAGS $FI_LIBS PDFium: $PDF_CXXFLAGS $PDF_LDFLAGS $PDF_LIBS ICU: $ICU_CXXFLAGS $ICU_LDFLAGS $ICU_LIBS $ICU_MSG Readline: $RL_CXXFLAGS $RL_LDFLAGS $RL_LIBS Termcap: $TERMCAP_CXXFLAGS $TERMCAP_LDFLAGS $TERMCAP_LIBS PCRE: $PCRE_CXXFLAGS $PCRE_LDFLAGS $PCRE_LIBS LIBUV: $LIBUV_CXXFLAGS $LIBUV_LDFLAGS $LIBUV_LIBS LIBRAW: $LIBRAW_CXXFLAGS $LIBRAW_LDFLAGS $LIBRAW_LIBS LIBMEDIAINFO: $LIBMEDIAINFO_CXXFLAGS $LIBMEDIAINFO_LDFLAGS $LIBMEDIAINFO_LIBS FFMPEG: $FFMPEG_CXXFLAGS $FFMPEG_LDFLAGS $FFMPEG_LIBS ])