~ubuntu-branches/ubuntu/feisty/clamav/feisty

« back to all changes in this revision

Viewing changes to libclamav/c++/configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-02-20 10:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20070220103344-zgcu2psnx9d98fpa
Tags: upstream-0.90
ImportĀ upstreamĀ versionĀ 0.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl   This program is free software; you can redistribute it and/or modify
2
 
dnl   it under the terms of the GNU General Public License as published by
3
 
dnl   the Free Software Foundation; either version 2 of the License, or
4
 
dnl   (at your option) any later version.
5
 
dnl
6
 
dnl   This program is distributed in the hope that it will be useful,
7
 
dnl   but WITHOUT ANY WARRANTY; without even the implied warranty of
8
 
dnl   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9
 
dnl   GNU General Public License for more details.
10
 
dnl
11
 
dnl   You should have received a copy of the GNU General Public License
12
 
dnl   along with this program; if not, write to the Free Software
13
 
dnl   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
14
 
dnl   MA 02110-1301, USA.
15
 
 
16
 
AC_PREREQ([2.59])
17
 
AC_INIT([libclamavc++],[devel],[http://bugs.clamav.net])
18
 
AC_CONFIG_AUX_DIR([config])
19
 
AC_CONFIG_SRCDIR([llvm/configure])
20
 
AC_CONFIG_MACRO_DIR([m4])
21
 
AC_CONFIG_HEADER([clamavcxx-config.h])
22
 
AC_CANONICAL_TARGET
23
 
AM_INIT_AUTOMAKE([1.9 -Wall -Wportability -Werror foreign no-define color-tests tar-pax])
24
 
AM_SILENT_RULES([yes])
25
 
 
26
 
cxxset=${CXXFLAGS+set}
27
 
AC_PROG_CXX
28
 
AC_C_BIGENDIAN
29
 
 
30
 
if test "$cxxset" != set; then
31
 
# don't use the default -O2 -g because -g bloats the C++ binaries too much
32
 
  CXXFLAGS="-O2"
33
 
fi
34
 
case "$target_os" in
35
 
solaris*)
36
 
  CXXFLAGS="$CXXFLAGS -include llvm/include/llvm/System/Solaris.h"
37
 
  AC_MSG_NOTICE([Building on Solaris])
38
 
  ;;
39
 
esac
40
 
 
41
 
AM_MAINTAINER_MODE
42
 
LT_INIT([disable-static])
43
 
if test "$GXX" != "yes"; then
44
 
    AC_MSG_ERROR([GNU C++ compiler not found, not building LLVM])
45
 
fi
46
 
 
47
 
AC_CHECK_GNU_MAKE
48
 
GMAKE="$llvm_cv_gnu_make_command"
49
 
AC_SUBST([GMAKE])
50
 
 
51
 
llvmconfig=
52
 
AC_ARG_WITH([system-llvm], AC_HELP_STRING([-with-system-llvm],
53
 
[Use system llvm instead of built-in, requires full path to llvm-config]),
54
 
[case "$withval" in
55
 
  yes)
56
 
    AC_MSG_ERROR([--with-system-llvm needs full path to llvm-config])
57
 
    ;;
58
 
  no) ;;
59
 
  *)
60
 
    llvmconfig="$withval"
61
 
    llvmver=`$llvmconfig --version`
62
 
    if test "$llvmver" != "2.8" -a "$llvmver" != "2.8svn" -a "$llvmver" != "2.8rc"; then
63
 
        AC_MSG_ERROR([LLVM 2.8 or 2.8svn required, but "$llvmver" found])
64
 
    fi
65
 
    AC_SUBST(LLVMCONFIG_CXXFLAGS, [`$llvmconfig --cxxflags`])
66
 
    AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`])
67
 
    AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs jit nativecodegen scalaropts ipo`])
68
 
    AC_SUBST(LLVMCONFIG_LIBFILES, [`$llvmconfig --libfiles jit nativecodegen scalaropts ipo`])
