dnl /**************************************************************************/ dnl /* */ dnl /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ dnl /* Copyright (c) 2008-2014 Oleksandr Shneyder */ dnl /* Copyright (c) 2014-2016 Ulrich Sibiller */ dnl /* Copyright (c) 2014-2016 Mihai Moldovan */ dnl /* Copyright (c) 2011-2016 Mike Gabriel */ dnl /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ dnl /* */ dnl /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ dnl /* are copyright of the aforementioned persons and companies. */ dnl /* */ dnl /* Redistribution and use of the present software is allowed according */ dnl /* to terms specified in the file LICENSE which comes in the source */ dnl /* distribution. */ dnl /* */ dnl /* All rights reserved. */ dnl /* */ dnl /* NOTE: This software has received contributions from various other */ dnl /* contributors, only the core maintainers and supporters are listed as */ dnl /* copyright holders. Please contact us, if you feel you should be listed */ dnl /* as copyright holder, as well. */ dnl /* */ dnl /**************************************************************************/ dnl Process this file with autoconf to produce a configure script. dnl Prolog AC_INIT(Shadow.h) AC_PREREQ(2.13) pkgconfigdir=${libdir}/pkgconfig AC_SUBST(pkgconfigdir) dnl Reset default compilation flags. if test "x$CXXFLAGS" == "x"; then CXXFLAGS="-O3" fi if test "x$CPPFLAGS" == "x"; then CPPFLAGS="-O3" fi dnl Reset default linking directives. LIBSTATIC="" LIBSHARED="" dnl Prefer headers and libraries from nx-X11, if present. if test -d "../nx-X11/exports/include" ; then CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include" LIBS="-L../nx-X11/exports/lib" fi dnl Check whether --with-ipaq was given. if test "${with_ipaq}" = yes; then echo -e "enabling IPAQ configuration" CXX="arm-linux-c++" CC="arm-linux-gcc" unset ac_cv_prog_armcxx unset ac_cv_prog_armcc unset ac_cv_prog_CXXCPP AC_CHECK_PROG([armcxx],["$CXX"],[yes],[no],[$PATH]) AC_CHECK_PROG([armcc],["$CC"],[yes],[no],[$PATH]) if test $armcxx = "yes" && test $armcc = "yes" ; then ac_cv_prog_CXX="$CXX" ac_cv_prog_CC="$CC" else AC_MSG_ERROR(installation or configuration problem: I cannot find compiler for arm-linux) fi else unset ac_cv_prog_CXX unset ac_cv_prog_CC unset ac_cv_prog_CXXCPP fi dnl Check for programs. AC_PROG_CXX AC_PROG_CC AC_LANG_CPLUSPLUS dnl Check whether option -Wno-deprecated dnl is needed by GCC compiler. AC_MSG_CHECKING([whether compiler needs -Wno-deprecated]) gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1` case "${gcc_version}" in gcc*) AC_MSG_RESULT([yes]) CXXFLAGS="$CXXFLAGS -Wno-deprecated" CPPFLAGS="$CPPFLAGS -Wno-deprecated" ;; *) AC_MSG_RESULT([no]) ;; esac AC_MSG_CHECKING([whether compiler accepts -Wmissing-declarations and -Wnested-externs]) gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1` case "${gcc_version}" in gcc*) AC_MSG_RESULT([no]) ;; *) AC_MSG_RESULT([yes]) CXXFLAGS="$CXXFLAGS -Wmissing-declarations" CPPFLAGS="$CPPFLAGS -Wmissing-declarations" ;; esac dnl Check for BSD compatible install. AC_PROG_INSTALL dnl Check for extra header files. AC_PATH_XTRA dnl Custom addition. ac_help="$ac_help --with-symbols give -g flag to compiler to produce debug symbols --with-info define INFO at compile time to get basic log output --with-valgrind clean up allocated buffers to avoid valgrind warnings --with-version use this version for produced libraries --with-static-jpeg enable static linking of JPEG library --with-static-z enable static linking of Z library" dnl Check to see if we're running under Cygwin32. AC_DEFUN(nxconf_CYGWIN32, [AC_CACHE_CHECK(for Cygwin32 environment, nxconf_cv_cygwin32, [AC_TRY_COMPILE(,[return __CYGWIN32__;], nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) rm -f conftest*]) CYGWIN32= test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes]) nxconf_CYGWIN32 dnl Cygwin32 requires the stdc++ library explicitly linked. if test "$CYGWIN32" = yes; then LIBS="$LIBS -lstdc++ -lcygipc -lgdi32" fi dnl Check for Darwin environment. AC_DEFUN(nxconf_DARWIN, [AC_CACHE_CHECK(for Darwin environment, nxconf_cv_darwin, [AC_TRY_COMPILE(,[return __APPLE__;], nxconf_cv_darwin=yes, nxconf_cv_darwin=no) rm -f conftest*]) DARWIN= test "$nxconf_cv_darwin" = yes && DARWIN=yes]) nxconf_DARWIN dnl Check to see if we're running under Solaris. AC_DEFUN(nxconf_SUN, [AC_CACHE_CHECK(for Solaris environment, nxconf_cv_sun, [AC_TRY_COMPILE(,[return __sun;], nxconf_cv_sun=yes, nxconf_cv_sun=no) rm -f conftest*]) SUN= test "$nxconf_cv_sun" = yes && SUN=yes]) nxconf_SUN dnl Check to see if we're running under FreeBSD. AC_DEFUN(nxconf_FreeBSD, [AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd, [AC_TRY_COMPILE(,[return __FreeBSD__;], nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) rm -f conftest*]) FreeBSD= test "$nxconf_cv_freebsd" = yes && FreeBSD=yes]) nxconf_FreeBSD dnl Build PIC libraries. if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then CXXFLAGS="$CXXFLAGS -fPIC" CFLAGS="$CFLAGS -fPIC" fi dnl Solaris requires the socket and gcc_s libs explicitly linked. dnl Note also that headers from default /usr/openwin/include/X11 dnl cause a warning due to pragma in Xmd.h. if test "$SUN" = yes; then LIBS="$LIBS -L/usr/sfw/lib -lsocket " CXXFLAGS="$CXXFLAGS -I/usr/sfw/include" fi dnl On FreeBSD search libraries and includes under /usr/local. if test "$FreeBSD" = yes; then LIBS="$LIBS -L/usr/local/lib" CXXFLAGS="$CXXFLAGS -I/usr/local/include" fi dnl Under Darwin we don't have support for -soname option and dnl we need the -dynamiclib flag. Under Solaris, instead, we need dnl the options -G -h. if test "$DARWIN" = yes; then LDFLAGS="$LDFLAGS -dynamiclib" elif test "$SUN" = yes; then LDFLAGS="$LDFLAGS -G -h \$(LIBLOAD)" else LDFLAGS="$LDFLAGS -Wl,-soname,\$(LIBLOAD)" fi dnl Check to see if in_addr_t is defined. dnl Could use a specific configure test. AC_DEFUN(nxconf_INADDRT, [AC_CACHE_CHECK(for in_addr_t, nxconf_cv_inaddrt, [AC_TRY_COMPILE([#include ],[in_addr_t t; t = 1; return t;], nxconf_cv_inaddrt=yes, nxconf_cv_inaddrt=no) rm -f conftest*]) INADDRT= test "$nxconf_cv_inaddrt" = yes && INADDRT=yes]) nxconf_INADDRT dnl If in_addr_t is not defined use unsigned int. if test "$INADDRT" != yes ; then echo -e "using unsigned int for type in_addr_t" CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=unsigned" CPPFLAGS="$CPPFLAGS -DIN_ADDR_T=unsigned" else CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=in_addr_t" CPPFLAGS="$CPPFLAGS -DIN_ADDR_T=in_addr_t" fi dnl Check whether --with-version was given. AC_SUBST(LIBVERSION) AC_SUBST(VERSION) if test "${with_version}" = yes; then VERSION=${ac_option} else VERSION=`cat VERSION` fi echo -e "compiling version ${VERSION}" LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1` CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\"" CPPFLAGS="$CPPFLAGS -DVERSION=\\\"${VERSION}\\\"" dnl Finally compose the LIB variable. if test "$DARWIN" = yes ; then LIBS="$LIBS $LIBSTATIC $LIBSHARED" elif test "$SUN" = yes ; then LIBS="$LIBS $LIBSTATIC $LIBSHARED" else LIBS="$LIBS $LIBSTATIC -shared $LIBSHARED" fi dnl Check whether --with-symbols or --without-symbols was dnl given and set the required optimization level. if test "${with_symbols}" = yes; then echo -e "enabling production of debug symbols" CXXFLAGS="-g $CXXFLAGS" CPPFLAGS="-g $CPPFLAGS" else echo -e "disabling production of debug symbols" fi dnl Check whether --with-info or --without-info was given. if test "${with_info}" = yes; then echo -e "enabling info output in the log file" CXXFLAGS="$CXXFLAGS -DINFO" CPPFLAGS="$CPPFLAGS -DINFO" else echo -e "disabling info output in the log file" fi dnl Check whether --with-valgrind or --without-valgrind was given. if test "${with_valgrind}" = yes; then echo -e "enabling valgrind memory checker workarounds" CXXFLAGS="$CXXFLAGS -DVALGRIND" CPPFLAGS="$CPPFLAGS -DVALGRIND" else echo -e "disabling valgrind memory checker workarounds" fi dnl Find makedepend somewhere. AC_SUBST(MAKEDEPEND) MAKEDEPEND="$(which makedepend)" AC_OUTPUT(Makefile nxcompshad.pc)