| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | dnl   This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  | dnl   it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  | dnl   the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  | dnl   (at your option) any later version. | 
					
						
							|  |  |  | dnl | 
					
						
							|  |  |  | dnl   This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | dnl   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | dnl   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  | dnl   GNU General Public License for more details. | 
					
						
							|  |  |  | dnl | 
					
						
							|  |  |  | dnl   You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  | dnl   along with this program; if not, write to the Free Software | 
					
						
							|  |  |  | dnl   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 
					
						
							|  |  |  | dnl   MA 02110-1301, USA. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | AC_PREREQ([2.59]) | 
					
						
							|  |  |  | AC_INIT([libclamavc++],[devel],[http://bugs.clamav.net]) | 
					
						
							|  |  |  | AC_CONFIG_AUX_DIR([config]) | 
					
						
							|  |  |  | AC_CONFIG_MACRO_DIR([m4]) | 
					
						
							|  |  |  | AC_CONFIG_HEADER([clamavcxx-config.h]) | 
					
						
							|  |  |  | AC_CANONICAL_TARGET | 
					
						
							| 
									
										
										
										
											2013-10-25 10:17:22 -04:00
										 |  |  | AM_INIT_AUTOMAKE([1.9 -Wall -Wportability foreign no-define color-tests tar-pax]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | AM_SILENT_RULES([yes]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-07 16:14:17 +03:00
										 |  |  | cxxset=${CXXFLAGS+set} | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | AC_PROG_CXX | 
					
						
							| 
									
										
										
										
											2010-10-18 11:26:01 +03:00
										 |  |  | AC_C_BIGENDIAN | 
					
						
							| 
									
										
										
										
											2009-09-07 11:54:51 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | if test "$cxxset" != set; then | 
					
						
							|  |  |  | # don't use the default -O2 -g because -g bloats the C++ binaries too much | 
					
						
							|  |  |  |   CXXFLAGS="-O2" | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2010-03-11 23:43:51 +02:00
										 |  |  | case "$target_os" in | 
					
						
							|  |  |  | solaris*) | 
					
						
							| 
									
										
										
										
											2010-03-12 11:45:46 +02:00
										 |  |  |   CXXFLAGS="$CXXFLAGS -include llvm/include/llvm/System/Solaris.h" | 
					
						
							| 
									
										
										
										
											2010-03-11 23:43:51 +02:00
										 |  |  |   AC_MSG_NOTICE([Building on Solaris]) | 
					
						
							|  |  |  |   ;; | 
					
						
							|  |  |  | esac | 
					
						
							| 
									
										
										
										
											2009-09-07 11:54:51 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-22 14:50:41 -04:00
										 |  |  | m4_include([../../m4/reorganization/libs/openssl.m4]) | 
					
						
							|  |  |  | AC_SUBST(SSL_CPPFLAGS, [$SSL_CPPFLAGS]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-07 11:54:51 +03:00
										 |  |  | AM_MAINTAINER_MODE | 
					
						
							|  |  |  | LT_INIT([disable-static]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | if test "$GXX" != "yes"; then | 
					
						
							|  |  |  |     AC_MSG_ERROR([GNU C++ compiler not found, not building LLVM]) | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | AC_CHECK_GNU_MAKE | 
					
						
							|  |  |  | GMAKE="$llvm_cv_gnu_make_command" | 
					
						
							|  |  |  | AC_SUBST([GMAKE]) | 
					
						
							| 
									
										
										
										
											2010-08-04 13:55:30 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-29 11:34:25 -05:00
										 |  |  | m4_include(m4/llvm-flags.m4) | 
					
						
							| 
									
										
										
										
											2014-09-22 13:40:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-04 13:55:30 +03:00
										 |  |  | if test "x$llvmconfig" = "x"; then | 
					
						
							| 
									
										
										
										
											2014-06-04 12:25:10 -04:00
										 |  |  |     dnl macro not available in older autotools | 
					
						
							| 
									
										
										
										
											2010-08-04 13:55:30 +03:00
										 |  |  |     AC_CONFIG_SUBDIRS([llvm]) | 
					
						
							| 
									
										
										
										
											2014-11-06 19:17:02 -05:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2014-06-24 10:49:24 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | AC_SUBST([LLVM_VERSION], [$llvmver_int]) | 
					
						
							| 
									
										
										
										
											2010-08-04 13:55:30 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | AC_ARG_ENABLE([llvm],AC_HELP_STRING([-enable-llvm], | 
					
						
							|  |  |  | 				    [Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]), | 
					
						
							|  |  |  | 				    [enable_llvm=$enableval], [enable_llvm="auto"]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | AC_ARG_ENABLE(optimized, AC_HELP_STRING([-enable-optimized], | 
					
						
							|  |  |  | 	      [Compile with optimizations enabled (default is YES)]), | 
					
						
							|  |  |  | 	      enable_optimized=$enableval, enable_optimized=default) | 
					
						
							| 
									
										
										
										
											2010-06-02 14:42:34 +03:00
										 |  |  | AM_CONDITIONAL(DEBUG_BUILD,[test "x$enable_optimized" = "xno"]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | dnl Set configure args for subdir | 
					
						
							|  |  |  | if test "$enable_optimized" = "default"; then | 
					
						
							|  |  |  |     ac_configure_args="$ac_configure_args --enable-optimized" | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2009-09-07 21:50:50 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | dnl Pretend that GNU make is available for LLVM, we don't use LLVM's buildsystem | 
					
						
							|  |  |  | dnl anyway (except for make check) | 
					
						
							|  |  |  | ac_configure_args="$ac_configure_args llvm_cv_gnu_make_command=make" | 
					
						
							| 
									
										
										
										
											2009-09-07 18:01:43 +03:00
										 |  |  | AC_ARG_ENABLE(all-jit-targets, AC_HELP_STRING([-enable-all-jit-targets], | 
					
						
							|  |  |  | 	      [Build all the targets that support JIT for testing (default NO)]), | 
					
						
							|  |  |  | 	      enable_alltargets=$enableval, enable_alltargets=no) | 
					
						
							|  |  |  | if test "$enable_alltargets" = "yes"; then | 
					
						
							| 
									
										
										
										
											2010-11-06 13:53:31 +02:00
										 |  |  |     new_args="$ac_configure_args --enable-targets=x86,powerpc --enable-bindings=none --enable-libffi=no --without-llvmgcc --without-llvmgxx" | 
					
						
							| 
									
										
										
										
											2009-09-07 18:01:43 +03:00
										 |  |  | else | 
					
						
							|  |  |  |     new_args="$ac_configure_args --enable-targets=host-only --enable-bindings=none --enable-libffi=no --without-llvmgcc --without-llvmgxx" | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2009-09-07 16:14:17 +03:00
										 |  |  | ac_configure_args=`echo $new_args | sed -e 's/-Werror //g'` | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | if test "$enable_llvm" = "auto"; then | 
					
						
							|  |  |  |     dnl Do some sanity checks, and don't automatically build on platforms | 
					
						
							|  |  |  |     dnl that are not supported or have broken compilers. | 
					
						
							|  |  |  |     dnl The user can override this by specifying --enable-llvm=yes. | 
					
						
							| 
									
										
										
										
											2009-12-07 19:10:51 +02:00
										 |  |  |     AC_MSG_CHECKING([for supported C++ compiler version]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  |     gxx_version=`${CXX} -dumpversion` || | 
					
						
							|  |  |  |     AC_MSG_ERROR([Unable to get GNU C++ compiler version]) | 
					
						
							|  |  |  |     case "${gxx_version}" in | 
					
						
							| 
									
										
										
										
											2010-09-28 17:18:08 +03:00
										 |  |  |      [[03]].*) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | 	AC_MSG_ERROR([C++ compiler too old (${gxx_version})]) | 
					
						
							|  |  |  |         ;; | 
					
						
							| 
									
										
										
										
											2010-03-19 19:59:08 +02:00
										 |  |  |      4.1.[[1]]*) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  |         AC_MSG_ERROR([C++ compiler is buggy]) | 
					
						
							|  |  |  |         ;; | 
					
						
							| 
									
										
										
										
											2009-12-07 19:10:51 +02:00
										 |  |  |      *) | 
					
						
							| 
									
										
										
										
											2009-12-07 19:16:07 +02:00
										 |  |  |         AC_MSG_RESULT([ok (${gxx_version})]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  |     esac | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-07 19:10:51 +02:00
										 |  |  |     AC_MSG_CHECKING([for supported OS]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  |     case "$target_cpu" in | 
					
						
							|  |  |  | 	i?86|amd64|x86_64|powerpc*) | 
					
						
							|  |  |  | 	    case "$target_os" in | 
					
						
							| 
									
										
										
										
											2014-06-20 16:17:00 -04:00
										 |  |  | 		darwin*|freebsd*|kfreebsd*|openbsd*|netbsd*|dragonfly*|linux*|solaris*|win32*|mingw*) | 
					
						
							| 
									
										
										
										
											2009-12-07 19:16:07 +02:00
										 |  |  | 		    AC_MSG_RESULT([ok ($target_cpu-$target_os)]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | 		    ;; | 
					
						
							|  |  |  | 		*) | 
					
						
							| 
									
										
										
										
											2009-12-07 19:16:07 +02:00
										 |  |  |                     AC_MSG_ERROR([OS $target_os is not supported, not building LLVM]) | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  |                     ;; | 
					
						
							|  |  |  | 	    esac | 
					
						
							|  |  |  | 	    ;; | 
					
						
							|  |  |  | 	alpha*|arm*) | 
					
						
							|  |  |  | 	    AC_MSG_ERROR([CPU support is untested, not building LLVM]) | 
					
						
							|  |  |  | 	    ;; | 
					
						
							|  |  |  | 	*) | 
					
						
							|  |  |  | 	    AC_MSG_ERROR([Unsupported CPU for JIT: $target_cpu, not building LLVM]) | 
					
						
							|  |  |  | 	    ;; | 
					
						
							|  |  |  |     esac | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-07 10:49:26 +03:00
										 |  |  | dnl bb #1971 - doesn't work with older libstdc++ version at link/runtime | 
					
						
							|  |  |  | AC_MSG_CHECKING([for working libstdc++]) | 
					
						
							|  |  |  | AC_LANG_PUSH([C++]) | 
					
						
							|  |  |  | AC_RUN_IFELSE( | 
					
						
							| 
									
										
										
										
											2011-04-14 12:43:24 +03:00
										 |  |  |     [AC_LANG_SOURCE([ | 
					
						
							| 
									
										
										
										
											2010-05-07 10:49:26 +03:00
										 |  |  | 	#include <iostream> | 
					
						
							|  |  |  | 	int main() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 	    // this causes an @GLIBCXX_3.4.9 symbol to be linked in -O2 mode | 
					
						
							|  |  |  | 	    std::cout << "test"; | 
					
						
							|  |  |  | 	    return 0; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-04-14 12:43:24 +03:00
										 |  |  |     ])],[AC_MSG_RESULT([yes])], | 
					
						
							| 
									
										
										
										
											2010-05-07 10:49:26 +03:00
										 |  |  |     [AC_MSG_FAILURE([failed])], | 
					
						
							|  |  |  | [AC_LINK_IFELSE( | 
					
						
							| 
									
										
										
										
											2011-04-14 12:43:24 +03:00
										 |  |  |     [AC_LANG_SOURCE([ | 
					
						
							| 
									
										
										
										
											2010-05-07 10:49:26 +03:00
										 |  |  | 	#include <iostream> | 
					
						
							|  |  |  | 	int main() | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 	    // this causes an @GLIBCXX_3.4.9 symbol to be linked in -O2 mode | 
					
						
							|  |  |  | 	    std::cout << "test"; | 
					
						
							|  |  |  | 	    return 0; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-04-14 12:43:24 +03:00
										 |  |  |     ])], [AC_MSG_RESULT([yes])], | 
					
						
							| 
									
										
										
										
											2010-05-07 10:49:26 +03:00
										 |  |  |     [AC_MSG_FAILURE([failed])] | 
					
						
							|  |  |  | )]) | 
					
						
							|  |  |  | AC_LANG_POP([C++]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-07 18:01:43 +03:00
										 |  |  | build_x86=no | 
					
						
							|  |  |  | build_ppc=no | 
					
						
							|  |  |  | case "$target_cpu" in | 
					
						
							|  |  |  |     i?86|amd64|x86_64) | 
					
						
							|  |  |  | 	    build_x86=yes | 
					
						
							|  |  |  | 	    ;; | 
					
						
							|  |  |  |     powerpc*) | 
					
						
							|  |  |  | 	    build_ppc=yes | 
					
						
							|  |  |  | 	    ;; | 
					
						
							|  |  |  | esac | 
					
						
							| 
									
										
										
										
											2010-03-04 20:14:22 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | # FreeBSD is only one which needs something else than -pthread, | 
					
						
							|  |  |  | # according to the logic in ClamAV's main configure.in. | 
					
						
							|  |  |  | case "$target_os" in | 
					
						
							|  |  |  | freebsd[[45]]*) | 
					
						
							|  |  |  |     THREAD_LIBS="-pthread -lc_r" | 
					
						
							|  |  |  |     ;; | 
					
						
							|  |  |  | freebsd*) | 
					
						
							|  |  |  |     THREAD_LIBS="-lthr" | 
					
						
							|  |  |  |     ;; | 
					
						
							| 
									
										
										
										
											2010-04-29 09:48:57 +03:00
										 |  |  | darwin*) | 
					
						
							|  |  |  |     # none required | 
					
						
							|  |  |  |     THREAD_LIBS= | 
					
						
							|  |  |  |     ;; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-04 20:14:22 +02:00
										 |  |  | *) | 
					
						
							|  |  |  |     THREAD_LIBS="-pthread" | 
					
						
							|  |  |  | esac | 
					
						
							|  |  |  | AC_SUBST([THREAD_LIBS]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-07 18:01:43 +03:00
										 |  |  | if test "$enable_alltargets" = "yes"; then | 
					
						
							|  |  |  | 	build_x86=yes | 
					
						
							|  |  |  | 	build_ppc=yes | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2010-10-18 11:26:01 +03:00
										 |  |  | if test "$ac_cv_c_bigendian" = "universal"; then | 
					
						
							| 
									
										
										
										
											2010-10-19 16:17:00 +03:00
										 |  |  |     AC_MSG_NOTICE([Universal build detected]) | 
					
						
							|  |  |  |     build_x86=yes | 
					
						
							|  |  |  |     build_ppc=yes | 
					
						
							| 
									
										
										
										
											2010-10-18 11:26:01 +03:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2010-10-19 16:17:00 +03:00
										 |  |  | AC_MSG_NOTICE([Building X86 backend: $build_x86]) | 
					
						
							|  |  |  | AC_MSG_NOTICE([Building PPC backend: $build_ppc]) | 
					
						
							| 
									
										
										
										
											2009-09-07 18:01:43 +03:00
										 |  |  | AM_CONDITIONAL(BUILD_X86, [test "$build_x86" = "yes"]) | 
					
						
							|  |  |  | AM_CONDITIONAL(BUILD_PPC, [test "$build_ppc" = "yes"]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-13 16:17:19 +03:00
										 |  |  | AC_MSG_CHECKING([optional compiler flags]) | 
					
						
							|  |  |  | CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros]) | 
					
						
							|  |  |  | CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers]) | 
					
						
							|  |  |  | AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-04 13:55:30 +03:00
										 |  |  | AM_CONDITIONAL(BUILD_EXTERNAL_LLVM, [test -n "$llvmconfig"]) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-31 15:49:41 +03:00
										 |  |  | AC_OUTPUT([ | 
					
						
							|  |  |  |     Makefile | 
					
						
							|  |  |  | ]) |