69
 
    AC_MSG_NOTICE([Using external LLVM])
70
 
    AC_MSG_NOTICE([CXXFLAGS from llvm-config: $LLVMCONFIG_CXXFLAGS])
71
 
    AC_MSG_NOTICE([LDFLAGS from llvm-config: $LLVMCONFIG_LDFLAGS])
72
 
    AC_MSG_NOTICE([LIBS from llvm-config: $LLVMCONFIG_LIBS])
73
 
    ;;
74
 
  esac
75
 
])
76
 
 
77
 
if test "x$llvmconfig" = "x"; then
78
 
    AC_CONFIG_SUBDIRS([llvm])
79
 
fi
80
 
 
81
 
AC_ARG_ENABLE([llvm],AC_HELP_STRING([-enable-llvm],
82
 
                                    [Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]),
83
 
                                    [enable_llvm=$enableval], [enable_llvm="auto"])
84
 
 
85
 
AC_ARG_ENABLE(optimized, AC_HELP_STRING([-enable-optimized],
86
 
              [Compile with optimizations enabled (default is YES)]),
87
 
              enable_optimized=$enableval, enable_optimized=default)
88
 
AM_CONDITIONAL(DEBUG_BUILD,[test "x$enable_optimized" = "xno"])
89
 
 
90
 
dnl Set configure args for subdir
91
 
if test "$enable_optimized" = "default"; then
92
 
    ac_configure_args="$ac_configure_args --enable-optimized"
93
 
fi
94
 
 
95
 
dnl Pretend that GNU make is available for LLVM, we don't use LLVM's buildsystem
96
 
dnl anyway (except for make check)
97
 
ac_configure_args="$ac_configure_args llvm_cv_gnu_make_command=make"
98
 
AC_ARG_ENABLE(all-jit-targets, AC_HELP_STRING([-enable-all-jit-targets],
99
 
              [Build all the targets that support JIT for testing (default NO)]),
100
 
              enable_alltargets=$enableval, enable_alltargets=no)
101
 
if test "$enable_alltargets" = "yes"; then
102
 
    new_args="$ac_configure_args --enable-targets=x86,powerpc --enable-bindings=none --enable-libffi=no --without-llvmgcc --without-llvmgxx"
103
 
else
104
 
    new_args="$ac_configure_args --enable-targets=host-only --enable-bindings=none --enable-libffi=no --without-llvmgcc --without-llvmgxx"
105
 
fi
106
 
ac_configure_args=`echo $new_args | sed -e 's/-Werror //g'`
107
 
 
108
 
if test "$enable_llvm" = "auto"; then
109
 
    dnl Do some sanity checks, and don't automatically build on platforms
110
 
    dnl that are not supported or have broken compilers.
111
 
    dnl The user can override this by specifying --enable-llvm=yes.
112
 
    AC_MSG_CHECKING([for supported C++ compiler version])
113
 
    gxx_version=`${CXX} -dumpversion` ||
114
 
    AC_MSG_ERROR([Unable to get GNU C++ compiler version])
115
 
    case "${gxx_version}" in
116
 
     [[03]].*)
117
 
        AC_MSG_ERROR([C++ compiler too old (${gxx_version})])
118
 
        ;;
119
 
     4.1.[[1]]*)
120
 
        AC_MSG_ERROR([C++ compiler is buggy])
121
 
        ;;
122
 
     *)
123
 
        AC_MSG_RESULT([ok (${gxx_version})])
124
 
    esac
125
 
 
126
 
    AC_MSG_CHECKING([for supported OS])
127
 
    case "$target_cpu" in
128
 
        i?86|amd64|x86_64|powerpc*)
129
 
            case "$target_os" in
130
 
                darwin*|freebsd*|openbsd*|netbsd*|dragonfly*|linux*|solaris*|win32*|mingw*)
131
 
                    AC_MSG_RESULT([ok ($target_cpu-$target_os)])
132
 
                    ;;
133
 
                *)
134
 
                    AC_MSG_ERROR([OS $target_os is not supported, not building LLVM])
135
 
                    ;;
136
 
            esac
137
 
            ;;
138
 
        alpha*|arm*)
139
 
            AC_MSG_ERROR([CPU support is untested, not building LLVM])
140
 
            ;;
141
 
        *)
142
 
            AC_MSG_ERROR([Unsupported CPU for JIT: $target_cpu, not building LLVM])
143
 
            ;;
144
 
    esac
145
 
fi
146
 
 
147
 
dnl bb #1971 - doesn't work with older libstdc++ version at link/runtime
148
 
AC_MSG_CHECKING([for working libstdc++])
149
 
AC_LANG_PUSH([C++])
150
 
AC_RUN_IFELSE(
151
 
    AC_LANG_SOURCE([[
152
 
        #include <iostream>
153
 
        int main()
154
 
        {
155
 
            // this causes an @GLIBCXX_3.4.9 symbol to be linked in -O2 mode
156
 
            std::cout << "test";
157
 
            return 0;
158
 
    }
159
 
    ]]),[AC_MSG_RESULT([yes])],
160
 
    [AC_MSG_FAILURE([failed])],
161
 
[AC_LINK_IFELSE(
162
 
    AC_LANG_SOURCE([[
163
 
        #include <iostream>
164
 
        int main()
165
 
        {
166
 
            // this causes an @GLIBCXX_3.4.9 symbol to be linked in -O2 mode
167
 
            std::cout << "test";
168
 
            return 0;
169
 
        }
170
 
    ]]), [AC_MSG_RESULT([yes])],
171
 
    [AC_MSG_FAILURE([failed])]
172
 
)])
173
 
AC_LANG_POP([C++])
174
 
 
175
 
build_x86=no
176
 
build_ppc=no
177
 
case "$target_cpu" in
178
 
    i?86|amd64|x86_64)
179
 
            build_x86=yes
180
 
            ;;
181
 
    powerpc*)
182
 
            build_ppc=yes
183
 
            ;;
184
 
esac
185
 
 
186
 
# FreeBSD is only one which needs something else than -pthread,
187
 
# according to the logic in ClamAV's main configure.in.
188
 
case "$target_os" in
189
 
freebsd[[45]]*)
190
 
    THREAD_LIBS="-pthread -lc_r"
191
 
    ;;
192
 
freebsd*)
193
 
    THREAD_LIBS="-lthr"
194
 
    ;;
195
 
darwin*)
196
 
    # none required
197
 
    THREAD_LIBS=
198
 
    ;;
199
 
 
200
 
*)
201
 
    THREAD_LIBS="-pthread"
202
 
esac
203
 
AC_SUBST([THREAD_LIBS])
204
 
 
205
 
if test "$enable_alltargets" = "yes"; then
206
 
        build_x86=yes
207
 
        build_ppc=yes
208
 
fi
209
 
if test "$ac_cv_c_bigendian" = "universal"; then
210
 
    AC_MSG_NOTICE([Universal build detected])
211
 
    build_x86=yes
212
 
    build_ppc=yes
213
 
fi
214
 
AC_MSG_NOTICE([Building X86 backend: $build_x86])
215
 
AC_MSG_NOTICE([Building PPC backend: $build_ppc])
216
 
AM_CONDITIONAL(BUILD_X86, [test "$build_x86" = "yes"])
217
 
AM_CONDITIONAL(BUILD_PPC, [test "$build_ppc" = "yes"])
218
 
 
219
 
AC_MSG_CHECKING([optional compiler flags])
220
 
CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
221
 
CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
222
 
AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS])
223
 
 
224
 
AM_CONDITIONAL(BUILD_EXTERNAL_LLVM, [test -n "$llvmconfig"])
225
 
 
226
 
AC_OUTPUT([
227
 
    Makefile
228
 
])