Merge branch 'bytecode'

* bytecode: (99 commits)
  Update to autoconf 2.65, and libtool 2.2.6b.
  Disable LLVM's make check for now.
  Output trace messages to stderr, to ensure its flushed.
  Support for bytecode lines >8k.
  Print llvm's version too when printing clambc's.
  Fix global initializer bitcasts.
  Allow controlling trace level from cmdline.
  Refactor trace API, so that trace printing happens in clambc.
  Add support for null constant.
  Trace formatting fixes.
  Add support for tracing (if bytecode compiled with support).
  Drop extra {} and "".
  Fix compiler version check for C++: autoconf needs [] to be escaped.
  change bytecode format to allow structs with more than 16 fields.
  Fix after merge: update to fmap API.
  Support for scanning files created by bytecode.
  read optional debug metadata.
  Sync headers with clamav bytecode compiler.
  Print better error message when wrong function is called.
  Update to new LLVM API.
  ...

Conflicts:
	Makefile.am
	Makefile.in
	configure
	configure.in
	libclamav/Makefile.am
	libclamav/Makefile.in
	libclamav/pe.h
This commit is contained in:
Török Edvin 2009-12-11 18:21:04 +02:00
commit 5b5e4e6ef0
4150 changed files with 850827 additions and 1363 deletions

1
.gitignore vendored
View file

@ -18,3 +18,4 @@ stamp-h1
*.swp
TAGS
/target.h
libclamav/c++/autom4te.cache/*

72
COPYING.llvm Normal file
View file

@ -0,0 +1,72 @@
The files in libclamav/llvm/llvm are from the LLVM project, original license is
in libclamav/llvm/llvm/LICENSE.TXT:
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2009 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyrights and Licenses for Third Party Software Distributed with LLVM:
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.
The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.
The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:
Program Directory
------- ---------
Autoconf llvm/autoconf
llvm/projects/ModuleMaker/autoconf
llvm/projects/sample/autoconf
CellSPU backend llvm/lib/Target/CellSPU/README.txt
Google Test llvm/utils/unittest/googletest

View file

@ -253,6 +253,10 @@ Fri Oct 2 14:33:09 CEST 2009 (tk)
----------------------------------
* libclamav/scanners.c: fix whitelisting of scripts (bb#1706)
Fri Oct 30 14:04:43 EET 2009 (edwin)
------------------------------------
* configure, m4/acinclude.m4: Avoid trailing slash in libdir for old gcc (#1738).
Wed Sep 30 19:41:43 EEST 2009 (edwin)
-------------------------------------
* configure{.in,}: Only use -fno-strict-aliasing for gcc-4.3+ to avoid bugs

View file

@ -29,8 +29,9 @@ pkgconfig_DATA = libclamav.pc
# don't complain that configuration files and databases are not removed, this is intended
distuninstallcheck_listfiles = find . -type f ! -name clamd.conf ! -name freshclam.conf ! -name daily.cvd ! -name main.cvd -print
DISTCLEANFILES = target.h
DISTCHECK_CONFIGURE_FLAGS=--enable-milter --disable-clamav --enable-distcheck-werror
DISTCHECK_CONFIGURE_FLAGS=--enable-milter --disable-clamav --enable-distcheck-werror --enable-all-jit-targets --enable-llvm=yes
lcov:
($(MAKE); cd unit_tests; $(MAKE) lcov)
quick-check:
($(MAKE); cd unit_tests; $(MAKE) quick-check)

View file

@ -77,9 +77,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -324,6 +324,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
@ -344,7 +345,7 @@ pkgconfig_DATA = libclamav.pc
# don't complain that configuration files and databases are not removed, this is intended
distuninstallcheck_listfiles = find . -type f ! -name clamd.conf ! -name freshclam.conf ! -name daily.cvd ! -name main.cvd -print
DISTCLEANFILES = target.h
DISTCHECK_CONFIGURE_FLAGS = --enable-milter --disable-clamav --enable-distcheck-werror
DISTCHECK_CONFIGURE_FLAGS = --enable-milter --disable-clamav --enable-distcheck-werror --enable-all-jit-targets --enable-llvm=yes
all: clamav-config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive

1
aclocal.m4 vendored
View file

@ -1000,6 +1000,7 @@ m4_include([m4/lib-ld.m4])
m4_include([m4/lib-link.m4])
m4_include([m4/lib-prefix.m4])
m4_include([m4/libtool.m4])
m4_include([m4/llvm.m4])
m4_include([m4/ltdl.m4])
m4_include([m4/ltoptions.m4])
m4_include([m4/ltsugar.m4])

View file

@ -62,9 +62,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -300,6 +300,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -257,6 +257,8 @@ char *nc_recv(int s) {
}
if(res==-1) {
char er[256];
if (errno == EAGAIN)
continue;
strerror_print("!recv failed after successful select");
close(s);
return NULL;

View file

@ -43,9 +43,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -242,6 +242,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -22,12 +22,20 @@
#if HAVE_CONFIG_H
#include "clamav-config.h"
#endif
#include "cltypes.h"
#include <sys/time.h>
#include <stdlib.h>
#include "bytecode.h"
#include "bytecode_priv.h"
#include "clamav.h"
#include "shared/optparser.h"
#include "shared/misc.h"
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
static void help(void)
{
@ -39,35 +47,101 @@ static void help(void)
printf("clambc <file> [function] [param1 ...]\n\n");
printf(" --help -h Show help\n");
printf(" --version -V Show version\n");
printf(" --trace <level> Set bytecode trace level 0..7 (default 7)\n");
printf(" --no-trace-showsource Don't show source line during tracing\n");
printf(" file file to test\n");
printf("\n");
return;
}
static struct dbg_state {
const char *directory;
const char *file;
const char *scope;
uint32_t scopeid;
unsigned line;
unsigned col;
unsigned showline;
} dbg_state;
static void tracehook(struct cli_bc_ctx *ctx, unsigned event)
{
dbg_state.directory = ctx->directory;
if (*ctx->file == '?')
return;
switch (event) {
case trace_func:
fprintf(stderr, "[trace] %s:%u:%u -> %s:%u:%u Entered function %s\n",
dbg_state.file, dbg_state.line, dbg_state.col,
ctx->file, ctx->line, ctx->col, ctx->scope);
dbg_state.scope = ctx->scope;
break;
case trace_param:
fprintf(stderr, "[trace] function parameter:\n");
return;
case trace_scope:
fprintf(stderr, "[trace] %s:%u:%u -> %s:%u:%u\n",
dbg_state.file, dbg_state.line, dbg_state.col,
ctx->file, ctx->line, ctx->col);
dbg_state.scope = ctx->scope;
break;
case trace_line:
case trace_col:
if (dbg_state.showline)
cli_bytecode_debug_printsrc(ctx);
else
fprintf(stderr, "[trace] %s:%u:%u\n",
dbg_state.file, dbg_state.line, dbg_state.col);
break;
default:
break;
}
dbg_state.file = ctx->file;
dbg_state.line = ctx->line;
dbg_state.col = ctx->col;
}
static void tracehook_op(struct cli_bc_ctx *ctx, const char *op)
{
fprintf(stderr, "[trace] %s\n", op);
}
static void tracehook_val(struct cli_bc_ctx *ctx, const char *name, uint32_t value)
{
fprintf(stderr, "[trace] %s = %u\n", name, value);
}
int main(int argc, char *argv[])
{
FILE *f;
struct cli_bc *bc;
struct cli_bc_ctx *ctx;
int rc;
int rc, dbgargc;
struct optstruct *opts;
const struct optstruct *opt;
unsigned funcid=0, i;
struct cli_all_bc bcs;
unsigned int fd = -1;
unsigned tracelevel;
opts = optparse(NULL, argc, argv, 1, OPT_CLAMBC, 0, NULL);
if (!opts) {
fprintf(stderr, "ERROR: Can't parse command line options\n");
exit(1);
}
if(optget(opts, "version")->enabled) {
char* argvx[] = {argv[0], "--version",NULL};
printf("Clam AntiVirus Bytecode Testing Tool %s\n", get_version());
cl_init(CL_INIT_DEFAULT);
cli_bytecode_debug(2, argvx);
optfree(opts);
exit(0);
}
if(optget(opts, "help")->enabled || !opts->filename) {
optfree(opts);
help();
exit(0);
}
if(optget(opts, "version")->enabled) {
printf("Clam AntiVirus Bytecode Testing Tool %s\n", get_version());
optfree(opts);
exit(0);
}
f = fopen(opts->filename[0], "r");
if (!f) {
fprintf(stderr, "Unable to load %s\n", argv[1]);
@ -83,6 +157,33 @@ int main(int argc, char *argv[])
}
cl_debug();
rc = cl_init(CL_INIT_DEFAULT);
if (rc != CL_SUCCESS) {
fprintf(stderr,"Unable to init libclamav: %s\n", cl_strerror(rc));
optfree(opts);
exit(4);
}
dbgargc=1;
while (opts->filename[dbgargc]) dbgargc++;
if (dbgargc > 1)
cli_bytecode_debug(dbgargc, opts->filename);
if (optget(opts, "force-interpreter")->enabled) {
bcs.engine = NULL;
} else {
rc = cli_bytecode_init(&bcs);
if (rc != CL_SUCCESS) {
fprintf(stderr,"Unable to init bytecode engine: %s\n", cl_strerror(rc));
optfree(opts);
exit(4);
}
}
bcs.all_bcs = bc;
bcs.count = 1;
rc = cli_bytecode_load(bc, f, NULL);
if (rc != CL_SUCCESS) {
fprintf(stderr,"Unable to load bytecode: %s\n", cl_strerror(rc));
@ -90,7 +191,7 @@ int main(int argc, char *argv[])
exit(4);
}
rc = cli_bytecode_prepare(bc);
rc = cli_bytecode_prepare(&bcs);
if (rc != CL_SUCCESS) {
fprintf(stderr,"Unable to prepare bytecode: %s\n", cl_strerror(rc));
optfree(opts);
@ -104,6 +205,16 @@ int main(int argc, char *argv[])
fprintf(stderr,"Out of memory\n");
exit(3);
}
memset(&dbg_state, 0, sizeof(dbg_state));
dbg_state.file = "<libclamav>";
dbg_state.line = 0;
dbg_state.col = 0;
dbg_state.showline = !optget(opts, "no-trace-showsource")->enabled;
tracelevel = optget(opts, "trace")->numarg;
cli_bytecode_context_set_trace(ctx, tracelevel,
tracehook,
tracehook_op,
tracehook_val);
if (opts->filename[1]) {
funcid = atoi(opts->filename[1]);
@ -122,7 +233,29 @@ int main(int argc, char *argv[])
}
}
rc = cli_bytecode_run(bc, ctx);
if ((opt = optget(opts,"input"))->enabled) {
fmap_t *map;
fd = open(opt->strarg, O_RDONLY);
if (fd == -1) {
fprintf(stderr, "Unable to open input file %s: %s\n", opt->strarg, strerror(errno));
optfree(opts);
exit(5);
}
map = fmap(fd, 0, 0);
if (!map) {
fprintf(stderr, "Unable to map input file %s\n", opt->strarg);
}
rc = cli_bytecode_context_setfile(ctx, map);
if (rc != CL_SUCCESS) {
fprintf(stderr, "Unable to set file %s: %s\n", opt->strarg, cl_strerror(rc));
optfree(opts);
exit(5);
}
funmap(map);
}
rc = cli_bytecode_run(&bcs, bc, ctx);
if (rc != CL_SUCCESS) {
fprintf(stderr,"Unable to run bytecode: %s\n", cl_strerror(rc));
} else {
@ -133,8 +266,11 @@ int main(int argc, char *argv[])
}
cli_bytecode_context_destroy(ctx);
cli_bytecode_destroy(bc);
cli_bytecode_done(&bcs);
free(bc);
optfree(opts);
if (fd != -1)
close(fd);
printf("Exiting\n");
return 0;
}

View file

@ -61,9 +61,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -260,6 +260,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -34,6 +34,7 @@
#include "libclamav/str.h"
#include "libclamav/clamav.h"
#include "libclamav/others.h"
#include "libclamav/bytecode.h"
#ifndef _WIN32
extern const struct clam_option *clam_options;
@ -294,7 +295,9 @@ int main(int argc, char **argv)
printf("BZIP2 ");
#endif
if(have_rar)
printf("RAR");
printf("RAR ");
if (have_clamjit)
printf("JIT");
printf("\n");
if(!strlen(dbdir)) {

View file

@ -61,9 +61,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -278,6 +278,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -407,6 +407,9 @@ int main(int argc, char **argv)
else
logg("#Not loading phishing signatures.\n");
if(optget(opts,"Bytecode")->enabled)
dboptions |= CL_DB_BYTECODE;
if(optget(opts,"PhishingScanURLs")->enabled)
dboptions |= CL_DB_PHISHING_URLS;
else

View file

@ -61,9 +61,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -271,6 +271,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -43,9 +43,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -271,6 +271,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -62,9 +62,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -262,6 +262,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -332,6 +332,9 @@ int scanmanager(const struct optstruct *opts)
if(optget(opts,"phishing-scan-urls")->enabled)
dboptions |= CL_DB_PHISHING_URLS;
if(optget(opts,"bytecode")->enabled)
dboptions |= CL_DB_BYTECODE;
if((ret = cl_init(CL_INIT_DEFAULT))) {
logg("!Can't initialize libclamav: %s\n", cl_strerror(ret));
return 50;

2872
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,7 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
LT_CONFIG_LTDL_DIR([libltdl])
LT_INIT([dlopen])
LT_INIT([dlopen disable-static])
LTDL_INIT([recursive])
AC_CONFIG_FILES([libltdl/Makefile])
@ -1530,8 +1530,16 @@ if test "x$enable_distcheckwerror" = "xyes"; then
fi
fi
AC_ARG_ENABLE([llvm],AC_HELP_STRING([--enable-llvm],
[Enable 'llvm' JIT/verifier support @<:@default=auto@:>@]),
[enable_llvm=$enableval], [enable_llvm="auto"])
if test "$enable_llvm" != "no"; then
dnl Try to configure subdir, optionally
AC_CONFIG_SUBDIRS_OPTIONAL([libclamav/c++])
fi
AC_OUTPUT([
libclamav/Makefile
clamscan/Makefile
database/Makefile
docs/Makefile
@ -1562,6 +1570,14 @@ docs/man/sigtool.1
docs/man/clamdtop.1
])
if test "$enable_llvm" = "yes" && test "$subdirfailed" != "no"; then
AC_MSG_ERROR([Failed to configure LLVM, and LLVM was explicitly requested])
fi
AM_CONDITIONAL([ENABLE_LLVM],
[test "$subdirfailed" != "yes" && test "$enable_llvm" != "no"])
no_recursion="yes";
AC_OUTPUT([libclamav/Makefile])
# Yep, downgrading the compiler avoids the bug too:
# 4.0.x, and 4.1.0 are the known buggy versions
# 3.4 doesn't have the bug

View file

@ -60,9 +60,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -228,6 +228,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -59,9 +59,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -255,6 +255,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -59,9 +59,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -227,6 +227,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -62,9 +62,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -264,6 +264,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@

View file

@ -17,11 +17,8 @@
# MA 02110-1301, USA.
AM_CPPFLAGS = -I$(top_srcdir) -I@srcdir@/nsis $(LTDLINCL)
lib_LTLIBRARIES =
EXTRA_DIST =
if ENABLE_UNRAR
AM_CPPFLAGS += -DWARN_DLOPEN_FAIL
@ -114,8 +111,19 @@ libclamav_internal_utils_nothreads_la_SOURCES=str.c\
libclamav_internal_utils_nothreads_la_LDFLAGS=-static
libclamav_internal_utils_nothreads_la_CFLAGS=-DCL_NOTHREADS
libclamav_la_LIBADD = @LIBLTDL@ $(IFACELIBADD) libclamav_internal_utils.la @LIBCLAMAV_LIBS@ @THREAD_LIBS@ @LIBM@
libclamav_la_DEPENDENCIES = @LTDLDEPS@ $(IFACEDEP) libclamav_internal_utils.la
if ENABLE_LLVM
LLVMLIBADD=c++/libclamavcxx.la -lstdc++ -lm
LLVMDEP=c++/libclamavcxx.la
SUBDIRS=c++
else
LLVMLIBADD=libclamav_nocxx.la
LLVMDEP=libclamav_nocxx.la
endif
libclamav_nocxx_la_SOURCES = bytecode_nojit.c
libclamav_la_LIBADD = @LIBLTDL@ $(IFACELIBADD) $(LLVMLIBADD) libclamav_internal_utils.la @LIBCLAMAV_LIBS@ @THREAD_LIBS@ @LIBM@
libclamav_la_DEPENDENCIES = @LTDLDEPS@ $(IFACEDEP) $(LLVMDEP) libclamav_internal_utils.la
libclamav_la_CFLAGS = -DSEARCH_LIBDIR=\"$(libdir)\"
libclamav_la_LDFLAGS = @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@ -no-undefined
@ -331,9 +339,12 @@ libclamav_la_SOURCES = \
ishield.c \
ishield.h \
type_desc.h \
bcfeatures.h \
bytecode_api.c \
bytecode_api_decl.c \
bytecode_api.h
bytecode_api.h \
bytecode_api_impl.h \
bytecode_hooks.h
if !LINK_TOMMATH
libclamav_la_SOURCES += bignum.c \
@ -366,7 +377,7 @@ version.h.tmp:
fi
lib_LTLIBRARIES += libclamav.la
noinst_LTLIBRARIES = libclamav_internal_utils.la libclamav_internal_utils_nothreads.la
noinst_LTLIBRARIES = libclamav_internal_utils.la libclamav_internal_utils_nothreads.la libclamav_nocxx.la
EXTRA_DIST += regex/engine.c libclamav.map \
jsparse/generated/operators.h jsparse/generated/keywords.h jsparse/future_reserved_words.list\
jsparse/keywords.list jsparse/special_keywords.list jsparse/operators.gperf

View file

@ -74,9 +74,9 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/llvm.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@ -109,6 +109,8 @@ am__base_list = \
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
@ENABLE_UNRAR_TRUE@am__DEPENDENCIES_1 = libclamunrar_iface.la
@ENABLE_LLVM_FALSE@am__DEPENDENCIES_2 = libclamav_nocxx.la
@ENABLE_LLVM_TRUE@am__DEPENDENCIES_2 = c++/libclamavcxx.la
am__libclamav_la_SOURCES_DIST = clamav.h matcher-ac.c matcher-ac.h \
matcher-bm.c matcher-bm.h matcher.c matcher.h others.c \
others.h readdb.c readdb.h cvd.c cvd.h dsig.c dsig.h \
@ -148,8 +150,9 @@ am__libclamav_la_SOURCES_DIST = clamav.h matcher-ac.c matcher-ac.h \
uniq.h version.c version.h mpool.c mpool.h fmap.c fmap.h \
default.h sha256.c sha256.h bignum.h bytecode.c bytecode.h \
bytecode_vm.c bytecode_priv.h clambc.h cpio.c cpio.h macho.c \
macho.h ishield.c ishield.h type_desc.h bytecode_api.c \
bytecode_api_decl.c bytecode_api.h bignum.c bignum_class.h
macho.h ishield.c ishield.h type_desc.h bcfeatures.h \
bytecode_api.c bytecode_api_decl.c bytecode_api.h \
bytecode_api_impl.h bytecode_hooks.h bignum.c bignum_class.h
@LINK_TOMMATH_FALSE@am__objects_1 = libclamav_la-bignum.lo
am_libclamav_la_OBJECTS = libclamav_la-matcher-ac.lo \
libclamav_la-matcher-bm.lo libclamav_la-matcher.lo \
@ -241,6 +244,9 @@ libclamav_internal_utils_nothreads_la_LINK = $(LIBTOOL) $(AM_V_lt) \
$(CCLD) $(libclamav_internal_utils_nothreads_la_CFLAGS) \
$(CFLAGS) $(libclamav_internal_utils_nothreads_la_LDFLAGS) \
$(LDFLAGS) -o $@
libclamav_nocxx_la_LIBADD =
am_libclamav_nocxx_la_OBJECTS = bytecode_nojit.lo
libclamav_nocxx_la_OBJECTS = $(am_libclamav_nocxx_la_OBJECTS)
libclamunrar_la_LIBADD =
am__libclamunrar_la_SOURCES_DIST = ../libclamunrar/unrar15.c \
../libclamunrar/unrar20.h ../libclamunrar/unrar.h \
@ -301,16 +307,56 @@ am__v_GEN_0 = @echo " GEN " $@;
SOURCES = $(libclamav_la_SOURCES) \
$(libclamav_internal_utils_la_SOURCES) \
$(libclamav_internal_utils_nothreads_la_SOURCES) \
$(libclamunrar_la_SOURCES) $(libclamunrar_iface_la_SOURCES)
$(libclamav_nocxx_la_SOURCES) $(libclamunrar_la_SOURCES) \
$(libclamunrar_iface_la_SOURCES)
DIST_SOURCES = $(am__libclamav_la_SOURCES_DIST) \
$(libclamav_internal_utils_la_SOURCES) \
$(libclamav_internal_utils_nothreads_la_SOURCES) \
$(libclamav_nocxx_la_SOURCES) \
$(am__libclamunrar_la_SOURCES_DIST) \
$(am__libclamunrar_iface_la_SOURCES_DIST)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
HEADERS = $(include_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = c++
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@ -459,6 +505,7 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
@ -548,8 +595,14 @@ libclamav_internal_utils_nothreads_la_SOURCES = str.c\
libclamav_internal_utils_nothreads_la_LDFLAGS = -static
libclamav_internal_utils_nothreads_la_CFLAGS = -DCL_NOTHREADS
libclamav_la_LIBADD = @LIBLTDL@ $(IFACELIBADD) libclamav_internal_utils.la @LIBCLAMAV_LIBS@ @THREAD_LIBS@ @LIBM@
libclamav_la_DEPENDENCIES = @LTDLDEPS@ $(IFACEDEP) libclamav_internal_utils.la
@ENABLE_LLVM_FALSE@LLVMLIBADD = libclamav_nocxx.la
@ENABLE_LLVM_TRUE@LLVMLIBADD = c++/libclamavcxx.la -lstdc++ -lm
@ENABLE_LLVM_FALSE@LLVMDEP = libclamav_nocxx.la
@ENABLE_LLVM_TRUE@LLVMDEP = c++/libclamavcxx.la
@ENABLE_LLVM_TRUE@SUBDIRS = c++
libclamav_nocxx_la_SOURCES = bytecode_nojit.c
libclamav_la_LIBADD = @LIBLTDL@ $(IFACELIBADD) $(LLVMLIBADD) libclamav_internal_utils.la @LIBCLAMAV_LIBS@ @THREAD_LIBS@ @LIBM@
libclamav_la_DEPENDENCIES = @LTDLDEPS@ $(IFACEDEP) $(LLVMDEP) libclamav_internal_utils.la
libclamav_la_CFLAGS = -DSEARCH_LIBDIR=\"$(libdir)\"
libclamav_la_LDFLAGS = @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@ \
-no-undefined $(am__append_6)
@ -593,16 +646,17 @@ libclamav_la_SOURCES = clamav.h matcher-ac.c matcher-ac.h matcher-bm.c \
uniq.h version.c version.h mpool.c mpool.h fmap.c fmap.h \
default.h sha256.c sha256.h bignum.h bytecode.c bytecode.h \
bytecode_vm.c bytecode_priv.h clambc.h cpio.c cpio.h macho.c \
macho.h ishield.c ishield.h type_desc.h bytecode_api.c \
bytecode_api_decl.c bytecode_api.h $(am__append_7)
noinst_LTLIBRARIES = libclamav_internal_utils.la libclamav_internal_utils_nothreads.la
macho.h ishield.c ishield.h type_desc.h bcfeatures.h \
bytecode_api.c bytecode_api_decl.c bytecode_api.h \
bytecode_api_impl.h bytecode_hooks.h $(am__append_7)
noinst_LTLIBRARIES = libclamav_internal_utils.la libclamav_internal_utils_nothreads.la libclamav_nocxx.la
COMMON_CLEANFILES = version.h version.h.tmp *.gcda *.gcno
@MAINTAINER_MODE_TRUE@BUILT_SOURCES = jsparse/generated/operators.h jsparse/generated/keywords.h jsparse-keywords.gperf
@MAINTAINER_MODE_TRUE@GPERF_FLAGS = -E -t -L ANSI-C -C -F ', TOK_ERROR' -c
@MAINTAINER_MODE_FALSE@CLEANFILES = $(COMMON_CLEANFILES)
@MAINTAINER_MODE_TRUE@CLEANFILES = $(COMMON_CLEANFILES) @srcdir@/jsparse/generated/operators.h @srcdir@/jsparse/generated/keywords.h
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
@ -682,6 +736,8 @@ libclamav_internal_utils.la: $(libclamav_internal_utils_la_OBJECTS) $(libclamav_
$(AM_V_CCLD)$(libclamav_internal_utils_la_LINK) $(libclamav_internal_utils_la_OBJECTS) $(libclamav_internal_utils_la_LIBADD) $(LIBS)
libclamav_internal_utils_nothreads.la: $(libclamav_internal_utils_nothreads_la_OBJECTS) $(libclamav_internal_utils_nothreads_la_DEPENDENCIES)
$(AM_V_CCLD)$(libclamav_internal_utils_nothreads_la_LINK) $(libclamav_internal_utils_nothreads_la_OBJECTS) $(libclamav_internal_utils_nothreads_la_LIBADD) $(LIBS)
libclamav_nocxx.la: $(libclamav_nocxx_la_OBJECTS) $(libclamav_nocxx_la_DEPENDENCIES)
$(AM_V_CCLD)$(LINK) $(libclamav_nocxx_la_OBJECTS) $(libclamav_nocxx_la_LIBADD) $(LIBS)
libclamunrar.la: $(libclamunrar_la_OBJECTS) $(libclamunrar_la_DEPENDENCIES)
$(AM_V_CCLD)$(libclamunrar_la_LINK) $(am_libclamunrar_la_rpath) $(libclamunrar_la_OBJECTS) $(libclamunrar_la_LIBADD) $(LIBS)
libclamunrar_iface.la: $(libclamunrar_iface_la_OBJECTS) $(libclamunrar_iface_la_DEPENDENCIES)
@ -693,6 +749,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bytecode_nojit.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-md5.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-others_common.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-qsort.Plo@am__quote@
@ -1851,6 +1908,76 @@ uninstall-includeHEADERS:
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@ -1861,10 +1988,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@ -1883,7 +2023,7 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@ -1933,24 +2073,53 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
$(MAKE) $(AM_MAKEFLAGS) check-recursive
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
$(MAKE) $(AM_MAKEFLAGS) install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@ -1969,94 +2138,97 @@ maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean: clean-recursive
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstLTLIBRARIES mostlyclean-am
distclean: distclean-am
distclean: distclean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi: dvi-recursive
dvi-am:
html: html-am
html: html-recursive
html-am:
info: info-am
info: info-recursive
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-am
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html: install-html-recursive
install-html-am:
install-info: install-info-am
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-am
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean: maintainer-clean-recursive
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf: pdf-recursive
pdf-am:
ps: ps-am
ps: ps-recursive
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
.MAKE: all check install install-am install-strip
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
ctags-recursive install install-am install-strip \
tags-recursive
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
ctags distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
ctags ctags-recursive distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLTLIBRARIES
tags tags-recursive uninstall uninstall-am \
uninstall-includeHEADERS uninstall-libLTLIBRARIES
.PHONY: version.h.tmp

41
libclamav/bcfeatures.h Normal file
View file

@ -0,0 +1,41 @@
/*
* Copyright (C) 2009 Sourcefire, Inc.
* All rights reserved.
* Authors: Török Edvin
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef BC_FEATURES_H
#define BC_FEATURES_H
/* Compatibility for non-clang compilers */
#ifndef __has_feature
#define __has_feature(x) 0
#endif
#if __has_feature(attribute_bounds)
#define EBOUNDS(fieldname) __attribute__((bounds(fieldname)))
#else
#define EBOUNDS(x)
#endif
#endif

File diff suppressed because it is too large Load diff

View file

@ -21,10 +21,10 @@
*/
#ifndef BYTECODE_H
#define BYTECODE_H
#include <stdio.h>
#include <stdint.h>
#include "clambc.h"
#include "cltypes.h"
#include "others.h"
#include <stdio.h>
#include "fmap.h"
struct cli_dbio;
struct cli_bc_ctx;
@ -32,8 +32,13 @@ struct cli_bc_func;
struct cli_bc_value;
struct cli_bc_inst;
struct cli_bc_type;
struct cli_bc_engine;
struct cli_bc_dbgnode;
struct bitset_tag;
struct cl_engine;
enum bc_state {
bc_skip,
bc_loaded,
bc_jit,
bc_interp
@ -43,27 +48,80 @@ struct cli_bc {
unsigned verifier;
char *sigmaker;
unsigned id;
unsigned kind;
struct bytecode_metadata metadata;
unsigned num_types;
unsigned num_func;
struct cli_bc_func *funcs;
struct cli_bc_type *types;
uint64_t **globals;
uint16_t *globaltys;
size_t num_globals;
enum bc_state state;
uint16_t start_tid;
bitset_t *uses_apis;
struct bitset_tag *uses_apis;
char *lsig;
char *vnameprefix;
char **vnames;
unsigned vnames_cnt;
struct cli_bc_dbgnode *dbgnodes;
unsigned dbgnode_cnt;
};
struct cli_all_bc {
struct cli_bc *all_bcs;
unsigned count;
struct cli_bcengine *engine;
};
struct cli_pe_hook_data;
struct cli_bc_ctx *cli_bytecode_context_alloc(void);
/* FIXME: we can't include others.h because others.h includes us...*/
void cli_bytecode_context_setctx(struct cli_bc_ctx *ctx, void *cctx);
int cli_bytecode_context_setfuncid(struct cli_bc_ctx *ctx, const struct cli_bc *bc, unsigned funcid);
int cli_bytecode_context_setparam_int(struct cli_bc_ctx *ctx, unsigned i, uint64_t c);
int cli_bytecode_context_setparam_ptr(struct cli_bc_ctx *ctx, unsigned i, void *data, unsigned datalen);
int cli_bytecode_context_setfile(struct cli_bc_ctx *ctx, fmap_t *map);
int cli_bytecode_context_setpe(struct cli_bc_ctx *ctx, const struct cli_pe_hook_data *data);
int cli_bytecode_context_clear(struct cli_bc_ctx *ctx);
/* returns file descriptor, sets tempfile. Caller takes ownership, and is
* responsible for freeing/unlinking */
int cli_bytecode_context_getresult_file(struct cli_bc_ctx *ctx, char **tempfilename);
uint64_t cli_bytecode_context_getresult_int(struct cli_bc_ctx *ctx);
void cli_bytecode_context_destroy(struct cli_bc_ctx *ctx);
extern int have_clamjit;
int cli_bytecode_init(struct cli_all_bc *allbc);
int cli_bytecode_load(struct cli_bc *bc, FILE *f, struct cli_dbio *dbio);
int cli_bytecode_prepare(struct cli_bc *bc);
int cli_bytecode_run(const struct cli_bc *bc, struct cli_bc_ctx *ctx);
int cli_bytecode_prepare(struct cli_all_bc *allbc);
int cli_bytecode_run(const struct cli_all_bc *bcs, const struct cli_bc *bc, struct cli_bc_ctx *ctx);
void cli_bytecode_destroy(struct cli_bc *bc);
int cli_bytecode_done(struct cli_all_bc *allbc);
/* Hooks */
struct cli_exe_info;
int cli_bytecode_runlsig(const struct cli_all_bc *bcs, const struct cli_bc* bc, const char **virname, const uint32_t* lsigcnt, fmap_t *fmap);
int cli_bytecode_runhook(const struct cl_engine *engine, struct cli_bc_ctx *ctx, unsigned id, fmap_t *map, const char **virname);
#ifdef __cplusplus
extern "C" {
#endif
int bytecode_init(void);
/* Bytecode internal debug API */
void cli_bytecode_debug(int argc, char **argv);
void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx);
typedef void (*bc_dbg_callback_trace)(struct cli_bc_ctx*, unsigned event);
typedef void (*bc_dbg_callback_trace_op)(struct cli_bc_ctx*, const char *op);
typedef void (*bc_dbg_callback_trace_val)(struct cli_bc_ctx*, const char *name, uint32_t value);
void cli_bytecode_context_set_trace(struct cli_bc_ctx*, unsigned mask,
bc_dbg_callback_trace,
bc_dbg_callback_trace_op,
bc_dbg_callback_trace_val);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -3,6 +3,8 @@
*
* Copyright (C) 2009 Sourcefire, Inc.
*
* Authors: Török Edvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@ -18,16 +20,200 @@
* MA 02110-1301, USA.
*/
#define _XOPEN_SOURCE 600
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include "cltypes.h"
#include "clambc.h"
#include "bytecode.h"
#include "bytecode_priv.h"
#include "type_desc.h"
#include "bytecode_api.h"
#include "bytecode_api_impl.h"
#include "others.h"
int32_t cli_bcapi_test0(struct foo* s, uint32_t u)
uint32_t cli_bcapi_test0(struct cli_bc_ctx *ctx, struct foo* s, uint32_t u)
{
return (s && s->nxt == s && u == 0xdeadbeef) ? 0x12345678 : 0x55;
}
int32_t cli_bcapi_test1(int32_t a, int32_t b)
uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx, uint32_t a, uint32_t b)
{
return (a==0xf00dbeef && b==0xbeeff00d) ? 0x12345678 : 0x55;
}
int32_t cli_bcapi_read(struct cli_bc_ctx* ctx, uint8_t *data, int32_t size)
{
if (!ctx->fmap)
return -1;
return fmap_readn(ctx->fmap, data, ctx->off, size);
}
int32_t cli_bcapi_seek(struct cli_bc_ctx* ctx, int32_t pos, uint32_t whence)
{
off_t off;
if (!ctx->fmap)
return -1;
switch (whence) {
case 0:
off = pos;
break;
case 1:
off = ctx->off + pos;
break;
case 2:
off = ctx->file_size + pos;
break;
}
if (off < 0 || off > ctx->file_size)
return -1;
ctx->off = off;
return off;
}
uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx, const uint8_t *str, uint32_t len)
{
cli_dbgmsg("bytecode debug: %s\n", str);
return 0;
}
uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx, uint32_t a, uint32_t b)
{
cli_dbgmsg("bytecode debug: %u\n", a);
return 0;
}
/*TODO: compiler should make sure that only constants are passed here, and not
* pointers to arbitrary locations that may not be valid when bytecode finishes
* executing */
uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx* ctx, const uint8_t *name, uint32_t len)
{
ctx->virname = name;
return 0;
}
uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT *res, uint32_t len)
{
//TODO: call disasm_x86_wrap, which outputs a MARIO struct
}
/* TODO: field in ctx, id of last bytecode that called magicscandesc, reset
* after hooks/other bytecodes are run. TODO: need a more generic solution
* to avoid uselessly recursing on bytecode-unpacked files, but also a way to
* override the limit if we need it in a special situation */
int32_t cli_bcapi_write(struct cli_bc_ctx *ctx, uint8_t*data, int32_t len)
{
int32_t res;
cli_ctx *cctx = (cli_ctx*)ctx->ctx;
if (len < 0) {
cli_warnmsg("Bytecode API: called with negative length!\n");
return -1;
}
if (ctx->outfd == -1) {
ctx->tempfile = cli_gentemp(cctx ? cctx->engine->tmpdir : NULL);
if (!ctx->tempfile) {
cli_dbgmsg("Bytecode API: Unable to allocate memory for tempfile\n");
return -1;
}
ctx->outfd = open(ctx->tempfile, O_RDWR|O_CREAT|O_EXCL|O_TRUNC|O_BINARY, 0600);
if (ctx->outfd == -1) {
cli_warnmsg("Bytecode API: Can't create file %s\n", ctx->tempfile);
free(ctx->tempfile);
return -1;
}
}
if (cli_checklimits("bytecode api", cctx, ctx->written + len, 0, 0))
return -1;
res = cli_writen(ctx->outfd, data, len);
if (res > 0) ctx->written += res;
if (res == -1)
cli_dbgmsg("Bytecode API: write failed: %s\n", errno);
return res;
}
void cli_bytecode_context_set_trace(struct cli_bc_ctx* ctx, enum trace_level level,
bc_dbg_callback_trace trace,
bc_dbg_callback_trace_op trace_op,
bc_dbg_callback_trace_val trace_val)
{
ctx->trace = trace;
ctx->trace_op = trace_op;
ctx->trace_val = trace_val;
ctx->trace_level = level;
}
uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx, const const uint8_t *scope, uint32_t scopeid)
{
if (LIKELY(!ctx->trace_level))
return 0;
if (ctx->scope != (const char*)scope) {
ctx->scope = (const char*)scope ? (const char*)scope : "?";
ctx->scopeid = scopeid;
ctx->trace_level |= 0x80;/* temporarely increase level to print params */
} else if ((ctx->trace_level >= trace_scope) && ctx->scopeid != scopeid) {
ctx->scopeid = scopeid;
ctx->trace_level |= 0x40;/* temporarely increase level to print location */
}
return 0;
}
uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx, const const uint8_t* dir, uint32_t dummy)
{
if (LIKELY(!ctx->trace_level))
return 0;
ctx->directory = (const char*)dir ? (const char*)dir : "";
return 0;
}
uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx, const const uint8_t *file, uint32_t line)
{
if (LIKELY(ctx->trace_level < trace_line))
return 0;
if (ctx->file != (const char*)file || ctx->line != line) {
ctx->col = 0;
ctx->file =(const char*)file ? (const char*)file : "??";
ctx->line = line;
}
return 0;
}
uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx, const const uint8_t *op, uint32_t col)
{
if (LIKELY(ctx->trace_level < trace_col))
return 0;
if (ctx->trace_level&0xc0) {
ctx->col = col;
/* func/scope changed and they needed param/location event */
ctx->trace(ctx, (ctx->trace_level&0x80) ? trace_func : trace_scope);
ctx->trace_level &= ~0xc0;
}
if (LIKELY(ctx->trace_level < trace_col))
return 0;
if (ctx->col != col) {
ctx->col = col;
ctx->trace(ctx, trace_col);
} else {
ctx->trace(ctx, trace_line);
}
if (LIKELY(ctx->trace_level < trace_op))
return 0;
if (ctx->trace_op && op)
ctx->trace_op(ctx, (const char*)op);
return 0;
}
uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx, const const uint8_t* name, uint32_t value)
{
if (LIKELY(ctx->trace_level < trace_val))
return 0;
if (ctx->trace_level&0x80) {
if ((ctx->trace_level&0x7f) < trace_param)
return 0;
ctx->trace(ctx, trace_param);
}
if (ctx->trace_val && name)
ctx->trace_val(ctx, name, value);
return 0;
}

View file

@ -1,6 +1,169 @@
/*
* Copyright (C) 2009 Sourcefire, Inc.
* All rights reserved.
* Authors: Török Edvin
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/** @file */
#ifndef BYTECODE_API_H
#define BYTECODE_API_H
#ifdef __CLAMBC__
#include "bytecode_execs.h"
#include "bytecode_pe.h"
#include "bytecode_disasm.h"
#endif
#ifndef __CLAMBC__
#include "execs.h"
struct DISASM_RESULT;
#endif
struct foo {
struct foo *nxt;
};
int32_t cli_bcapi_test0(struct foo*, uint32_t);
int32_t cli_bcapi_test1(int32_t, int32_t);
/** Bytecode trigger kind */
enum BytecodeKind {
/** generic bytecode, not tied a specific hook */
BC_GENERIC=0,
_BC_START_HOOKS=256,
/** triggered by a logical signature */
BC_LOGICAL=256,
/** a PE unpacker */
BC_PE_UNPACKER,
_BC_LAST_HOOK
};
#ifdef __CLAMBC__
/** @brief Logical signature match counts
*
* This is a low-level variable, use the Macros in bytecode_local.h instead to
* access it.
* */
extern const uint32_t __clambc_match_counts[64];
/** Executable info, if this is a PE hook */
extern const struct cli_exe_info __clambc_exeinfo;
/** PE data, if this is a PE hook */
extern const struct cli_pe_hook_data __clambc_pedata;
/** Kind of the bytecode */
const uint16_t __clambc_kind;
uint32_t test0(struct foo*, uint32_t);
uint32_t test1(uint32_t, uint32_t);
/**
* @brief Reads specified amount of bytes from the current file
* into a buffer.
*
* @param[in] size amount of bytes to read
* @param[out] data pointer to buffer where data is read into
* @return amount read.
*/
int32_t read(uint8_t *data, int32_t size);
enum {
/**set file position to specified absolute position */
SEEK_SET=0,
/**set file position relative to current position */
SEEK_CUR,
/**set file position relative to file end*/
SEEK_END
};
/**
* @brief Writes the specified amount of bytes from a buffer to the
* current temporary file.
* @param[in] data pointer to buffer of data to write
* @param[in] size amount of bytes to write
* \p size bytes to temporary file, from the buffer pointed to
* byte
* @return amount of bytes successfully written
*/
int32_t write(uint8_t *data, int32_t size);
/**
* @brief Changes the current file position to the specified one.
* @sa SEEK_SET, SEEK_CUR, SEEK_END
* @param[in] pos offset (absolute or relative depending on \p whence param)
* @param[in] whence one of \p SEEK_SET, \p SEEK_CUR, \p SEEK_END
* @return absolute position in file
*/
int32_t seek(int32_t pos, uint32_t whence);
/**
* Sets the name of the virus found.
*
* @param[in] name the name of the virus
* @param[in] len length of the virusname
* @return 0
*/
uint32_t setvirusname(const uint8_t *name, uint32_t len);
/**
* Prints a debug message.
*
* @param[in] str Message to print
* @param[in] len length of message to print
* @return 0
*/
uint32_t debug_print_str(const uint8_t *str, uint32_t len);
/**
* Prints a number as a debug message.
*
* @param[in] a number to print
* @param b unused
* @return 0
*/
uint32_t debug_print_uint(uint32_t a, uint32_t b);
/**
* Disassembles starting from current file position, the specified amount of
* bytes.
* @param[out] result pointer to struct holding result
* @param[in] len how many bytes to disassemble
* @return 0 for success
*
* You can use lseek to disassemble starting from a different location.
* This is a low-level API, the result is in ClamAV type-8 signature format
* (64 bytes/instruction).
* \sa DisassembleAt
* */
uint32_t disasm_x86(struct DISASM_RESULT* result, uint32_t len);
/* tracing API */
/* a scope: lexical block, function, or compile unit */
uint32_t trace_directory(const uint8_t* directory, uint32_t dummy);
uint32_t trace_scope(const uint8_t* newscope, uint32_t scopeid);
uint32_t trace_source(const uint8_t* srcfile, uint32_t line);
uint32_t trace_op(const uint8_t* opname, uint32_t column);
uint32_t trace_value(const uint8_t* name, uint32_t v);
#endif
#endif

View file

@ -3,49 +3,153 @@
* This is an automatically generated file!
*
* Copyright (C) 2009 Sourcefire, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* This program 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE
*/
#include "cltypes.h"
#include "type_desc.h"
#include "bytecode_api.h"
#include "bytecode_api_impl.h"
#include "bytecode_priv.h"
#include <stdlib.h>
static uint16_t cli_tmp0[]={32, 70, 32};
uint32_t cli_bcapi_test0(struct cli_bc_ctx *ctx, struct foo*, uint32_t);
uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx, uint32_t, uint32_t);
int32_t cli_bcapi_read(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
int32_t cli_bcapi_write(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx, int32_t, uint32_t);
uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx, uint32_t, uint32_t);
uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT*, uint32_t);
uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
const struct cli_apiglobal cli_globals[] = {
/* Bytecode globals BEGIN */
{"__clambc_kind", GLOBAL_KIND, 16,
((char*)&((struct cli_bc_ctx*)0)->hooks.kind - (char*)NULL)},
{"__clambc_match_counts", GLOBAL_MATCH_COUNTS, 82,
((char*)&((struct cli_bc_ctx*)0)->hooks.match_counts - (char*)NULL)},
{"__clambc_exeinfo", GLOBAL_EXEINFO, 79,
((char*)&((struct cli_bc_ctx*)0)->hooks.exeinfo - (char*)NULL)},
{"__clambc_pedata", GLOBAL_PEDATA, 69,
((char*)&((struct cli_bc_ctx*)0)->hooks.pedata - (char*)NULL)}
/* Bytecode globals END */
};
const unsigned cli_apicall_maxglobal = _LAST_GLOBAL-1;
static uint16_t cli_tmp0[]={79, 77, 75, 72, 70, 32, 32, 32, 8, 65};
static uint16_t cli_tmp1[]={71};
static uint16_t cli_tmp2[]={70};
static uint16_t cli_tmp3[]={32, 32, 32};
static uint16_t cli_tmp2[]={32, 32};
static uint16_t cli_tmp3[]={73};
static uint16_t cli_tmp4[]={16, 8, 8, 32, 32, 32, 32, 32, 64, 32, 32, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 16, 16, 64, 64, 64, 64, 32, 32, 74};
static uint16_t cli_tmp5[]={71};
static uint16_t cli_tmp6[]={76};
static uint16_t cli_tmp7[]={16, 8, 8, 32, 32, 32, 32, 32, 32, 32, 32, 32, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 16, 16, 32, 32, 32, 32, 32, 32, 74};
static uint16_t cli_tmp8[]={78};
static uint16_t cli_tmp9[]={32, 16, 16, 32, 32, 32, 16, 16};
static uint16_t cli_tmp10[]={80, 32, 32, 16};
static uint16_t cli_tmp11[]={81};
static uint16_t cli_tmp12[]={32, 32, 32, 32, 32, 32, 32, 32, 32};
static uint16_t cli_tmp13[]={32};
static uint16_t cli_tmp14[]={32, 65, 32};
static uint16_t cli_tmp15[]={32, 85, 32};
static uint16_t cli_tmp16[]={86};
static uint16_t cli_tmp17[]={16, 8, 8, 8, 88, 87};
static uint16_t cli_tmp18[]={8};
static uint16_t cli_tmp19[]={89};
static uint16_t cli_tmp20[]={8};
static uint16_t cli_tmp21[]={32, 32, 32};
static uint16_t cli_tmp22[]={32, 92, 32};
static uint16_t cli_tmp23[]={93};
static uint16_t cli_tmp24[]={92};
const struct cli_bc_type cli_apicall_types[]={
{FunctionType, cli_tmp0, 3},
{PointerType, cli_tmp1, 1},
{StructType, cli_tmp2, 1},
{FunctionType, cli_tmp3, 3}
{DStructType, cli_tmp0, 10, 0, 0},
{DPointerType, cli_tmp1, 1, 0, 0},
{DStructType, cli_tmp2, 2, 0, 0},
{DPointerType, cli_tmp3, 1, 0, 0},
{DStructType, cli_tmp4, 30, 0, 0},
{DArrayType, cli_tmp5, 16, 0, 0},
{DPointerType, cli_tmp6, 1, 0, 0},
{DStructType, cli_tmp7, 31, 0, 0},
{DPointerType, cli_tmp8, 1, 0, 0},
{DStructType, cli_tmp9, 8, 0, 0},
{DStructType, cli_tmp10, 4, 0, 0},
{DPointerType, cli_tmp11, 1, 0, 0},
{DStructType, cli_tmp12, 9, 0, 0},
{DArrayType, cli_tmp13, 64, 0, 0},
{DFunctionType, cli_tmp14, 3, 0, 0},
{DFunctionType, cli_tmp15, 3, 0, 0},
{DPointerType, cli_tmp16, 1, 0, 0},
{DStructType, cli_tmp17, 6, 0, 0},
{DArrayType, cli_tmp18, 29, 0, 0},
{DArrayType, cli_tmp19, 10, 0, 0},
{DArrayType, cli_tmp20, 3, 0, 0},
{DFunctionType, cli_tmp21, 3, 0, 0},
{DFunctionType, cli_tmp22, 3, 0, 0},
{DPointerType, cli_tmp23, 1, 0, 0},
{DStructType, cli_tmp24, 1, 0, 0}
};
const unsigned cli_apicall_maxtypes=sizeof(cli_apicall_types)/sizeof(cli_apicall_types[0]);
const struct cli_apicall cli_apicalls[]={
/* Bytecode APIcalls BEGIN */
{"cli_bcapi_test0", 0, 0, 1},
{"cli_bcapi_test1", 3, 0, 0}
{"test0", 22, 0, 1},
{"test1", 21, 0, 0},
{"read", 14, 1, 1},
{"write", 14, 2, 1},
{"seek", 21, 1, 0},
{"setvirusname", 14, 3, 1},
{"debug_print_str", 14, 4, 1},
{"debug_print_uint", 21, 2, 0},
{"disasm_x86", 15, 5, 1},
{"trace_directory", 14, 6, 1},
{"trace_scope", 14, 7, 1},
{"trace_source", 14, 8, 1},
{"trace_op", 14, 9, 1},
{"trace_value", 14, 10, 1}
/* Bytecode APIcalls END */
};
const cli_apicall_int2 cli_apicalls0[] = {
cli_bcapi_test1
(cli_apicall_int2)cli_bcapi_test1,
(cli_apicall_int2)cli_bcapi_seek,
(cli_apicall_int2)cli_bcapi_debug_print_uint
};
const cli_apicall_pointer cli_apicalls1[] = {
(cli_apicall_pointer)cli_bcapi_test0
(cli_apicall_pointer)cli_bcapi_test0,
(cli_apicall_pointer)cli_bcapi_read,
(cli_apicall_pointer)cli_bcapi_write,
(cli_apicall_pointer)cli_bcapi_setvirusname,
(cli_apicall_pointer)cli_bcapi_debug_print_str,
(cli_apicall_pointer)cli_bcapi_disasm_x86,
(cli_apicall_pointer)cli_bcapi_trace_directory,
(cli_apicall_pointer)cli_bcapi_trace_scope,
(cli_apicall_pointer)cli_bcapi_trace_source,
(cli_apicall_pointer)cli_bcapi_trace_op,
(cli_apicall_pointer)cli_bcapi_trace_value
};
const unsigned cli_apicall_maxapi = sizeof(cli_apicalls)/sizeof(cli_apicalls[0]);

View file

@ -0,0 +1,48 @@
/*
* ClamAV bytecode internal API
* This is an automatically generated file!
*
* Copyright (C) 2009 Sourcefire, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE
*/
#ifndef BYTECODE_API_IMPL_H
#define BYTECODE_API_IMPL_H
struct cli_bc_bctx;
uint32_t cli_bcapi_test0(struct cli_bc_ctx *ctx, struct foo*, uint32_t);
uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx, uint32_t, uint32_t);
int32_t cli_bcapi_read(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
int32_t cli_bcapi_write(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx, int32_t, uint32_t);
uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx, uint32_t, uint32_t);
uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT*, uint32_t);
uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx, const const uint8_t*, uint32_t);
#endif

View file

@ -0,0 +1,38 @@
/*
* ClamAV bytecode internal API
* This is an automatically generated file!
*
* Copyright (C) 2009 Sourcefire, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE
*/
#ifndef BYTECODE_HOOKS_H
#define BYTECODE_HOOKS_H
struct cli_bc_hooks {
const uint16_t* kind;
const uint32_t* match_counts;
const struct cli_exe_info* exeinfo;
const struct cli_pe_hook_data* pedata;
};
#endif

View file

@ -0,0 +1,72 @@
/*
* Load, and verify ClamAV bytecode.
*
* Copyright (C) 2009 Sourcefire, Inc.
*
* Authors: Török Edvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include <stdlib.h>
#include "cltypes.h"
#include "bytecode.h"
#include "bytecode_priv.h"
#include "clamav.h"
#include "others.h"
int cli_bytecode_prepare_jit(struct cli_all_bc *bcs)
{
unsigned i;
for (i=0;i<bcs->count;i++) {
if (bcs->all_bcs[i].state == bc_skip)
continue;
if (bcs->all_bcs[i].state != bc_loaded) {
cli_warnmsg("Cannot prepare for JIT, because it has already been converted to interpreter");
return CL_EBYTECODE;
}
}
cli_warnmsg("JIT not compiled in\n");
return CL_EBYTECODE;
}
int cli_vm_execute_jit(const struct cli_all_bc *bcs, struct cli_bc_ctx *ctx, const struct cli_bc_func *func)
{
return CL_EBYTECODE;
}
int cli_bytecode_init_jit(struct cli_all_bc *allbc)
{
return CL_SUCCESS;
}
int cli_bytecode_done_jit(struct cli_all_bc *allbc)
{
return CL_SUCCESS;
}
void cli_bytecode_debug(int argc, char **argv) {
// Empty
}
int bytecode_init(void)
{
return 0;
}
void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx) {
// Empty
}
int have_clamjit=0;

View file

@ -23,7 +23,12 @@
#ifndef BYTECODE_PRIV_H
#define BYTECODE_PRIV_H
#include "bytecode.h"
#include "type_desc.h"
#include "execs.h"
#include "bytecode_hooks.h"
#include "fmap.h"
typedef uint32_t operand_t;
typedef uint16_t bbid_t;
typedef uint16_t funcid_t;
@ -77,13 +82,38 @@ struct cli_bc_func {
uint32_t numConstants;
uint32_t numBytes;/* stack size */
uint16_t numBB;
uint16_t returnType;
uint16_t *types;
uint32_t insn_idx;
struct cli_bc_bb *BB;
struct cli_bc_inst *allinsts;
uint64_t *constants;
unsigned *dbgnodes;
};
struct cli_bc_dbgnode_element {
unsigned nodeid;
char *string;
unsigned len;
uint64_t constant;
};
struct cli_bc_dbgnode {
unsigned numelements;
struct cli_bc_dbgnode_element* elements;
};
#define MAX_OP ~0u
enum trace_level {
trace_none=0,
trace_func,
trace_param,
trace_scope,
trace_line,
trace_col,
trace_op,
trace_val
};
struct cli_bc_ctx {
/* id and params of toplevel function called */
const struct cli_bc *bc;
@ -94,7 +124,39 @@ struct cli_bc_ctx {
operand_t *operands;
uint16_t funcid;
unsigned numParams;
size_t file_size;
off_t off;
fmap_t *fmap;
const char *virname;
struct cli_bc_hooks hooks;
int outfd;
char *tempfile;
void *ctx;
unsigned written;
bc_dbg_callback_trace trace;
bc_dbg_callback_trace_op trace_op;
bc_dbg_callback_trace_val trace_val;
unsigned trace_level;
const char *directory;
const char *file;
const char *scope;
uint32_t scopeid;
unsigned line;
unsigned col;
};
struct cli_all_bc;
int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct cli_bc_func *func, const struct cli_bc_inst *inst);
#ifdef __cplusplus
extern "C" {
#endif
int cli_vm_execute_jit(const struct cli_all_bc *bcs, struct cli_bc_ctx *ctx, const struct cli_bc_func *func);
int cli_bytecode_prepare_jit(struct cli_all_bc *bc);
int cli_bytecode_init_jit(struct cli_all_bc *bc);
int cli_bytecode_done_jit(struct cli_all_bc *bc);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -251,6 +251,10 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
CHECK_EQ((p)&7, 0);\
TRACE_W(x, p, 64);\
*(uint64_t*)&values[p] = x
#define WRITEP(x, p) CHECK_GT(func->numBytes, p+PSIZE-1);\
CHECK_EQ((p)&(PSIZE-1), 0);\
TRACE_W(x, p, PSIZE*8);\
*(void**)&values[p] = x
#define READ1(x, p) CHECK_GT(func->numBytes, p);\
x = (*(uint8_t*)&values[p])&1;\
@ -270,6 +274,11 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
CHECK_EQ((p)&7, 0);\
x = *(uint64_t*)&values[p];\
TRACE_R(x)
#define PSIZE sizeof(void*)
#define READP(x, p) CHECK_GT(func->numBytes, p+PSIZE-1);\
CHECK_EQ((p)&(PSIZE-1), 0);\
x = *(void**)&values[p];\
TRACE_R(x)
#define READOLD8(x, p) CHECK_GT(func->numBytes, p);\
x = *(uint8_t*)&old_values[p];\
@ -289,7 +298,7 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
#define BINOP(i) inst->u.binop[i]
#define DEFINE_BINOP_HELPER(opc, OP, W0, W1, W2, W3, W4) \
#define DEFINE_BINOP_BC_HELPER(opc, OP, W0, W1, W2, W3, W4) \
case opc*5: {\
uint8_t op0, op1, res;\
int8_t sop0, sop1;\
@ -341,10 +350,10 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
break;\
}
#define DEFINE_BINOP(opc, OP) DEFINE_BINOP_HELPER(opc, OP, WRITE8, WRITE8, WRITE16, WRITE32, WRITE64)
#define DEFINE_ICMPOP(opc, OP) DEFINE_BINOP_HELPER(opc, OP, WRITE8, WRITE8, WRITE8, WRITE8, WRITE8)
#define DEFINE_BINOP(opc, OP) DEFINE_BINOP_BC_HELPER(opc, OP, WRITE8, WRITE8, WRITE16, WRITE32, WRITE64)
#define DEFINE_ICMPOP(opc, OP) DEFINE_BINOP_BC_HELPER(opc, OP, WRITE8, WRITE8, WRITE8, WRITE8, WRITE8)
#define CHECK_OP(cond, msg) if((cond)) { cli_dbgmsg(msg); return CL_EBYTECODE;}
#define CHECK_OP(cond, msg) if((cond)) { cli_dbgmsg(msg); stop = CL_EBYTECODE; break;}
#define DEFINE_CASTOP(opc, OP) \
case opc*5: {\
@ -400,7 +409,7 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
default: CHECK_UNREACHABLE;\
}
#define DEFINE_OP_RET_N(OP, T, R0, W0) \
#define DEFINE_OP_BC_RET_N(OP, T, R0, W0) \
case OP: {\
T tmp;\
R0(tmp, inst->u.unaryop);\
@ -438,77 +447,77 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
do {
pc++;
switch (inst->interp_op) {
DEFINE_BINOP(OP_ADD, res = op0 + op1);
DEFINE_BINOP(OP_SUB, res = op0 - op1);
DEFINE_BINOP(OP_MUL, res = op0 * op1);
DEFINE_BINOP(OP_BC_ADD, res = op0 + op1);
DEFINE_BINOP(OP_BC_SUB, res = op0 - op1);
DEFINE_BINOP(OP_BC_MUL, res = op0 * op1);
DEFINE_BINOP(OP_UDIV, CHECK_OP(op1 == 0, "bytecode attempted to execute udiv#0\n");
DEFINE_BINOP(OP_BC_UDIV, CHECK_OP(op1 == 0, "bytecode attempted to execute udiv#0\n");
res=op0/op1);
DEFINE_BINOP(OP_SDIV, CHECK_OP(check_sdivops(sop0, sop1), "bytecode attempted to execute sdiv#0\n");
DEFINE_BINOP(OP_BC_SDIV, CHECK_OP(check_sdivops(sop0, sop1), "bytecode attempted to execute sdiv#0\n");
res=sop0/sop1);
DEFINE_BINOP(OP_UREM, CHECK_OP(op1 == 0, "bytecode attempted to execute urem#0\n");
DEFINE_BINOP(OP_BC_UREM, CHECK_OP(op1 == 0, "bytecode attempted to execute urem#0\n");
res=op0 % op1);
DEFINE_BINOP(OP_SREM, CHECK_OP(check_sdivops(sop0,sop1), "bytecode attempted to execute urem#0\n");
DEFINE_BINOP(OP_BC_SREM, CHECK_OP(check_sdivops(sop0,sop1), "bytecode attempted to execute urem#0\n");
res=sop0 % sop1);
DEFINE_BINOP(OP_SHL, CHECK_OP(op1 > inst->type, "bytecode attempted to execute shl greater than bitwidth\n");
DEFINE_BINOP(OP_BC_SHL, CHECK_OP(op1 > inst->type, "bytecode attempted to execute shl greater than bitwidth\n");
res = op0 << op1);
DEFINE_BINOP(OP_LSHR, CHECK_OP(op1 > inst->type, "bytecode attempted to execute lshr greater than bitwidth\n");
DEFINE_BINOP(OP_BC_LSHR, CHECK_OP(op1 > inst->type, "bytecode attempted to execute lshr greater than bitwidth\n");
res = op0 >> op1);
DEFINE_BINOP(OP_ASHR, CHECK_OP(op1 > inst->type, "bytecode attempted to execute ashr greater than bitwidth\n");
DEFINE_BINOP(OP_BC_ASHR, CHECK_OP(op1 > inst->type, "bytecode attempted to execute ashr greater than bitwidth\n");
res = CLI_SRS(sop0, op1));
DEFINE_BINOP(OP_AND, res = op0 & op1);
DEFINE_BINOP(OP_OR, res = op0 | op1);
DEFINE_BINOP(OP_XOR, res = op0 ^ op1);
DEFINE_BINOP(OP_BC_AND, res = op0 & op1);
DEFINE_BINOP(OP_BC_OR, res = op0 | op1);
DEFINE_BINOP(OP_BC_XOR, res = op0 ^ op1);
DEFINE_CASTOP(OP_SEXT,
DEFINE_CASTOP(OP_BC_SEXT,
CHOOSE(READ1(sres, inst->u.cast.source); res = sres ? ~0ull : 0,
READ8(sres, inst->u.cast.source); res=sres=SIGNEXT(sres, inst->u.cast.mask),
READ16(sres, inst->u.cast.source); res=sres=SIGNEXT(sres, inst->u.cast.mask),
READ32(sres, inst->u.cast.source); res=sres=SIGNEXT(sres, inst->u.cast.mask),
READ64(sres, inst->u.cast.source); res=sres=SIGNEXT(sres, inst->u.cast.mask)));
DEFINE_CASTOP(OP_ZEXT,
DEFINE_CASTOP(OP_BC_ZEXT,
CHOOSE(READ1(res, inst->u.cast.source),
READ8(res, inst->u.cast.source),
READ16(res, inst->u.cast.source),
READ32(res, inst->u.cast.source),
READ64(res, inst->u.cast.source)));
DEFINE_CASTOP(OP_TRUNC,
DEFINE_CASTOP(OP_BC_TRUNC,
CHOOSE(READ1(res, inst->u.cast.source),
READ8(res, inst->u.cast.source),
READ16(res, inst->u.cast.source),
READ32(res, inst->u.cast.source),
READ64(res, inst->u.cast.source)));
DEFINE_OP(OP_BRANCH)
DEFINE_OP(OP_BC_BRANCH)
stop = jump(func, (values[inst->u.branch.condition]&1) ?
inst->u.branch.br_true : inst->u.branch.br_false,
&bb, &inst, &bb_inst);
continue;
DEFINE_OP(OP_JMP)
DEFINE_OP(OP_BC_JMP)
stop = jump(func, inst->u.jump, &bb, &inst, &bb_inst);
continue;
DEFINE_OP_RET_N(OP_RET*5, uint8_t, READ1, WRITE8);
DEFINE_OP_RET_N(OP_RET*5+1, uint8_t, READ8, WRITE8);
DEFINE_OP_RET_N(OP_RET*5+2, uint16_t, READ16, WRITE16);
DEFINE_OP_RET_N(OP_RET*5+3, uint32_t, READ32, WRITE32);
DEFINE_OP_RET_N(OP_RET*5+4, uint64_t, READ64, WRITE64);
DEFINE_OP_BC_RET_N(OP_BC_RET*5, uint8_t, READ1, WRITE8);
DEFINE_OP_BC_RET_N(OP_BC_RET*5+1, uint8_t, READ8, WRITE8);
DEFINE_OP_BC_RET_N(OP_BC_RET*5+2, uint16_t, READ16, WRITE16);
DEFINE_OP_BC_RET_N(OP_BC_RET*5+3, uint32_t, READ32, WRITE32);
DEFINE_OP_BC_RET_N(OP_BC_RET*5+4, uint64_t, READ64, WRITE64);
DEFINE_ICMPOP(OP_ICMP_EQ, res = (op0 == op1));
DEFINE_ICMPOP(OP_ICMP_NE, res = (op0 != op1));
DEFINE_ICMPOP(OP_ICMP_UGT, res = (op0 > op1));
DEFINE_ICMPOP(OP_ICMP_UGE, res = (op0 >= op1));
DEFINE_ICMPOP(OP_ICMP_ULT, res = (op0 < op1));
DEFINE_ICMPOP(OP_ICMP_ULE, res = (op0 <= op1));
DEFINE_ICMPOP(OP_ICMP_SGT, res = (sop0 > sop1));
DEFINE_ICMPOP(OP_ICMP_SGE, res = (sop0 >= sop1));
DEFINE_ICMPOP(OP_ICMP_SLE, res = (sop0 <= sop1));
DEFINE_ICMPOP(OP_ICMP_SLT, res = (sop0 < sop1));
DEFINE_ICMPOP(OP_BC_ICMP_EQ, res = (op0 == op1));
DEFINE_ICMPOP(OP_BC_ICMP_NE, res = (op0 != op1));
DEFINE_ICMPOP(OP_BC_ICMP_UGT, res = (op0 > op1));
DEFINE_ICMPOP(OP_BC_ICMP_UGE, res = (op0 >= op1));
DEFINE_ICMPOP(OP_BC_ICMP_ULT, res = (op0 < op1));
DEFINE_ICMPOP(OP_BC_ICMP_ULE, res = (op0 <= op1));
DEFINE_ICMPOP(OP_BC_ICMP_SGT, res = (sop0 > sop1));
DEFINE_ICMPOP(OP_BC_ICMP_SGE, res = (sop0 >= sop1));
DEFINE_ICMPOP(OP_BC_ICMP_SLE, res = (sop0 <= sop1));
DEFINE_ICMPOP(OP_BC_ICMP_SLT, res = (sop0 < sop1));
case OP_SELECT*5:
case OP_BC_SELECT*5:
{
uint8_t t0, t1, t2;
READ1(t0, inst->u.three[0]);
@ -517,7 +526,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
WRITE8(inst->dest, t0 ? t1 : t2);
break;
}
case OP_SELECT*5+1:
case OP_BC_SELECT*5+1:
{
uint8_t t0, t1, t2;
READ1(t0, inst->u.three[0]);
@ -526,7 +535,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
WRITE8(inst->dest, t0 ? t1 : t2);
break;
}
case OP_SELECT*5+2:
case OP_BC_SELECT*5+2:
{
uint8_t t0;
uint16_t t1, t2;
@ -536,7 +545,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
WRITE16(inst->dest, t0 ? t1 : t2);
break;
}
case OP_SELECT*5+3:
case OP_BC_SELECT*5+3:
{
uint8_t t0;
uint32_t t1, t2;
@ -546,7 +555,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
WRITE32(inst->dest, t0 ? t1 : t2);
break;
}
case OP_SELECT*5+4:
case OP_BC_SELECT*5+4:
{
uint8_t t0;
uint64_t t1, t2;
@ -557,7 +566,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
break;
}
DEFINE_OP(OP_CALL_API) {
DEFINE_OP(OP_BC_CALL_API) {
const struct cli_apicall *api = &cli_apicalls[inst->u.ops.funcid];
int32_t res;
CHECK_APIID(inst->u.ops.funcid);
@ -567,7 +576,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
int32_t a, b, r;
READ32(a, inst->u.ops.ops[0]);
READ32(b, inst->u.ops.ops[1]);
res = cli_apicalls0[api->idx](a, b);
res = cli_apicalls0[api->idx](ctx, a, b);
break;
}
case 1: {
@ -585,13 +594,17 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
break;
}
DEFINE_OP(OP_CALL_DIRECT)
DEFINE_OP(OP_BC_CALL_DIRECT)
CHECK_FUNCID(inst->u.ops.funcid);
func2 = &bc->funcs[inst->u.ops.funcid];
CHECK_EQ(func2->numArgs, inst->u.ops.numOps);
old_values = values;
stack_entry = allocate_stack(&stack, stack_entry, func2, func, inst->dest,
bb, bb_inst);
if (!stack_entry) {
stop = CL_EMEM;
break;
}
values = stack_entry->values;
TRACE_EXEC(inst->u.ops.funcid, inst->dest, inst->type, stack_depth);
if (stack_depth > 10000) {
@ -644,35 +657,35 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
stack_depth++;
continue;
case OP_COPY*5:
case OP_BC_COPY*5:
{
uint8_t op;
READ1(op, BINOP(0));
WRITE8(BINOP(1), op);
break;
}
case OP_COPY*5+1:
case OP_BC_COPY*5+1:
{
uint8_t op;
READ8(op, BINOP(0));
WRITE8(BINOP(1), op);
break;
}
case OP_COPY*5+2:
case OP_BC_COPY*5+2:
{
uint16_t op;
READ16(op, BINOP(0));
WRITE16(BINOP(1), op);
break;
}
case OP_COPY*5+3:
case OP_BC_COPY*5+3:
{
uint32_t op;
READ32(op, BINOP(0));
WRITE32(BINOP(1), op);
break;
}
case OP_COPY*5+4:
case OP_BC_COPY*5+4:
{
uint64_t op;
READ32(op, BINOP(0));
@ -680,6 +693,82 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
break;
}
case OP_BC_LOAD*5:
case OP_BC_LOAD*5+1:
{
uint8_t *ptr;
READP(ptr, inst->u.unaryop);
WRITE8(inst->dest, (*ptr));
break;
}
case OP_BC_LOAD*5+2:
{
const union unaligned_16 *ptr;
READP(ptr, inst->u.unaryop);
WRITE16(inst->dest, (ptr->una_u16));
break;
}
case OP_BC_LOAD*5+3:
{
const union unaligned_32 *ptr;
READP(ptr, inst->u.unaryop);
WRITE32(inst->dest, (ptr->una_u32));
break;
}
case OP_BC_LOAD*5+4:
{
const union unaligned_64 *ptr;
READP(ptr, inst->u.unaryop);
WRITE64(inst->dest, (ptr->una_u64));
break;
}
case OP_BC_STORE*5:
{
uint8_t *ptr;
uint8_t v;
READP(ptr, BINOP(0));
READ1(v, BINOP(1));
*ptr = v;
break;
}
case OP_BC_STORE*5+1:
{
uint8_t *ptr;
uint8_t v;
READP(ptr, BINOP(0));
READ8(v, BINOP(1));
*ptr = v;
break;
}
case OP_BC_STORE*5+2:
{
union unaligned_16 *ptr;
uint16_t v;
READP(ptr, BINOP(0));
READ16(v, BINOP(1));
ptr->una_s16 = v;
break;
}
case OP_BC_STORE*5+3:
{
union unaligned_32 *ptr;
uint32_t v;
READP(ptr, BINOP(0));
READ32(v, BINOP(1));
ptr->una_u32 = v;
break;
}
case OP_BC_STORE*5+4:
{
union unaligned_64 *ptr;
uint64_t v;
READP(ptr, BINOP(0));
READ64(v, BINOP(1));
ptr->una_u64 = v;
break;
}
/* TODO: implement OP_BC_GEP1, OP_BC_GEP2, OP_BC_GEPN */
default:
cli_errmsg("Opcode %u of type %u is not implemented yet!\n",
inst->interp_op/5, inst->interp_op%5);
@ -688,7 +777,9 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
}
bb_inst++;
inst++;
CHECK_GT(bb->numInsts, bb_inst);
if (bb) {
CHECK_GT(bb->numInsts, bb_inst);
}
} while (stop == CL_SUCCESS);
cli_stack_destroy(&stack);

854
libclamav/c++/Makefile.am Normal file
View file

@ -0,0 +1,854 @@
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
AM_CPPFLAGS = -I$(top_srcdir)/../.. -I$(top_srcdir)/.. -I$(top_builddir)/../../
ACLOCAL_AMFLAGS=-I m4
if DEBUG_BUILD
LLVM_CONFIG=llvm/Debug/bin/llvm-config
else
LLVM_CONFIG=llvm/Release/bin/llvm-config
endif
#$(LLVM_CONFIG): build-llvm
# we know this will be built with GNU make, so its safe to use GNU make specific
# $(shell ...)
#LLVM_DEPS=$(shell $(LLVM_CONFIG) --libfiles jit nativecodegen)
#libclamavcxx_la_CPPFLAGS = $(AM_CPPFLAGS) `$(LLVM_CONFIG) --cppflags`
#libclamavcxx_la_DEPENDENCIES = $(LLVM_DEPS)
#libclamavcxx_la_LDFLAGS = `$(LLVM_CONFIG) --ldflags --libs jit nativecodegen`
libclamavcxx_la_CPPFLAGS = $(AM_CPPFLAGS) $(LLVM_INCLUDES) $(LLVM_DEFS)
#libclamavcxx_la_DEPENDENCIES = $(LLVM_DEPS)
noinst_LTLIBRARIES = libclamavcxx.la libllvmsupport.la libllvmsystem.la\
libllvmcore.la libllvmtarget.la libllvmsdag.la libllvmcodegen.la libllvmexecutionengine.la\
libllvmscalar.la libllvmipa.la libllvmtransformutils.la\
libllvmmc.la
libclamavcxx_la_LIBADD=
if BUILD_X86
libclamavcxx_la_LIBADD+=libllvmtargetx86.la
noinst_LTLIBRARIES+=libllvmtargetx86.la
endif
if BUILD_PPC
libclamavcxx_la_LIBADD+=libllvmtargetppc.la
noinst_LTLIBRARIES+=libllvmtargetppc.la
endif
if BUILD_ARM
libclamavcxx_la_LIBADD+=libllvmtargetarm.la
noinst_LTLIBRARIES+=libllvmtargetarm.la
endif
libclamavcxx_la_LIBADD+=libllvmsdag.la libllvmexecutionengine.la\
libllvmcodegen.la libllvmscalar.la\
libllvmtransformutils.la libllvmipa.la libllvmtarget.la libllvmmc.la\
libllvmcore.la libllvmsupport.la libllvmsystem.la
libclamavcxx_la_LDFLAGS=-no-undefined
#libclamavcxx_la_LDFLAGS = `$(LLVM_CONFIG) --ldflags --libs jit nativecodegen`
libclamavcxx_la_SOURCES = bytecode2llvm.cpp
LLVM_INCLUDES=-I$(top_srcdir)/llvm/include -I$(top_builddir)/llvm/include
# TODO: _DEBUG should be defined for --enable-debug, and NDEBUG otherwise, but
# keep it like this while I'm testing LLVM
# TODO: HP-UX should have -D_REENTRANT -D_HPUX_SOURCE
LLVM_DEFS=-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_DEBUG -D_GNU_SOURCE
LLVM_CXXFLAGS=-Woverloaded-virtual -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings
EXTRA_DIST=$(top_srcdir)/llvm llvmdejagnu.sh
libllvmsystem_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmsystem_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmsystem_la_LDFLAGS=-pthread
libllvmsystem_la_LIBADD=-ldl
libllvmsystem_la_SOURCES = \
llvm/lib/System/Alarm.cpp\
llvm/lib/System/Atomic.cpp\
llvm/lib/System/Disassembler.cpp\
llvm/lib/System/DynamicLibrary.cpp\
llvm/lib/System/Errno.cpp\
llvm/lib/System/Host.cpp\
llvm/lib/System/IncludeFile.cpp\
llvm/lib/System/Memory.cpp\
llvm/lib/System/Mutex.cpp\
llvm/lib/System/Path.cpp\
llvm/lib/System/Process.cpp\
llvm/lib/System/Program.cpp\
llvm/lib/System/RWMutex.cpp\
llvm/lib/System/Signals.cpp\
llvm/lib/System/ThreadLocal.cpp\
llvm/lib/System/Threading.cpp\
llvm/lib/System/TimeValue.cpp\
llvm/lib/System/Unix/Alarm.inc\
llvm/lib/System/Unix/Host.inc\
llvm/lib/System/Unix/Memory.inc\
llvm/lib/System/Unix/Mutex.inc\
llvm/lib/System/Unix/Path.inc\
llvm/lib/System/Unix/Process.inc\
llvm/lib/System/Unix/Program.inc\
llvm/lib/System/Unix/RWMutex.inc\
llvm/lib/System/Unix/Signals.inc\
llvm/lib/System/Unix/ThreadLocal.inc\
llvm/lib/System/Unix/TimeValue.inc\
llvm/lib/System/Win32/Alarm.inc\
llvm/lib/System/Win32/DynamicLibrary.inc\
llvm/lib/System/Win32/Host.inc\
llvm/lib/System/Win32/Memory.inc\
llvm/lib/System/Win32/Mutex.inc\
llvm/lib/System/Win32/Path.inc\
llvm/lib/System/Win32/Process.inc\
llvm/lib/System/Win32/Program.inc\
llvm/lib/System/Win32/RWMutex.inc\
llvm/lib/System/Win32/Signals.inc\
llvm/lib/System/Win32/ThreadLocal.inc\
llvm/lib/System/Win32/TimeValue.inc
libllvmsupport_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmsupport_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmsupport_la_SOURCES=\
llvm/lib/Support/APFloat.cpp\
llvm/lib/Support/APInt.cpp\
llvm/lib/Support/APSInt.cpp\
llvm/lib/Support/Allocator.cpp\
llvm/lib/Support/CommandLine.cpp\
llvm/lib/Support/ConstantRange.cpp\
llvm/lib/Support/Debug.cpp\
llvm/lib/Support/Dwarf.cpp\
llvm/lib/Support/ErrorHandling.cpp\
llvm/lib/Support/FileUtilities.cpp\
llvm/lib/Support/FoldingSet.cpp\
llvm/lib/Support/FormattedStream.cpp\
llvm/lib/Support/GraphWriter.cpp\
llvm/lib/Support/IsInf.cpp\
llvm/lib/Support/IsNAN.cpp\
llvm/lib/Support/ManagedStatic.cpp\
llvm/lib/Support/MemoryBuffer.cpp\
llvm/lib/Support/PluginLoader.cpp\
llvm/lib/Support/PrettyStackTrace.cpp\
llvm/lib/Support/SlowOperationInformer.cpp\
llvm/lib/Support/SmallPtrSet.cpp\
llvm/lib/Support/SourceMgr.cpp\
llvm/lib/Support/Statistic.cpp\
llvm/lib/Support/StringExtras.cpp\
llvm/lib/Support/StringMap.cpp\
llvm/lib/Support/StringPool.cpp\
llvm/lib/Support/StringRef.cpp\
llvm/lib/Support/SystemUtils.cpp\
llvm/lib/Support/TargetRegistry.cpp\
llvm/lib/Support/Timer.cpp\
llvm/lib/Support/Triple.cpp\
llvm/lib/Support/Twine.cpp\
llvm/lib/Support/raw_os_ostream.cpp\
llvm/lib/Support/raw_ostream.cpp\
llvm/lib/Support/Regex.cpp\
llvm/lib/Support/regcomp.c\
llvm/lib/Support/regerror.c\
llvm/lib/Support/regexec.c\
llvm/lib/Support/regfree.c\
llvm/lib/Support/regstrlcpy.c
tblgen_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
tblgen_CXXFLAGS=$(LLVM_CXXFLAGS)
tblgen_LDADD=libllvmsupport.la libllvmsystem.la
#TODO: if VERSIONSCRIPT
tblgen_LDFLAGS= -Wl,--version-script,@top_srcdir@/llvm/autoconf/ExportMap.map
tblgen_SOURCES=\
llvm/utils/TableGen/AsmMatcherEmitter.cpp\
llvm/utils/TableGen/AsmWriterEmitter.cpp\
llvm/utils/TableGen/CallingConvEmitter.cpp\
llvm/utils/TableGen/ClangDiagnosticsEmitter.cpp\
llvm/utils/TableGen/CodeEmitterGen.cpp\
llvm/utils/TableGen/CodeGenDAGPatterns.cpp\
llvm/utils/TableGen/CodeGenInstruction.cpp\
llvm/utils/TableGen/CodeGenTarget.cpp\
llvm/utils/TableGen/DisassemblerEmitter.cpp\
llvm/utils/TableGen/DAGISelEmitter.cpp\
llvm/utils/TableGen/FastISelEmitter.cpp\
llvm/utils/TableGen/InstrEnumEmitter.cpp\
llvm/utils/TableGen/InstrInfoEmitter.cpp\
llvm/utils/TableGen/IntrinsicEmitter.cpp\
llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp\
llvm/utils/TableGen/OptParserEmitter.cpp\
llvm/utils/TableGen/Record.cpp\
llvm/utils/TableGen/RegisterInfoEmitter.cpp\
llvm/utils/TableGen/SubtargetEmitter.cpp\
llvm/utils/TableGen/TGLexer.cpp\
llvm/utils/TableGen/TGParser.cpp\
llvm/utils/TableGen/TGValueTypes.cpp\
llvm/utils/TableGen/TableGen.cpp\
llvm/utils/TableGen/TableGenBackend.cpp
libllvmcore_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmcore_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmcore_la_SOURCES=\
llvm/lib/VMCore/AsmWriter.cpp\
llvm/lib/VMCore/Attributes.cpp\
llvm/lib/VMCore/AutoUpgrade.cpp\
llvm/lib/VMCore/BasicBlock.cpp\
llvm/lib/VMCore/ConstantFold.cpp\
llvm/lib/VMCore/Constants.cpp\
llvm/lib/VMCore/Core.cpp\
llvm/lib/VMCore/Dominators.cpp\
llvm/lib/VMCore/Function.cpp\
llvm/lib/VMCore/Globals.cpp\
llvm/lib/VMCore/InlineAsm.cpp\
llvm/lib/VMCore/Instruction.cpp\
llvm/lib/VMCore/Instructions.cpp\
llvm/lib/VMCore/IntrinsicInst.cpp\
llvm/lib/VMCore/LLVMContext.cpp\
llvm/lib/VMCore/LeakDetector.cpp\
llvm/lib/VMCore/Mangler.cpp\
llvm/lib/VMCore/Metadata.cpp\
llvm/lib/VMCore/Module.cpp\
llvm/lib/VMCore/ModuleProvider.cpp\
llvm/lib/VMCore/Pass.cpp\
llvm/lib/VMCore/PassManager.cpp\
llvm/lib/VMCore/PrintModulePass.cpp\
llvm/lib/VMCore/Type.cpp\
llvm/lib/VMCore/TypeSymbolTable.cpp\
llvm/lib/VMCore/Use.cpp\
llvm/lib/VMCore/Value.cpp\
llvm/lib/VMCore/ValueSymbolTable.cpp\
llvm/lib/VMCore/ValueTypes.cpp\
llvm/lib/VMCore/Verifier.cpp
TBLGEN=$(top_builddir)/tblgen
TBLGEN_V=$(AM_V_GEN)$(TBLGEN)
TBLGEN_FLAGS=-I$(top_srcdir)/llvm/include -I$(top_srcdir)/llvm/lib/Target
BUILT_SOURCES=llvm/include/llvm/Intrinsics.gen
llvm/include/llvm/Intrinsics.gen: llvm/include/llvm/Intrinsics.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS) -gen-intrinsic -o $@ $<
# X86 Target
if BUILD_X86
TBLGEN_FLAGS_X86= $(TBLGEN_FLAGS) -I$(top_srcdir)/llvm/lib/Target/X86
X86GenRegisterInfo.h.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-register-desc-header -o $@ $<
X86GenRegisterNames.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-register-enums -o $@ $<
X86GenRegisterInfo.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-register-desc -o $@ $<
X86GenInstrNames.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-instr-enums -o $@ $<
X86GenInstrInfo.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-instr-desc -o $@ $<
X86GenAsmWriter.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-asm-writer -o $@ $<
X86GenAsmWriter1.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-asm-writer -asmwriternum=1 -o $@ $<
X86GenAsmMatcher.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-asm-matcher -o $@ $<
X86GenDAGISel.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-dag-isel -o $@ $<
X86GenFastISel.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-fast-isel -o $@ $<
X86GenCallingConv.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-callingconv -o $@ $<
X86GenSubtarget.inc: llvm/lib/Target/X86/X86.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_X86) -gen-subtarget -o $@ $<
libllvmtargetx86_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_builddir) -I$(top_srcdir)/llvm/lib/Target/X86
BUILT_SOURCES+=X86GenRegisterInfo.h.inc X86GenRegisterNames.inc X86GenRegisterInfo.inc X86GenInstrNames.inc X86GenInstrInfo.inc\
X86GenAsmWriter.inc X86GenAsmWriter1.inc X86GenAsmMatcher.inc X86GenDAGISel.inc X86GenFastISel.inc X86GenCallingConv.inc\
X86GenSubtarget.inc
libllvmtargetx86_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmtargetx86_la_SOURCES=\
llvm/lib/Target/X86/X86CodeEmitter.cpp\
llvm/lib/Target/X86/X86ELFWriterInfo.cpp\
llvm/lib/Target/X86/X86FloatingPoint.cpp\
llvm/lib/Target/X86/X86FloatingPointRegKill.cpp\
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp\
llvm/lib/Target/X86/X86ISelLowering.cpp\
llvm/lib/Target/X86/X86InstrInfo.cpp\
llvm/lib/Target/X86/X86JITInfo.cpp\
llvm/lib/Target/X86/X86MCAsmInfo.cpp\
llvm/lib/Target/X86/X86RegisterInfo.cpp\
llvm/lib/Target/X86/X86Subtarget.cpp\
llvm/lib/Target/X86/X86TargetMachine.cpp\
llvm/lib/Target/X86/X86FastISel.cpp\
llvm/lib/Target/X86/X86TargetObjectFile.cpp\
llvm/lib/Target/X86/TargetInfo/X86TargetInfo.cpp
endif
if BUILD_PPC
# PPC Target
TBLGEN_FLAGS_PPC= $(TBLGEN_FLAGS) -I$(top_srcdir)/llvm/lib/Target/PowerPC
PPCGenInstrNames.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-instr-enums -o $@ $<
PPCGenRegisterNames.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-register-enums -o $@ $<
PPCGenAsmWriter.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-asm-writer -o $@ $<
PPCGenCodeEmitter.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-emitter -o $@ $<
PPCRegisterInfo.h.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-register-desc-header -o $@ $<
PPCGenRegisterInfo.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-register-desc -o $@ $<
PPCGenRegisterInfo.h.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-register-desc-header -o $@ $<
PPCGenInstrInfo.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-instr-desc -o $@ $<
PPCGenDAGISel.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-dag-isel -o $@ $<
PPCGenCallingConv.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-callingconv -o $@ $<
PPCGenSubtarget.inc: llvm/lib/Target/PowerPC/PPC.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_PPC) -gen-subtarget -o $@ $<
libllvmtargetppc_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_builddir) -I$(top_srcdir)/llvm/lib/Target/PowerPC
BUILT_SOURCES += PPCGenInstrNames.inc PPCGenRegisterNames.inc PPCGenAsmWriter.inc PPCGenCodeEmitter.inc PPCGenRegisterInfo.h.inc PPCGenRegisterInfo.inc\
PPCGenInstrInfo.inc PPCGenDAGISel.inc PPCGenCallingConv.inc PPCGenSubtarget.inc
libllvmtargetppc_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmtargetppc_la_SOURCES=\
llvm/lib/Target/PowerPC/PPCBranchSelector.cpp\
llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp\
llvm/lib/Target/PowerPC/PPCHazardRecognizers.cpp\
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp\
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp\
llvm/lib/Target/PowerPC/PPCISelLowering.cpp\
llvm/lib/Target/PowerPC/PPCJITInfo.cpp\
llvm/lib/Target/PowerPC/PPCMachOWriterInfo.cpp\
llvm/lib/Target/PowerPC/PPCMCAsmInfo.cpp\
llvm/lib/Target/PowerPC/PPCPredicates.cpp\
llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp\
llvm/lib/Target/PowerPC/PPCSubtarget.cpp\
llvm/lib/Target/PowerPC/PPCTargetMachine.cpp\
llvm/lib/Target/PowerPC/TargetInfo/PowerPCTargetInfo.cpp
endif
if BUILD_ARM
# ARM Target
TBLGEN_FLAGS_ARM= $(TBLGEN_FLAGS) -I$(top_srcdir)/llvm/lib/Target/ARM
ARMGenRegisterInfo.h.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-register-desc-header -o $@ $<
ARMGenRegisterNames.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-register-enums -o $@ $<
ARMGenRegisterInfo.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-register-desc -o $@ $<
ARMGenInstrNames.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-instr-enums -o $@ $<
ARMGenInstrInfo.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-instr-desc -o $@ $<
ARMGenCodeEmitter.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-emitter -o $@ $<
ARMGenAsmWriter.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-asm-writer -o $@ $<
ARMGenDAGISel.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-dag-isel -o $@ $<
ARMGenCallingConv.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-callingconv -o $@ $<
ARMGenSubtarget.inc: llvm/lib/Target/ARM/ARM.td $(TBLGEN)
$(TBLGEN_V) $(TBLGEN_FLAGS_ARM) -gen-subtarget -o $@ $<
libllvmtargetarm_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_builddir) -I$(top_srcdir)/llvm/lib/Target/ARM
BUILT_SOURCES += ARMGenRegisterInfo.h.inc ARMGenRegisterNames.inc ARMGenRegisterInfo.inc ARMGenInstrNames.inc ARMGenInstrInfo.inc ARMGenCodeEmitter.inc\
ARMGenAsmWriter.inc ARMGenDAGISel.inc ARMGenCallingConv.inc ARMGenSubtarget.inc
libllvmtargetarm_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmtargetarm_la_SOURCES=\
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp\
llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp\
llvm/lib/Target/ARM/ARMCodeEmitter.cpp\
llvm/lib/Target/ARM/ARMConstantIslandPass.cpp\
llvm/lib/Target/ARM/ARMConstantPoolValue.cpp\
llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp\
llvm/lib/Target/ARM/ARMInstrInfo.cpp\
llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp\
llvm/lib/Target/ARM/ARMISelLowering.cpp\
llvm/lib/Target/ARM/ARMJITInfo.cpp\
llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp\
llvm/lib/Target/ARM/ARMMCAsmInfo.cpp\
llvm/lib/Target/ARM/ARMRegisterInfo.cpp\
llvm/lib/Target/ARM/ARMSubtarget.cpp\
llvm/lib/Target/ARM/ARMTargetMachine.cpp\
llvm/lib/Target/ARM/NEONMoveFix.cpp\
llvm/lib/Target/ARM/NEONPreAllocPass.cpp\
llvm/lib/Target/ARM/Thumb1InstrInfo.cpp\
llvm/lib/Target/ARM/Thumb1RegisterInfo.cpp\
llvm/lib/Target/ARM/Thumb2ITBlockPass.cpp\
llvm/lib/Target/ARM/Thumb2InstrInfo.cpp\
llvm/lib/Target/ARM/Thumb2RegisterInfo.cpp\
llvm/lib/Target/ARM/Thumb2SizeReduction.cpp\
llvm/lib/Target/ARM/TargetInfo/ARMTargetInfo.cpp
endif
# End of Targets
libllvmtarget_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmtarget_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmtarget_la_SOURCES=\
llvm/lib/Target/SubtargetFeature.cpp\
llvm/lib/Target/Target.cpp\
llvm/lib/Target/TargetData.cpp\
llvm/lib/Target/TargetELFWriterInfo.cpp\
llvm/lib/Target/TargetFrameInfo.cpp\
llvm/lib/Target/TargetInstrInfo.cpp\
llvm/lib/Target/TargetIntrinsicInfo.cpp\
llvm/lib/Target/TargetLoweringObjectFile.cpp\
llvm/lib/Target/TargetMachOWriterInfo.cpp\
llvm/lib/Target/TargetMachine.cpp\
llvm/lib/Target/TargetRegisterInfo.cpp\
llvm/lib/Target/TargetSubtarget.cpp
libllvmmc_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmmc_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmmc_la_SOURCES=\
llvm/lib/MC/MCAsmInfo.cpp\
llvm/lib/MC/MCAsmInfoCOFF.cpp\
llvm/lib/MC/MCAsmInfoDarwin.cpp\
llvm/lib/MC/MCAsmLexer.cpp\
llvm/lib/MC/MCAsmParser.cpp\
llvm/lib/MC/MCAsmStreamer.cpp\
llvm/lib/MC/MCAssembler.cpp\
llvm/lib/MC/MCCodeEmitter.cpp\
llvm/lib/MC/MCContext.cpp\
llvm/lib/MC/MCExpr.cpp\
llvm/lib/MC/MCInst.cpp\
llvm/lib/MC/MCMachOStreamer.cpp\
llvm/lib/MC/MCNullStreamer.cpp\
llvm/lib/MC/MCSection.cpp\
llvm/lib/MC/MCSectionELF.cpp\
llvm/lib/MC/MCSectionMachO.cpp\
llvm/lib/MC/MCStreamer.cpp\
llvm/lib/MC/MCSymbol.cpp\
llvm/lib/MC/MCValue.cpp\
llvm/lib/MC/TargetAsmParser.cpp
libllvmsdag_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmsdag_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmsdag_la_SOURCES=\
llvm/lib/CodeGen/SelectionDAG/CallingConvLower.cpp\
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp\
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp\
llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp\
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp\
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp\
llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp\
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp\
llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp\
llvm/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp\
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp\
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp\
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp\
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp\
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp\
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp\
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp\
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp\
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp\
llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp\
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp\
llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp\
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp\
llvm/lib/CodeGen/AsmPrinter/DwarfException.cpp\
llvm/lib/CodeGen/AsmPrinter/DwarfLabel.cpp\
llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp\
llvm/lib/CodeGen/AsmPrinter/DIE.cpp\
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
libllvmipa_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmipa_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmipa_la_SOURCES=\
llvm/lib/Analysis/AliasAnalysis.cpp\
llvm/lib/Analysis/AliasSetTracker.cpp\
llvm/lib/Analysis/BasicAliasAnalysis.cpp\
llvm/lib/Analysis/CaptureTracking.cpp\
llvm/lib/Analysis/ConstantFolding.cpp\
llvm/lib/Analysis/DebugInfo.cpp\
llvm/lib/Analysis/IVUsers.cpp\
llvm/lib/Analysis/InstructionSimplify.cpp\
llvm/lib/Analysis/LiveValues.cpp\
llvm/lib/Analysis/LoopDependenceAnalysis.cpp\
llvm/lib/Analysis/LoopInfo.cpp\
llvm/lib/Analysis/LoopPass.cpp\
llvm/lib/Analysis/MemoryBuiltins.cpp\
llvm/lib/Analysis/MemoryDependenceAnalysis.cpp\
llvm/lib/Analysis/ProfileInfo.cpp\
llvm/lib/Analysis/ScalarEvolution.cpp\
llvm/lib/Analysis/ScalarEvolutionExpander.cpp\
llvm/lib/Analysis/ValueTracking.cpp\
llvm/lib/Analysis/IPA/CallGraph.cpp
libllvmcodegen_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmcodegen_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmcodegen_la_SOURCES=\
llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp\
llvm/lib/CodeGen/BranchFolding.cpp\
llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp\
llvm/lib/CodeGen/CodePlacementOpt.cpp\
llvm/lib/CodeGen/DeadMachineInstructionElim.cpp\
llvm/lib/CodeGen/DwarfEHPrepare.cpp\
llvm/lib/CodeGen/ELFCodeEmitter.cpp\
llvm/lib/CodeGen/ELFWriter.cpp\
llvm/lib/CodeGen/ExactHazardRecognizer.cpp\
llvm/lib/CodeGen/GCMetadata.cpp\
llvm/lib/CodeGen/GCMetadataPrinter.cpp\
llvm/lib/CodeGen/GCStrategy.cpp\
llvm/lib/CodeGen/IfConversion.cpp\
llvm/lib/CodeGen/IntrinsicLowering.cpp\
llvm/lib/CodeGen/LLVMTargetMachine.cpp\
llvm/lib/CodeGen/LatencyPriorityQueue.cpp\
llvm/lib/CodeGen/LiveInterval.cpp\
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp\
llvm/lib/CodeGen/LiveStackAnalysis.cpp\
llvm/lib/CodeGen/LiveVariables.cpp\
llvm/lib/CodeGen/LowerSubregs.cpp\
llvm/lib/CodeGen/MachineBasicBlock.cpp\
llvm/lib/CodeGen/MachineDominators.cpp\
llvm/lib/CodeGen/MachineFunction.cpp\
llvm/lib/CodeGen/MachineFunctionAnalysis.cpp\
llvm/lib/CodeGen/MachineFunctionPass.cpp\
llvm/lib/CodeGen/MachineInstr.cpp\
llvm/lib/CodeGen/MachineLICM.cpp\
llvm/lib/CodeGen/MachineLoopInfo.cpp\
llvm/lib/CodeGen/MachineModuleInfo.cpp\
llvm/lib/CodeGen/MachineModuleInfoImpls.cpp\
llvm/lib/CodeGen/MachinePassRegistry.cpp\
llvm/lib/CodeGen/MachineRegisterInfo.cpp\
llvm/lib/CodeGen/MachineSink.cpp\
llvm/lib/CodeGen/MachineVerifier.cpp\
llvm/lib/CodeGen/ObjectCodeEmitter.cpp\
llvm/lib/CodeGen/OcamlGC.cpp\
llvm/lib/CodeGen/PHIElimination.cpp\
llvm/lib/CodeGen/Passes.cpp\
llvm/lib/CodeGen/PostRASchedulerList.cpp\
llvm/lib/CodeGen/PreAllocSplitting.cpp\
llvm/lib/CodeGen/ProcessImplicitDefs.cpp\
llvm/lib/CodeGen/PrologEpilogInserter.cpp\
llvm/lib/CodeGen/PseudoSourceValue.cpp\
llvm/lib/CodeGen/RegAllocLinearScan.cpp\
llvm/lib/CodeGen/RegAllocLocal.cpp\
llvm/lib/CodeGen/RegAllocPBQP.cpp\
llvm/lib/CodeGen/RegisterCoalescer.cpp\
llvm/lib/CodeGen/RegisterScavenging.cpp\
llvm/lib/CodeGen/ScheduleDAG.cpp\
llvm/lib/CodeGen/ScheduleDAGEmit.cpp\
llvm/lib/CodeGen/ScheduleDAGInstrs.cpp\
llvm/lib/CodeGen/ScheduleDAGPrinter.cpp\
llvm/lib/CodeGen/ShadowStackGC.cpp\
llvm/lib/CodeGen/ShrinkWrapping.cpp\
llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp\
llvm/lib/CodeGen/SjLjEHPrepare.cpp\
llvm/lib/CodeGen/SlotIndexes.cpp\
llvm/lib/CodeGen/Spiller.cpp\
llvm/lib/CodeGen/StackProtector.cpp\
llvm/lib/CodeGen/StackSlotColoring.cpp\
llvm/lib/CodeGen/StrongPHIElimination.cpp\
llvm/lib/CodeGen/TailDuplication.cpp\
llvm/lib/CodeGen/TargetInstrInfoImpl.cpp\
llvm/lib/CodeGen/TwoAddressInstructionPass.cpp\
llvm/lib/CodeGen/UnreachableBlockElim.cpp\
llvm/lib/CodeGen/VirtRegMap.cpp\
llvm/lib/CodeGen/VirtRegRewriter.cpp
libllvmscalar_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmscalar_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmscalar_la_SOURCES=\
llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp\
llvm/lib/Transforms/Scalar/DCE.cpp\
llvm/lib/Transforms/Scalar/GEPSplitter.cpp\
llvm/lib/Transforms/Scalar/GVN.cpp\
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp\
llvm/lib/Transforms/Scalar/ConstantProp.cpp\
llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
libllvmtransformutils_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmtransformutils_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmtransformutils_la_SOURCES=\
llvm/lib/Transforms/Utils/AddrModeMatcher.cpp\
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp\
llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp\
llvm/lib/Transforms/Utils/DemoteRegToStack.cpp\
llvm/lib/Transforms/Utils/LCSSA.cpp\
llvm/lib/Transforms/Utils/Local.cpp\
llvm/lib/Transforms/Utils/LoopSimplify.cpp\
llvm/lib/Transforms/Utils/LowerInvoke.cpp\
llvm/lib/Transforms/Utils/LowerSwitch.cpp\
llvm/lib/Transforms/Utils/Mem2Reg.cpp\
llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp\
llvm/lib/Transforms/Utils/SimplifyCFG.cpp\
llvm/lib/Transforms/Utils/SSAUpdater.cpp\
llvm/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
libllvmexecutionengine_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmexecutionengine_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmexecutionengine_la_SOURCES=\
llvm/lib/ExecutionEngine/ExecutionEngine.cpp\
llvm/lib/ExecutionEngine/JIT/Intercept.cpp\
llvm/lib/ExecutionEngine/JIT/JIT.cpp\
llvm/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp\
llvm/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp\
llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp\
llvm/lib/ExecutionEngine/JIT/JITMemoryManager.cpp\
llvm/lib/ExecutionEngine/JIT/TargetSelect.cpp
# llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
# Used only by make check
libllvmbitreader_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmbitreader_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmbitreader_la_SOURCES=\
llvm/lib/Bitcode/Reader/BitReader.cpp\
llvm/lib/Bitcode/Reader/BitcodeReader.cpp\
llvm/lib/Bitcode/Reader/Deserialize.cpp\
llvm/lib/Bitcode/Reader/DeserializeAPFloat.cpp\
llvm/lib/Bitcode/Reader/DeserializeAPInt.cpp
libllvmbitwriter_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmbitwriter_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmbitwriter_la_SOURCES=\
llvm/lib/Bitcode/Writer/BitWriter.cpp\
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp\
llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp\
llvm/lib/Bitcode/Writer/Serialize.cpp\
llvm/lib/Bitcode/Writer/SerializeAPFloat.cpp\
llvm/lib/Bitcode/Writer/SerializeAPInt.cpp\
llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
libllvmasmparser_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
libllvmasmparser_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmasmparser_la_SOURCES=\
llvm/lib/AsmParser/LLLexer.cpp\
llvm/lib/AsmParser/LLParser.cpp\
llvm/lib/AsmParser/Parser.cpp
libllvminterpreter_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/utils/unittest/googletest/include
libllvminterpreter_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions -Wno-missing-field-initializers -Wno-variadic-macros
libllvminterpreter_la_SOURCES=\
llvm/lib/ExecutionEngine/Interpreter/Execution.cpp\
llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp\
llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
libgoogletest_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/utils/unittest/googletest/include
libgoogletest_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions -Wno-missing-field-initializers -Wno-variadic-macros
libgoogletest_la_SOURCES=\
llvm/utils/unittest/googletest/gtest-death-test.cc\
llvm/utils/unittest/googletest/gtest-filepath.cc\
llvm/utils/unittest/googletest/gtest-port.cc\
llvm/utils/unittest/googletest/gtest-test-part.cc\
llvm/utils/unittest/googletest/gtest-typed-test.cc\
llvm/utils/unittest/googletest/gtest.cc\
llvm/utils/unittest/UnitTestMain/TestMain.cpp
llvmunittest_ADT_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/utils/unittest/googletest/include
llvmunittest_ADT_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions -Wno-variadic-macros
llvmunittest_ADT_LDADD=libgoogletest.la libllvmcore.la libllvmsupport.la libllvmsystem.la
llvmunittest_ADT_SOURCES=\
llvm/unittests/ADT/APFloatTest.cpp\
llvm/unittests/ADT/APIntTest.cpp\
llvm/unittests/ADT/DenseMapTest.cpp\
llvm/unittests/ADT/DenseSetTest.cpp\
llvm/unittests/ADT/ImmutableSetTest.cpp\
llvm/unittests/ADT/SmallStringTest.cpp\
llvm/unittests/ADT/SmallVectorTest.cpp\
llvm/unittests/ADT/SparseBitVectorTest.cpp\
llvm/unittests/ADT/StringMapTest.cpp\
llvm/unittests/ADT/StringRefTest.cpp\
llvm/unittests/ADT/TripleTest.cpp\
llvm/unittests/ADT/TwineTest.cpp
llvmunittest_Support_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/utils/unittest/googletest/include
llvmunittest_Support_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions -Wno-variadic-macros
llvmunittest_Support_LDADD=libgoogletest.la libllvmcore.la libllvmsupport.la libllvmsystem.la
llvmunittest_Support_SOURCES=\
llvm/unittests/Support/AllocatorTest.cpp\
llvm/unittests/Support/ConstantRangeTest.cpp\
llvm/unittests/Support/MathExtrasTest.cpp\
llvm/unittests/Support/RegexTest.cpp\
llvm/unittests/Support/TypeBuilderTest.cpp\
llvm/unittests/Support/ValueHandleTest.cpp\
llvm/unittests/Support/raw_ostream_test.cpp
llvmunittest_VMCore_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/utils/unittest/googletest/include
llvmunittest_VMCore_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions -Wno-variadic-macros
llvmunittest_VMCore_LDADD=libgoogletest.la libllvmtarget.la libllvmipa.la libllvmcore.la libllvmsupport.la libllvmsystem.la
llvmunittest_VMCore_SOURCES=\
llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp\
llvm/unittests/VMCore/ConstantsTest.cpp\
llvm/unittests/VMCore/MetadataTest.cpp\
llvm/unittests/VMCore/PassManagerTest.cpp
llvmunittest_JIT_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/utils/unittest/googletest/include
llvmunittest_JIT_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions -Wno-variadic-macros
llvmunittest_JIT_LDADD=libgoogletest.la libllvmasmparser.la $(libclamavcxx_la_LIBADD)
llvmunittest_JIT_SOURCES=\
llvm/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp\
llvm/unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp\
llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
llvmunittest_ExecutionEngine_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/utils/unittest/googletest/include
llvmunittest_ExecutionEngine_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions -Wno-variadic-macros
llvmunittest_ExecutionEngine_LDADD=libgoogletest.la libllvminterpreter.la $(libclamavcxx_la_LIBADD)
llvmunittest_ExecutionEngine_SOURCES=\
llvm/unittests/ExecutionEngine/ExecutionEngineTest.cpp
count_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
count_SOURCES=llvm/utils/count/count.c
count_LDADD=libllvmsystem.la
not_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
not_CXXFLAGS=$(LLVM_CXXFLAGS)
not_SOURCES=llvm/utils/not/not.cpp
not_LDADD=libllvmsystem.la
FileCheck_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
FileCheck_CXXFLAGS=$(LLVM_CXXFLAGS)
FileCheck_LDADD=libllvmsupport.la libllvmsystem.la
FileCheck_SOURCES=llvm/utils/FileCheck/FileCheck.cpp
check_LTLIBRARIES=libllvmbitreader.la libllvmasmprinter.la libllvmbitwriter.la libllvmasmparser.la libgoogletest.la libllvminterpreter.la
check_PROGRAMS=count not lli llc llvm-as llvm-dis llvmunittest_ADT llvmunittest_Support llvmunittest_VMCore llvmunittest_ExecutionEngine llvmunittest_JIT FileCheck
# Disable LLVM make check for now, there are some things to fix first:
# - check python version (2.4 doesn't work, needs 2.5+)
# - run llvm's make check after clamav's was run
# - have a way to run only clamav's make check and not llvm's
#check_SCRIPTS=llvmdejagnu.sh
TESTS_ENVIRONMENT=export GMAKE=@GMAKE@;
TESTS=llvmunittest_ADT llvmunittest_Support llvmunittest_VMCore llvmunittest_ExecutionEngine llvmunittest_JIT
@ifGNUmake@ TESTS+=llvmdejagnu.sh
libllvmasmprinter_la_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS) -I$(top_srcdir)/llvm/lib/Target/X86 \
-I$(top_srcdir)/llvm/lib/Target/PowerPC -I$(top_srcdir)/llvm/lib/Target/ARM
libllvmasmprinter_la_CXXFLAGS=$(LLVM_CXXFLAGS) -fno-exceptions
libllvmasmprinter_la_SOURCES=\
llvm/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp\
llvm/lib/CodeGen/ELFCodeEmitter.cpp\
llvm/lib/CodeGen/ELFWriter.cpp\
llvm/lib/CodeGen/MachOCodeEmitter.cpp\
llvm/lib/CodeGen/MachOWriter.cpp
if BUILD_X86
libllvmasmprinter_la_SOURCES+=llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp\
llvm/lib/Target/X86/AsmPrinter/X86ATTInstPrinter.cpp\
llvm/lib/Target/X86/AsmPrinter/X86IntelInstPrinter.cpp\
llvm/lib/Target/X86/AsmPrinter/X86AsmPrinter.cpp\
llvm/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp\
llvm/lib/Target/X86/X86COFFMachineModuleInfo.cpp
endif
if BUILD_PPC
libllvmasmprinter_la_SOURCES+= llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
endif
if BUILD_ARM
libllvmasmprinter_la_SOURCES+= llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp \
llvm/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp\
llvm/lib/Target/ARM/AsmPrinter/ARMMCInstLower.cpp
endif
lli_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
lli_CXXFLAGS=$(LLVM_CXXFLAGS)
lli_LDADD=libllvmbitreader.la libllvminterpreter.la $(libclamavcxx_la_LIBADD)
lli_SOURCES=\
llvm/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp\
llvm/tools/lli/lli.cpp
llc_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
llc_CXXFLAGS=$(LLVM_CXXFLAGS)
llc_LDADD=libllvmbitreader.la libllvmasmparser.la libllvmasmprinter.la $(libclamavcxx_la_LIBADD)
llc_SOURCES=\
llvm/lib/MC/MCInstPrinter.cpp\
llvm/tools/llc/llc.cpp
llvm_as_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
llvm_as_CXXFLAGS=$(LLVM_CXXFLAGS)
llvm_as_LDADD=libllvmasmparser.la libllvmbitwriter.la libllvmcore.la libllvmsupport.la libllvmsystem.la
llvm_as_SOURCES=\
llvm/tools/llvm-as/llvm-as.cpp
llvm_dis_CPPFLAGS=$(LLVM_INCLUDES) $(LLVM_DEFS)
llvm_dis_CXXFLAGS=$(LLVM_CXXFLAGS)
llvm_dis_LDADD=libllvmasmparser.la libllvmbitreader.la libllvmcore.la libllvmsupport.la libllvmsystem.la
llvm_dis_SOURCES=\
llvm/tools/llvm-dis/llvm-dis.cpp
noinst_PROGRAMS = tblgen
#bytecode2llvm.cpp: build-llvm
build-llvm:
+$(GMAKE) -C llvm OPTIMIZE_OPTION=-O2 libs-only
build-llvm-for-check:
+$(GMAKE) -C llvm OPTIMIZE_OPTION=-O2 tools-only
# Don't use make -C here, otherwise there's a racecondition between distclean
# and clean (distclean removes all Makefiles in llvm/)
clean-local:
rm -rf `find llvm/test -name Output -type d -print`
rm -rf llvm/Release llvm/Debug
rm -f *.inc
rm -f llvm/include/llvm/Intrinsics.gen
rm -f llvm/test/site.exp llvm/test/site.bak llvm/test/*.out llvm/test/*.sum llvm/test/*.log
distclean-local:
rm -f llvm/lib/Makefile llvm/docs/doxygen.cfg llvm/test/Unit/.dir llvm/test/Unit/lit.site.cfg
rm -f llvm/test/Makefile llvm/test/lit.site.cfg llvm/test/Makefile.tests llvm/Makefile llvm/config.status
rm -f llvm/mklib llvm/tools/Makefile llvm/tools/llvmc/llvm-config.in llvm/utils/Makefile
rm -f llvm/Makefile.common llvm/Makefile.config llvm/config.log llvm/unittests/Makefile
rm -f llvm/llvm.spec llvm/include/llvm/Config/AsmPrinters.def llvm/include/llvm/Config/config.h
rm -f llvm/include/llvm/Support/DataTypes.h llvm/include/llvm/Config/Targets.def
rm -f llvm/tools/llvmc/plugins/Base/Base.td llvm/tools/llvm-config/llvm-config.in
rm -f llvm/include/llvm/Config/AsmParsers.def
check-llvm: build-llvm-for-check
+$(GMAKE) -C llvm check
+$(GMAKE) -C llvm unittests
CONFIG_STATUS_DEPENDENCIES = $(top_builddir)/llvm/config.status
# config.status needs to be run twice, once without recheck so that it has a
# chance to create configure generated files.
$(top_builddir)/llvm/config.status: llvm/configure
cd llvm; ./config.status --recheck; ./config.status
# rm configure generated files
dist-hook:
make -C llvm dist-hook
rm -f $(distdir)/llvm/include/llvm/Config/*.h $(distdir)/llvm/include/llvm/Config/*.def $(distdir)/llvm/Makefile.config $(distdir)/llvm/llvm.spec
rm -f $(distdir)/llvm/docs/doxygen.cfg $(distdir)/llvm/tools/llvmc/plugins/Base/Base.td $(distdir)/llvm/tools/llvm-config/llvm-config.in
rm -f $(distdir)/llvm/include/llvm/Intrinsics.gen
rm -f $(distdir)/llvm/include/llvm/Support/DataTypes.h $(distdir)/llvm/config.log $(distdir)/llvm/config.status

6684
libclamav/c++/Makefile.in Normal file

File diff suppressed because it is too large Load diff

15
libclamav/c++/TODO.CLAMAV Normal file
View file

@ -0,0 +1,15 @@
Convert to clamav's build system -> impl. cross-compilation support (tblgen)
Right now static linking of libclamav doesn't work with llvm parts for a number
of reasons:
1. llvm is not built with libtool, and it builds .a files (or .so files)
2. if I link with .a files, that works for a .so (LLVM's .a files are PIC), but
the created libclamav.a will miss the .a files, so I'd need to install the llvm
.a files together with clamav's
3. libtool solves this by putting individual .o files into the target libtool .a
archive, but since I link against non-libtool archives it doesn't know how to do
that
4. if I link against a .so then obviously it is not static linking
If llvm would be converted to clamav's buildsystem then static linking of
libclamav would work.

1041
libclamav/c++/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,56 @@
/* clamavcxx-config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

1533
libclamav/c++/config/config.guess vendored Executable file

File diff suppressed because it is too large Load diff

1693
libclamav/c++/config/config.sub vendored Executable file

File diff suppressed because it is too large Load diff

630
libclamav/c++/config/depcomp Executable file
View file

@ -0,0 +1,630 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program 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. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

520
libclamav/c++/config/install-sh Executable file
View file

@ -0,0 +1,520 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

8413
libclamav/c++/config/ltmain.sh Executable file

File diff suppressed because it is too large Load diff

376
libclamav/c++/config/missing Executable file
View file

@ -0,0 +1,376 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program 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. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

17327
libclamav/c++/configure vendored Executable file

File diff suppressed because it is too large Load diff

137
libclamav/c++/configure.ac Normal file
View file

@ -0,0 +1,137 @@
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_SRCDIR([llvm/configure])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([clamavcxx-config.h])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.9 -Wall -Wportability -Werror foreign no-define color-tests tar-pax])
AM_SILENT_RULES([yes])
cxxset=${CXXFLAGS+set}
AC_PROG_CXX
if test "$cxxset" != set; then
# don't use the default -O2 -g because -g bloats the C++ binaries too much
CXXFLAGS="-O2"
fi
AM_MAINTAINER_MODE
LT_INIT([disable-static])
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])
AC_CONFIG_SUBDIRS([llvm])
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)
AM_CONDITIONAL(DEBUG_BUILD,[test "x$enable_optimized" == "xno"])
dnl Set configure args for subdir
if test "$enable_optimized" = "default"; then
ac_configure_args="$ac_configure_args --enable-optimized"
fi
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"
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
new_args="$ac_configure_args --enable-targets=x86,powerpc,arm --enable-bindings=none --enable-libffi=no --without-llvmgcc --without-llvmgxx"
else
new_args="$ac_configure_args --enable-targets=host-only --enable-bindings=none --enable-libffi=no --without-llvmgcc --without-llvmgxx"
fi
echo "$new_args"
ac_configure_args=`echo $new_args | sed -e 's/-Werror //g'`
echo "$ac_configure_args"
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.
AC_MSG_CHECKING([for supported C++ compiler version])
gxx_version=`${CXX} -dumpversion` ||
AC_MSG_ERROR([Unable to get GNU C++ compiler version])
case "${gxx_version}" in
[[012]].*|3.[[0123]].*)
AC_MSG_ERROR([C++ compiler too old (${gxx_version})])
;;
3.4.[[012]]*|4.0.1*|4.1.[[12]]*)
AC_MSG_ERROR([C++ compiler is buggy])
;;
*)
AC_MSG_RESULT([ok (${gxx_version})])
esac
AC_MSG_CHECKING([for supported OS])
case "$target_cpu" in
i?86|amd64|x86_64|powerpc*)
case "$target_os" in
darwin*|freebsd*|openbsd*|netbsd*|dragonfly*|linux*|solaris*|win32*|mingw*)
AC_MSG_RESULT([ok ($target_cpu-$target_os)])
;;
*)
AC_MSG_ERROR([OS $target_os is not supported, not building LLVM])
;;
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
build_x86=no
build_ppc=no
build_arm=no
case "$target_cpu" in
i?86|amd64|x86_64)
build_x86=yes
;;
powerpc*)
build_ppc=yes
;;
arm*)
build_arm=yes
;;
esac
if test "$enable_alltargets" = "yes"; then
build_x86=yes
build_ppc=yes
build_arm=yes
fi
AM_CONDITIONAL(BUILD_X86, [test "$build_x86" = "yes"])
AM_CONDITIONAL(BUILD_PPC, [test "$build_ppc" = "yes"])
AM_CONDITIONAL(BUILD_ARM, [test "$build_arm" = "yes"])
AC_OUTPUT([
Makefile
])

View file

@ -0,0 +1,361 @@
# See docs/CMake.html for instructions about how to build LLVM with CMake.
project(LLVM)
cmake_minimum_required(VERSION 2.6.1)
set(PACKAGE_NAME llvm)
set(PACKAGE_VERSION 2.7svn)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
message(FATAL_ERROR "In-source builds are not allowed.
CMake would overwrite the makefiles distributed with LLVM.
Please create a directory and run cmake from there, passing the path
to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them.")
endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
file(GLOB_RECURSE
tablegenned_files_on_include_dir
"${LLVM_MAIN_SRC_DIR}/include/llvm/*.gen")
file(GLOB_RECURSE
tablegenned_files_on_lib_dir
"${LLVM_MAIN_SRC_DIR}/lib/Target/*.inc")
if( tablegenned_files_on_include_dir OR tablegenned_files_on_lib_dir)
message(FATAL_ERROR "Apparently there is a previous in-source build,
probably as the result of running `configure' and `make' on
${LLVM_MAIN_SRC_DIR}.
This may cause problems. The suspicious files are:
${tablegenned_files_on_lib_dir}
${tablegenned_files_on_include_dir}
Please clean the source directory.")
endif()
endif()
set(LLVM_ALL_TARGETS
Alpha
ARM
Blackfin
CBackend
CellSPU
CppBackend
Mips
MSIL
MSP430
PIC16
PowerPC
Sparc
SystemZ
X86
XCore
)
if( MSVC )
set(LLVM_TARGETS_TO_BUILD X86
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
else( MSVC )
set(LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS}
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
endif( MSVC )
set(C_INCLUDE_DIRS "" CACHE STRING
"Colon separated list of directories clang will search for headers.")
set(LLVM_TARGET_ARCH "host"
CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.")
option(LLVM_ENABLE_THREADS "Use threads if available." ON)
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
else()
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
endif()
if( LLVM_ENABLE_ASSERTIONS )
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if( NOT MSVC )
add_definitions( -D_DEBUG )
endif()
# On Release builds cmake automatically defines NDEBUG, so we
# explicitly undefine it:
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
add_definitions( -UNDEBUG )
endif()
else()
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
add_definitions( -DNDEBUG )
endif()
endif()
if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
endif()
set(LLVM_ENUM_TARGETS "")
foreach(c ${LLVM_TARGETS_TO_BUILD})
list(FIND LLVM_ALL_TARGETS ${c} idx)
if( idx LESS 0 )
message(FATAL_ERROR "The target `${c}' does not exist.
It should be one of\n${LLVM_ALL_TARGETS}")
else()
set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${c})\n")
endif()
endforeach(c)
# Produce llvm/Config/Targets.def
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/Targets.def
)
set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${LLVM_MAIN_SRC_DIR}/cmake"
"${LLVM_MAIN_SRC_DIR}/cmake/modules"
)
include(AddLLVMDefinitions)
if(WIN32)
if(CYGWIN)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
else(CYGWIN)
set(LLVM_ON_WIN32 1)
set(LLVM_ON_UNIX 0)
endif(CYGWIN)
set(LTDL_SHLIB_EXT ".dll")
set(EXEEXT ".exe")
# Maximum path length is 160 for non-unicode paths
set(MAXPATHLEN 160)
else(WIN32)
if(UNIX)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
if(APPLE)
set(LTDL_SHLIB_EXT ".dylib")
else(APPLE)
set(LTDL_SHLIB_EXT ".so")
endif(APPLE)
set(EXEEXT "")
# FIXME: Maximum path length is currently set to 'safe' fixed value
set(MAXPATHLEN 2024)
else(UNIX)
MESSAGE(SEND_ERROR "Unable to determine platform")
endif(UNIX)
endif(WIN32)
include(config-ix)
option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
set(ENABLE_PIC 0)
if( LLVM_ENABLE_PIC )
if( XCODE )
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
# know how to disable this, so just force ENABLE_PIC off for now.
message(STATUS "Warning: -fPIC not supported with Xcode.")
else( XCODE )
if( SUPPORTS_FPIC_FLAG )
message(STATUS "Building with -fPIC")
add_llvm_definitions(-fPIC)
set(ENABLE_PIC 1)
else( SUPPORTS_FPIC_FLAG )
message(STATUS "Warning: -fPIC not supported.")
endif()
endif()
endif()
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
# set(CMAKE_VERBOSE_MAKEFILE true)
add_llvm_definitions( -D__STDC_LIMIT_MACROS )
add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
# TODO: support other platforms and toolchains.
option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
if( LLVM_BUILD_32_BITS )
message(STATUS "Building 32 bits executables and libraries.")
add_llvm_definitions( -m32 )
list(APPEND CMAKE_EXE_LINKER_FLAGS -m32)
list(APPEND CMAKE_SHARED_LINKER_FLAGS -m32)
endif( LLVM_BUILD_32_BITS )
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
if( MSVC )
# List of valid CRTs for MSVC
set(MSVC_CRT
MD
MDd)
set(LLVM_USE_CRT "" CACHE STRING "Specify VC++ CRT to use for debug/release configurations.")
add_llvm_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
add_llvm_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
add_llvm_definitions( -D_SCL_SECURE_NO_DEPRECATE )
add_llvm_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 )
add_llvm_definitions( -wd4355 -wd4715 -wd4180 -wd4345 -wd4224 )
# Suppress 'new behavior: elements of array 'array' will be default initialized'
add_llvm_definitions( -wd4351 )
if (NOT ${LLVM_USE_CRT} STREQUAL "")
list(FIND MSVC_CRT ${LLVM_USE_CRT} idx)
if (idx LESS 0)
message(FATAL_ERROR "Invalid value for LLVM_USE_CRT: ${LLVM_USE_CRT}. Valid options are one of: ${MSVC_CRT}")
endif (idx LESS 0)
add_llvm_definitions("/${LLVM_USE_CRT}")
message(STATUS "Using VC++ CRT: ${LLVM_USE_CRT}")
endif (NOT ${LLVM_USE_CRT} STREQUAL "")
endif( MSVC )
include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-include llvm/System/Solaris.h")
endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
include(AddLLVM)
include(TableGen)
add_subdirectory(lib/Support)
add_subdirectory(lib/System)
# Everything else depends on Support and System:
set(LLVM_COMMON_DEPENDS ${LLVM_COMMON_DEPENDS} ${LLVM_LIBS} )
set(LLVM_TABLEGEN "tblgen" CACHE
STRING "Native TableGen executable. Saves building one when cross-compiling.")
# Effective tblgen executable to be used:
set(LLVM_TABLEGEN_EXE ${LLVM_TABLEGEN})
add_subdirectory(utils/TableGen)
if( CMAKE_CROSSCOMPILING )
# This adds a dependency on target `tblgen', so must go after utils/TableGen
include( CrossCompileLLVM )
endif( CMAKE_CROSSCOMPILING )
add_subdirectory(include/llvm)
add_subdirectory(lib/VMCore)
add_subdirectory(lib/CodeGen)
add_subdirectory(lib/CodeGen/SelectionDAG)
add_subdirectory(lib/CodeGen/AsmPrinter)
add_subdirectory(lib/Bitcode/Reader)
add_subdirectory(lib/Bitcode/Writer)
add_subdirectory(lib/Transforms/Utils)
add_subdirectory(lib/Transforms/Instrumentation)
add_subdirectory(lib/Transforms/Scalar)
add_subdirectory(lib/Transforms/IPO)
add_subdirectory(lib/Transforms/Hello)
add_subdirectory(lib/Linker)
add_subdirectory(lib/Analysis)
add_subdirectory(lib/Analysis/IPA)
add_subdirectory(lib/MC)
add_subdirectory(test)
add_subdirectory(utils/FileCheck)
add_subdirectory(utils/count)
add_subdirectory(utils/not)
set(LLVM_ENUM_ASM_PRINTERS "")
set(LLVM_ENUM_ASM_PARSERS "")
set(LLVM_ENUM_DISASSEMBLERS "")
foreach(t ${LLVM_TARGETS_TO_BUILD})
message(STATUS "Targeting ${t}")
add_subdirectory(lib/Target/${t})
add_subdirectory(lib/Target/${t}/TargetInfo)
if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
add_subdirectory(lib/Target/${t}/AsmPrinter)
set(LLVM_ENUM_ASM_PRINTERS
"${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmPrinter/CMakeLists.txt )
if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
add_subdirectory(lib/Target/${t}/AsmParser)
set(LLVM_ENUM_ASM_PARSERS
"${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/AsmParser/CMakeLists.txt )
if( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
add_subdirectory(lib/Target/${t}/Disassembler)
set(LLVM_ENUM_DISASSEMBLERS
"${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
endif( EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Target/${t}/Disassembler/CMakeLists.txt )
set(CURRENT_LLVM_TARGET)
endforeach(t)
# Produce llvm/Config/AsmPrinters.def
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
)
# Produce llvm/Config/AsmParsers.def
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
)
# Produce llvm/Config/Disassemblers.def
configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
)
add_subdirectory(lib/ExecutionEngine)
add_subdirectory(lib/ExecutionEngine/Interpreter)
add_subdirectory(lib/ExecutionEngine/JIT)
add_subdirectory(lib/Target)
add_subdirectory(lib/AsmParser)
add_subdirectory(lib/Archive)
add_subdirectory(projects)
option(LLVM_BUILD_TOOLS "Build LLVM tool programs." ON)
add_subdirectory(tools)
option(LLVM_BUILD_EXAMPLES "Build LLVM example programs." OFF)
add_subdirectory(examples)
install(DIRECTORY include/
DESTINATION include
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
PATTERN "*.td"
PATTERN "*.inc"
PATTERN ".svn" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
DESTINATION include
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
PATTERN "*.gen"
PATTERN "*.inc"
# Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
PATTERN "CMakeFiles" EXCLUDE
PATTERN ".svn" EXCLUDE
)
# TODO: make and install documentation.

View file

@ -0,0 +1,337 @@
This file is a partial list of people who have contributed to the LLVM
project. If you have contributed a patch or made some other contribution to
LLVM, please submit a patch to this file to add yourself, and it will be
done!
The list is sorted by surname and formatted to allow easy grepping and
beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
N: Vikram Adve
E: vadve@cs.uiuc.edu
W: http://www.cs.uiuc.edu/~vadve/
D: The Sparc64 backend, provider of much wisdom, and motivator for LLVM
N: Owen Anderson
E: resistor@mac.com
D: LCSSA pass and related LoopUnswitch work
D: GVNPRE pass, TargetData refactoring, random improvements
N: Henrik Bach
D: MingW Win32 API portability layer
N: Nate Begeman
E: natebegeman@mac.com
D: PowerPC backend developer
D: Target-independent code generator and analysis improvements
N: Daniel Berlin
E: dberlin@dberlin.org
D: ET-Forest implementation.
D: Sparse bitmap
N: Neil Booth
E: neil@daikokuya.co.uk
D: APFloat implementation.
N: Misha Brukman
E: brukman+llvm@uiuc.edu
W: http://misha.brukman.net
D: Portions of X86 and Sparc JIT compilers, PowerPC backend
D: Incremental bytecode loader
N: Cameron Buschardt
E: buschard@uiuc.edu
D: The `mem2reg' pass - promotes values stored in memory to registers
N: Chandler Carruth
E: chandlerc@gmail.com
D: LinkTimeOptimizer for Linux, via binutils integration, and C API
N: Casey Carter
E: ccarter@uiuc.edu
D: Fixes to the Reassociation pass, various improvement patches
N: Evan Cheng
E: evan.cheng@apple.com
D: ARM and X86 backends
D: Instruction scheduler improvements
D: Register allocator improvements
D: Loop optimizer improvements
D: Target-independent code generator improvements
N: Dan Villiom Podlaski Christiansen
E: danchr@gmail.com
E: danchr@cs.au.dk
W: http://villiom.dk
D: LLVM Makefile improvements
D: Clang diagnostic & driver tweaks
S: Aarhus, Denmark
N: Jeff Cohen
E: jeffc@jolt-lang.org
W: http://jolt-lang.org
D: Native Win32 API portability layer
N: John T. Criswell
E: criswell@uiuc.edu
D: Original Autoconf support, documentation improvements, bug fixes
N: Stefanus Du Toit
E: stefanus.dutoit@rapidmind.com
D: Bug fixes and minor improvements
N: Rafael Avila de Espindola
E: rafael.espindola@gmail.com
D: The ARM backend
N: Alkis Evlogimenos
E: alkis@evlogimenos.com
D: Linear scan register allocator, many codegen improvements, Java frontend
N: Ryan Flynn
E: pizza@parseerror.com
D: Miscellaneous bug fixes
N: Brian Gaeke
E: gaeke@uiuc.edu
W: http://www.students.uiuc.edu/~gaeke/
D: Portions of X86 static and JIT compilers; initial SparcV8 backend
D: Dynamic trace optimizer
D: FreeBSD/X86 compatibility fixes, the llvm-nm tool
N: Nicolas Geoffray
E: nicolas.geoffray@lip6.fr
W: http://www-src.lip6.fr/homepages/Nicolas.Geoffray/
D: PPC backend fixes for Linux
N: Louis Gerbarg
D: Portions of the PowerPC backend
N: Saem Ghani
E: saemghani@gmail.com
D: Callgraph class cleanups
N: Mikhail Glushenkov
E: foldr@codedgers.com
D: Author of llvmc2
N: Dan Gohman
E: gohman@apple.com
D: Miscellaneous bug fixes
N: David Goodwin
E: david@goodwinz.net
D: Thumb-2 code generator
N: David Greene
E: greened@obbligato.org
D: Miscellaneous bug fixes
D: Register allocation refactoring
N: Gabor Greif
E: ggreif@gmail.com
D: Improvements for space efficiency
N: Lang Hames
E: lhames@gmail.com
D: PBQP-based register allocator
N: Gordon Henriksen
E: gordonhenriksen@mac.com
D: Pluggable GC support
D: C interface
D: Ocaml bindings
N: Raul Fernandes Herbster
E: raul@dsc.ufcg.edu.br
D: JIT support for ARM
N: Paolo Invernizzi
E: arathorn@fastwebnet.it
D: Visual C++ compatibility fixes
N: Patrick Jenkins
E: patjenk@wam.umd.edu
D: Nightly Tester
N: Dale Johannesen
E: dalej@apple.com
D: ARM constant islands improvements
D: Tail merging improvements
D: Rewrite X87 back end
D: Use APFloat for floating point constants widely throughout compiler
D: Implement X87 long double
N: Brad Jones
E: kungfoomaster@nondot.org
D: Support for packed types
N: Rod Kay
E: rkay@auroraux.org
D: Author of LLVM Ada bindings
N: Eric Kidd
W: http://randomhacks.net/
D: llvm-config script
N: Anton Korobeynikov
E: asl@math.spbu.ru
D: Mingw32 fixes, cross-compiling support, stdcall/fastcall calling conv.
D: x86/linux PIC codegen, aliases, regparm/visibility attributes
D: Switch lowering refactoring
N: Sumant Kowshik
E: kowshik@uiuc.edu
D: Author of the original C backend
N: Benjamin Kramer
E: benny.kra@gmail.com
D: Miscellaneous bug fixes
N: Christopher Lamb
E: christopher.lamb@gmail.com
D: aligned load/store support, parts of noalias and restrict support
D: vreg subreg infrastructure, X86 codegen improvements based on subregs
D: address spaces
N: Jim Laskey
E: jlaskey@apple.com
D: Improvements to the PPC backend, instruction scheduling
D: Debug and Dwarf implementation
D: Auto upgrade mangler
D: llvm-gcc4 svn wrangler
N: Chris Lattner
E: sabre@nondot.org
W: http://nondot.org/~sabre/
D: Primary architect of LLVM
N: Tanya Lattner (Tanya Brethour)
E: tonic@nondot.org
W: http://nondot.org/~tonic/
D: The initial llvm-ar tool, converted regression testsuite to dejagnu
D: Modulo scheduling in the SparcV9 backend
D: Release manager (1.7+)
N: Andrew Lenharth
E: alenhar2@cs.uiuc.edu
W: http://www.lenharth.org/~andrewl/
D: Alpha backend
D: Sampling based profiling
N: Nick Lewycky
E: nicholas@mxc.ca
D: PredicateSimplifier pass
N: Bruno Cardoso Lopes
E: bruno.cardoso@gmail.com
W: http://www.brunocardoso.org
D: The Mips backend
N: Duraid Madina
E: duraid@octopus.com.au
W: http://kinoko.c.u-tokyo.ac.jp/~duraid/
D: IA64 backend, BigBlock register allocator
N: Michael McCracken
E: michael.mccracken@gmail.com
D: Line number support for llvmgcc
N: Vladimir Merzliakov
E: wanderer@rsu.ru
D: Test suite fixes for FreeBSD
N: Scott Michel
E: scottm@aero.org
D: Added STI Cell SPU backend.
N: Edward O'Callaghan
E: eocallaghan@auroraux.org
W: http://www.auroraux.org
D: Add Clang support with various other improvements to utils/NewNightlyTest.pl
D: Fix and maintain Solaris & AuroraUX support for llvm, various build warnings
D: and error clean ups.
N: Morten Ofstad
E: morten@hue.no
D: Visual C++ compatibility fixes
N: Jakob Stoklund Olesen
E: stoklund@2pi.dk
D: Machine code verifier
D: Blackfin backend
N: Richard Osborne
E: richard@xmos.com
D: XCore backend
N: Devang Patel
E: dpatel@apple.com
D: LTO tool, PassManager rewrite, Loop Pass Manager, Loop Rotate
D: GCC PCH Integration (llvm-gcc), llvm-gcc improvements
D: Optimizer improvements, Loop Index Split
N: Sandeep Patel
E: deeppatel1987@gmail.com
D: ARM calling conventions rewrite, hard float support
N: Vladimir Prus
W: http://vladimir_prus.blogspot.com
E: ghost@cs.msu.su
D: Made inst_iterator behave like a proper iterator, LowerConstantExprs pass
N: Roman Samoilov
E: roman@codedgers.com
D: MSIL backend
N: Duncan Sands
E: baldrick@free.fr
D: Ada front-end, exception handling improvements
N: Ruchira Sasanka
E: sasanka@uiuc.edu
D: Graph coloring register allocator for the Sparc64 backend
N: Arnold Schwaighofer
E: arnold.schwaighofer@gmail.com
D: Tail call optimization for the x86 backend
N: Shantonu Sen
E: ssen@apple.com
D: Miscellaneous bug fixes
N: Anand Shukla
E: ashukla@cs.uiuc.edu
D: The `paths' pass
N: Reid Spencer
E: rspencer@reidspencer.com
W: http://reidspencer.com/
D: Lots of stuff, see: http://wiki.llvm.org/index.php/User:Reid
N: Edwin Torok
E: edwintorok@gmail.com
D: Miscellaneous bug fixes
N: Adam Treat
E: manyoso@yahoo.com
D: C++ bugs filed, and C++ front-end bug fixes.
N: Lauro Ramos Venancio
E: lauro.venancio@indt.org.br
D: ARM backend improvements
D: Thread Local Storage implementation
N: Xerxes Ranby
E: xerxes@zafena.se
D: Cmake dependency chain and various bug fixes
N: Bill Wendling
E: isanbard@gmail.com
D: Bunches of stuff
N: Bob Wilson
E: bob.wilson@acm.org
D: Advanced SIMD (NEON) support in the ARM backend

View file

@ -0,0 +1,69 @@
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2009 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyrights and Licenses for Third Party Software Distributed with LLVM:
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.
The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.
The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:
Program Directory
------- ---------
Autoconf llvm/autoconf
llvm/projects/ModuleMaker/autoconf
llvm/projects/sample/autoconf
CellSPU backend llvm/lib/Target/CellSPU/README.txt
Google Test llvm/utils/unittest/googletest
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}

233
libclamav/c++/llvm/Makefile Normal file
View file

@ -0,0 +1,233 @@
#===- ./Makefile -------------------------------------------*- Makefile -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
LEVEL := .
# Top-Level LLVM Build Stages:
# 1. Build lib/System and lib/Support, which are used by utils (tblgen).
# 2. Build utils, which is used by VMCore.
# 3. Build VMCore, which builds the Intrinsics.inc file used by libs.
# 4. Build libs, which are needed by llvm-config.
# 5. Build llvm-config, which determines inter-lib dependencies for tools.
# 6. Build tools, runtime, docs.
#
# When cross-compiling, there are some things (tablegen) that need to
# be build for the build system first.
# If "RC_ProjectName" exists in the environment, and its value is
# "llvmCore", then this is an "Apple-style" build; search for
# "Apple-style" in the comments for more info. Anything else is a
# normal build.
ifneq ($(findstring llvmCore, $(RC_ProjectName)),llvmCore) # Normal build (not "Apple-style").
ifeq ($(BUILD_DIRS_ONLY),1)
DIRS := lib/System lib/Support utils
OPTIONAL_DIRS :=
else
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
tools runtime docs unittests
OPTIONAL_DIRS := projects bindings
endif
ifeq ($(BUILD_EXAMPLES),1)
OPTIONAL_DIRS += examples
endif
EXTRA_DIST := test unittests llvm.spec include win32 Xcode
include $(LEVEL)/Makefile.config
# llvm-gcc4 doesn't need runtime libs. llvm-gcc4 is the only supported one.
# FIXME: Remove runtime entirely once we have an understanding of where
# libprofile etc should go.
#ifeq ($(LLVMGCC_MAJVERS),4)
# DIRS := $(filter-out runtime, $(DIRS))
#endif
ifeq ($(MAKECMDGOALS),libs-only)
DIRS := $(filter-out tools runtime docs, $(DIRS))
OPTIONAL_DIRS :=
endif
ifeq ($(MAKECMDGOALS),install-libs)
DIRS := $(filter-out tools runtime docs, $(DIRS))
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
endif
ifeq ($(MAKECMDGOALS),tools-only)
DIRS := $(filter-out runtime docs, $(DIRS))
OPTIONAL_DIRS :=
endif
ifeq ($(MAKECMDGOALS),install-clang)
DIRS := tools/clang/tools/driver tools/clang/tools/clang-cc \
tools/clang/lib/Headers tools/clang/docs
OPTIONAL_DIRS :=
NO_INSTALL = 1
endif
ifeq ($(MAKECMDGOALS),clang-only)
DIRS := $(filter-out tools runtime docs unittests, $(DIRS)) tools/clang
OPTIONAL_DIRS :=
endif
ifeq ($(MAKECMDGOALS),unittests)
DIRS := $(filter-out tools runtime docs, $(DIRS)) utils unittests
OPTIONAL_DIRS :=
endif
# Use NO_INSTALL define of the Makefile of each directory for deciding
# if the directory is installed or not
ifeq ($(MAKECMDGOALS),install)
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
endif
# If we're cross-compiling, build the build-hosted tools first
ifeq ($(LLVM_CROSS_COMPILING),1)
all:: cross-compile-build-tools
clean::
$(Verb) rm -rf BuildTools
cross-compile-build-tools:
$(Verb) if [ ! -f BuildTools/Makefile ]; then \
$(MKDIR) BuildTools; \
cd BuildTools ; \
unset CFLAGS ; \
unset CXXFLAGS ; \
$(PROJ_SRC_DIR)/configure --build=$(BUILD_TRIPLE) \
--host=$(BUILD_TRIPLE) --target=$(BUILD_TRIPLE); \
cd .. ; \
fi; \
($(MAKE) -C BuildTools \
BUILD_DIRS_ONLY=1 \
UNIVERSAL= \
ENABLE_OPTIMIZED=$(ENABLE_OPTIMIZED) \
ENABLE_PROFILING=$(ENABLE_PROFILING) \
ENABLE_COVERAGE=$(ENABLE_COVERAGE) \
DISABLE_ASSERTIONS=$(DISABLE_ASSERTIONS) \
ENABLE_EXPENSIVE_CHECKS=$(ENABLE_EXPENSIVE_CHECKS) \
) || exit 1;
endif
# Include the main makefile machinery.
include $(LLVM_SRC_ROOT)/Makefile.rules
# Specify options to pass to configure script when we're
# running the dist-check target
DIST_CHECK_CONFIG_OPTIONS = --with-llvmgccdir=$(LLVMGCCDIR)
.PHONY: debug-opt-prof
debug-opt-prof:
$(Echo) Building Debug Version
$(Verb) $(MAKE)
$(Echo)
$(Echo) Building Optimized Version
$(Echo)
$(Verb) $(MAKE) ENABLE_OPTIMIZED=1
$(Echo)
$(Echo) Building Profiling Version
$(Echo)
$(Verb) $(MAKE) ENABLE_PROFILING=1
dist-hook::
$(Echo) Eliminating files constructed by configure
$(Verb) $(RM) -f \
$(TopDistDir)/include/llvm/Config/config.h \
$(TopDistDir)/include/llvm/System/DataTypes.h
clang-only: all
tools-only: all
libs-only: all
install-clang: install
install-libs: install
#------------------------------------------------------------------------
# Make sure the generated headers are up-to-date. This must be kept in
# sync with the AC_CONFIG_HEADER invocations in autoconf/configure.ac
#------------------------------------------------------------------------
FilesToConfig := \
include/llvm/Config/config.h \
include/llvm/Config/Targets.def \
include/llvm/Config/AsmPrinters.def \
include/llvm/Config/AsmParsers.def \
include/llvm/Config/Disassemblers.def \
include/llvm/System/DataTypes.h \
tools/llvmc/plugins/Base/Base.td
FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig))
all-local:: $(FilesToConfigPATH)
$(FilesToConfigPATH) : $(LLVM_OBJ_ROOT)/% : $(LLVM_SRC_ROOT)/%.in
$(Echo) Regenerating $*
$(Verb) cd $(LLVM_OBJ_ROOT) && $(ConfigStatusScript) $*
.PRECIOUS: $(FilesToConfigPATH)
# NOTE: This needs to remain as the last target definition in this file so
# that it gets executed last.
ifneq ($(BUILD_DIRS_ONLY),1)
all::
$(Echo) '*****' Completed $(BuildMode)$(AssertMode) Build
ifeq ($(BuildMode),Debug)
$(Echo) '*****' Note: Debug build can be 10 times slower than an
$(Echo) '*****' optimized build. Use 'make ENABLE_OPTIMIZED=1' to
$(Echo) '*****' make an optimized build. Alternatively you can
$(Echo) '*****' configure with --enable-optimized.
endif
endif
check-llvm2cpp:
$(Verb)$(MAKE) check TESTSUITE=Feature RUNLLVM2CPP=1
check-one:
$(Verb)$(MAKE) -C test check-one TESTONE=$(TESTONE)
srpm: $(LLVM_OBJ_ROOT)/llvm.spec
rpmbuild -bs $(LLVM_OBJ_ROOT)/llvm.spec
rpm: $(LLVM_OBJ_ROOT)/llvm.spec
rpmbuild -bb --target $(TARGET_TRIPLE) $(LLVM_OBJ_ROOT)/llvm.spec
show-footprint:
$(Verb) du -sk $(LibDir)
$(Verb) du -sk $(ToolDir)
$(Verb) du -sk $(ExmplDir)
$(Verb) du -sk $(ObjDir)
build-for-llvm-top:
$(Verb) if test ! -f ./config.status ; then \
./configure --prefix="$(LLVM_TOP)/install" \
--with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
fi
$(Verb) $(MAKE) tools-only
SVN = svn
SVN-UPDATE-OPTIONS =
AWK = awk
SUB-SVN-DIRS = $(AWK) '/\?\ \ \ \ \ \ / {print $$2}' \
| LC_ALL=C xargs $(SVN) info 2>/dev/null \
| $(AWK) '/Path:\ / {print $$2}'
update:
$(SVN) $(SVN-UPDATE-OPTIONS) update $(LLVM_SRC_ROOT)
@ $(SVN) status $(LLVM_SRC_ROOT) | $(SUB-SVN-DIRS) | xargs $(SVN) $(SVN-UPDATE-OPTIONS) update
happiness: update all check unittests
.PHONY: srpm rpm update happiness
# declare all targets at this level to be serial:
.NOTPARALLEL:
else # Building "Apple-style."
# In an Apple-style build, once configuration is done, lines marked
# "Apple-style" are removed with sed! Please don't remove these!
# Look for the string "Apple-style" in utils/buildit/build_llvm.
include $(shell find . -name GNUmakefile) # Building "Apple-style."
endif # Building "Apple-style."

View file

@ -0,0 +1,70 @@
#===-- Makefile.common - Common make rules for LLVM --------*- Makefile -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#
# This file is included by all of the LLVM makefiles. This file defines common
# rules to do things like compile a .cpp file or generate dependency info.
# These are platform dependent, so this is the file used to specify these
# system dependent operations.
#
# The following functionality can be set by setting incoming variables.
# The variable $(LEVEL) *must* be set:
#
# 1. LEVEL - The level of the current subdirectory from the top of the
# source directory. This level should be expressed as a path, for
# example, ../.. for two levels deep.
#
# 2. DIRS - A list of subdirectories to be built. Fake targets are set up
# so that each of the targets "all", "install", and "clean" each build
# the subdirectories before the local target. DIRS are guaranteed to be
# built in order.
#
# 3. PARALLEL_DIRS - A list of subdirectories to be built, but that may be
# built in any order. All DIRS are built in order before PARALLEL_DIRS are
# built, which are then built in any order.
#
# 4. Source - If specified, this sets the source code filenames. If this
# is not set, it defaults to be all of the .cpp, .c, .y, and .l files
# in the current directory. Also, if you want to build files in addition
# to the local files, you can use the ExtraSource variable
#
# 5. SourceDir - If specified, this specifies a directory that the source files
# are in, if they are not in the current directory. This should include a
# trailing / character.
#
# 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree.
#
# 8. PROJ_SRC_DIR - The directory which contains the current set of Makefiles
# and usually the source code too (unless SourceDir is set).
#
# 9. PROJ_SRC_ROOT - The root directory of the source code being compiled.
#
# 10. PROJ_OBJ_DIR - The directory where object code should be placed.
#
# 11. PROJ_OBJ_ROOT - The root directory for where object code should be
# placed.
#
# For building,
# LLVM, LLVM_SRC_ROOT = PROJ_SRC_ROOT
#
#===-----------------------------------------------------------------------====
#
# Configuration file to set paths specific to local installation of LLVM
#
ifndef LLVM_OBJ_ROOT
include $(LEVEL)/Makefile.config
else
include $(LLVM_OBJ_ROOT)/Makefile.config
endif
#
# Include all of the build rules used for making LLVM
#
include $(LLVM_SRC_ROOT)/Makefile.rules

View file

@ -0,0 +1,337 @@
#===-- Makefile.config - Local configuration for LLVM ------*- Makefile -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#
# This file is included by Makefile.common. It defines paths and other
# values specific to a particular installation of LLVM.
#
#===------------------------------------------------------------------------===#
# Define LLVM specific info and directories based on the autoconf variables
LLVMPackageName := @PACKAGE_NAME@
LLVMVersion := @PACKAGE_VERSION@
LLVM_CONFIGTIME := @LLVM_CONFIGTIME@
###########################################################################
# Directory Configuration
# This section of the Makefile determines what is where. To be
# specific, there are several locations that need to be defined:
#
# o LLVM_SRC_ROOT : The root directory of the LLVM source code.
# o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
#
# o PROJ_SRC_DIR : The directory containing the code to build.
# o PROJ_SRC_ROOT : The root directory of the code to build.
#
# o PROJ_OBJ_DIR : The directory in which compiled code will be placed.
# o PROJ_OBJ_ROOT : The root directory in which compiled code is placed.
#
###########################################################################
PWD := @BINPWD@
# Set the project name to LLVM if its not defined
ifndef PROJECT_NAME
PROJECT_NAME := $(LLVMPackageName)
endif
PROJ_OBJ_DIR := $(shell $(PWD))
PROJ_OBJ_ROOT := $(shell cd $(PROJ_OBJ_DIR)/$(LEVEL); $(PWD))
ifeq ($(PROJECT_NAME),llvm)
LLVM_SRC_ROOT := $(shell cd @abs_top_srcdir@; $(PWD))
LLVM_OBJ_ROOT := $(shell cd @abs_top_builddir@; $(PWD))
PROJ_SRC_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(PWD))
PROJ_SRC_DIR := $(shell cd $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))
prefix := @prefix@
PROJ_prefix := $(prefix)
PROJ_VERSION := $(LLVMVersion)
else
ifndef PROJ_SRC_ROOT
$(error Projects must define PROJ_SRC_ROOT)
endif
ifndef PROJ_OBJ_ROOT
$(error Projects must define PROJ_OBJ_ROOT)
endif
ifndef PROJ_INSTALL_ROOT
$(error Projects must define PROJ_INSTALL_ROOT)
endif
ifndef LLVM_SRC_ROOT
$(error Projects must define LLVM_SRC_ROOT)
endif
ifndef LLVM_OBJ_ROOT
$(error Projects must define LLVM_OBJ_ROOT)
endif
PROJ_SRC_DIR := $(shell cd $(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD))
prefix := $(PROJ_INSTALL_ROOT)
PROJ_prefix := $(prefix)
ifndef PROJ_VERSION
PROJ_VERSION := 1.0
endif
endif
LLVMMAKE := $(LLVM_SRC_ROOT)/make
PROJ_bindir := $(DESTDIR)$(PROJ_prefix)/bin
PROJ_libdir := $(DESTDIR)$(PROJ_prefix)/lib
PROJ_datadir := $(DESTDIR)$(PROJ_prefix)/share
PROJ_docsdir := $(DESTDIR)$(PROJ_prefix)/docs/llvm
PROJ_etcdir := $(DESTDIR)$(PROJ_prefix)/etc/llvm
PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include
PROJ_infodir := $(DESTDIR)$(PROJ_prefix)/info
PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/share/man
# Determine if we're on a unix type operating system
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
LLVM_ON_WIN32:=@LLVM_ON_WIN32@
# Host operating system for which LLVM will be run.
OS=@OS@
HOST_OS=@HOST_OS@
# Target operating system for which LLVM will compile for.
TARGET_OS=@TARGET_OS@
# Target hardware architecture
ARCH=@ARCH@
# Indicates, whether we're cross-compiling LLVM or not
LLVM_CROSS_COMPILING=@LLVM_CROSS_COMPILING@
# Executable file extension for build platform (mainly for
# tablegen call if we're cross-compiling).
BUILD_EXEEXT=@BUILD_EXEEXT@
# Compilers for the build platflorm (mainly for tablegen
# call if we're cross-compiling).
BUILD_CC=@BUILD_CC@
BUILD_CXX=@BUILD_CXX@
# Triple for configuring build tools when cross-compiling
BUILD_TRIPLE=@build@
# Target triple (cpu-vendor-os) for which we should generate code
TARGET_TRIPLE=@target@
# Extra options to compile LLVM with
EXTRA_OPTIONS=@EXTRA_OPTIONS@
# Endian-ness of the target
ENDIAN=@ENDIAN@
# Path to the C++ compiler to use. This is an optional setting, which defaults
# to whatever your gmake defaults to.
CXX = @CXX@
# Path to the CC binary, which use used by testcases for native builds.
CC := @CC@
# Linker flags.
LDFLAGS+=@LDFLAGS@
# Path to the library archiver program.
AR_PATH = @AR@
AR = @AR@
# Path to the nm program
NM_PATH = @NM@
# The pathnames of the programs we require to build
CMP := @CMP@
CP := @CP@
DATE := @DATE@
FIND := @FIND@
GREP := @GREP@
INSTALL := @INSTALL@
MKDIR := $(LLVM_SRC_ROOT)/autoconf/mkinstalldirs
MV := @MV@
RANLIB := @RANLIB@
RM := @RM@
SED := @SED@
TAR := @TAR@
# Paths to miscellaneous programs we hope are present but might not be
PERL := @PERL@
BZIP2 := @BZIP2@
DOT := @DOT@
DOXYGEN := @DOXYGEN@
GROFF := @GROFF@
GZIP := @GZIP@
OCAMLC := @OCAMLC@
OCAMLOPT := @OCAMLOPT@
OCAMLDEP := @OCAMLDEP@
OCAMLDOC := @OCAMLDOC@
GAS := @GAS@
POD2HTML := @POD2HTML@
POD2MAN := @POD2MAN@
RUNTEST := @RUNTEST@
TCLSH := @TCLSH@
ZIP := @ZIP@
HAVE_PERL := @HAVE_PERL@
HAVE_PTHREAD := @HAVE_PTHREAD@
LIBS := @LIBS@
# Targets that we should build
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
# Path to location for LLVM C/C++ front-end. You can modify this if you
# want to override the value set by configure.
LLVMGCCDIR := @LLVMGCCDIR@
# Determine the target for which LLVM should generate code.
ifeq (@LLVMGCC_MAJVERS@,3)
LLVMGCCARCH := @target@/3.4-llvm
else
LLVMGCCARCH := @target@/@LLVMGCC_VERSION@
endif
# Determine the path where the library executables are
LLVMGCCLIBEXEC := @LLVMGCCLIBEXEC@
# Full pathnames of LLVM C/C++ front-end 'cc1' and 'cc1plus' binaries:
LLVMGCC := @LLVMGCC@
LLVMGXX := @LLVMGXX@
LLVMCC1 := @LLVMCC1@
LLVMCC1PLUS := @LLVMCC1PLUS@
LLVMGCC_VERSION := @LLVMGCC_VERSION@
LLVMGCC_MAJVERS := @LLVMGCC_MAJVERS@
LLVMGCC_LANGS := @LLVMGCC_LANGS@
# Path to directory where object files should be stored during a build.
# Set OBJ_ROOT to "." if you do not want to use a separate place for
# object files.
OBJ_ROOT := .
# What to pass as rpath flag to g++
RPATH := @RPATH@
# What to pass as -rdynamic flag to g++
RDYNAMIC := @RDYNAMIC@
# These are options that can either be enabled here, or can be enabled on the
# make command line (ie, make ENABLE_PROFILING=1):
# When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output is put
# into the "Release" directories. Otherwise, LLVM code is not optimized and
# output is put in the "Debug" directories.
#ENABLE_OPTIMIZED = 1
@ENABLE_OPTIMIZED@
# When ENABLE_PROFILING is enabled, profile instrumentation is done
# and output is put into the "<Flavor>+Profile" directories, where
# <Flavor> is either Debug or Release depending on how other builkd
# flags are set.. Otherwise, output is put in the <Flavor>
# directories.
#ENABLE_PROFILING = 1
@ENABLE_PROFILING@
# When DISABLE_ASSERTIONS is enabled, builds of all of the LLVM code will
# exclude assertion checks, otherwise they are included.
#DISABLE_ASSERTIONS = 1
@DISABLE_ASSERTIONS@
# When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
# code will include expensive checks, otherwise they are excluded.
#ENABLE_EXPENSIVE_CHECKS = 0
@ENABLE_EXPENSIVE_CHECKS@
# When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
# symbols.
#DEBUG_RUNTIME = 1
@DEBUG_RUNTIME@
# When DEBUG_SYMBOLS is enabled, the compiler libraries will retain debug
# symbols.
#DEBUG_SYMBOLS = 1
@DEBUG_SYMBOLS@
# The compiler flags to use for optimized builds.
OPTIMIZE_OPTION := @OPTIMIZE_OPTION@
# When ENABLE_PROFILING is enabled, the llvm source base is built with profile
# information to allow gprof to be used to get execution frequencies.
#ENABLE_PROFILING = 1
# When ENABLE_DOXYGEN is enabled, the doxygen documentation will be built
ENABLE_DOXYGEN = @ENABLE_DOXYGEN@
# Do we want to enable threads?
ENABLE_THREADS := @ENABLE_THREADS@
# Do we want to build with position independent code?
ENABLE_PIC := @ENABLE_PIC@
# Use -fvisibility-inlines-hidden?
ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
# This option tells the Makefiles to produce verbose output.
# It essentially prints the commands that make is executing
#VERBOSE = 1
# Enable JIT for this platform
TARGET_HAS_JIT = @TARGET_HAS_JIT@
# Shared library extension for host platform.
SHLIBEXT = @SHLIBEXT@
# Executable file extension for host platform.
EXEEXT = @EXEEXT@
# Things we just assume are "there"
ECHO := echo
# Get the options for causing archives to link all their content instead of
# just missing symbols, and the inverse of that. This is used for certain LLVM
# tools that permit loadable modules. It ensures that the LLVM symbols will be
# available to those loadable modules.
LINKALL := @LINKALL@
NOLINKALL := @NOLINKALL@
# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
# on the check.
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
# Bindings that we should build
BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@
ALL_BINDINGS := @ALL_BINDINGS@
OCAML_LIBDIR := @OCAML_LIBDIR@
# When compiling under Mingw/Cygwin, executables such as tblgen
# expect Windows paths, whereas the build system uses Unix paths.
# The function SYSPATH transforms Unix paths into Windows paths.
ifneq (,$(findstring -mno-cygwin, $(CXX)))
SYSPATH = $(shell echo $(1) | cygpath -m -f -)
else
SYSPATH = $(1)
endif
# Location of the plugin header file for gold.
BINUTILS_INCDIR := @BINUTILS_INCDIR@
C_INCLUDE_DIRS := @C_INCLUDE_DISR@
CXX_INCLUDE_ROOT := @CXX_INCLUDE_ROOT@
CXX_INCLUDE_ARCH := @CXX_INCLUDE_ARCH@
CXX_INCLUDE_32BIT_DIR = @CXX_INCLUDE_32BIT_DIR@
CXX_INCLUDE_64BIT_DIR = @CXX_INCLUDE_64BIT_DIR@
# When ENABLE_LLVMC_DYNAMIC is enabled, LLVMC will link libCompilerDriver
# dynamically. This is needed to make dynamic plugins work on some targets
# (Windows).
ENABLE_LLVMC_DYNAMIC = 0
#@ENABLE_LLVMC_DYNAMIC@
# When ENABLE_LLVMC_DYNAMIC_PLUGINS is enabled, LLVMC will have dynamic plugin
# support (via the -load option).
ENABLE_LLVMC_DYNAMIC_PLUGINS = 1
#@ENABLE_LLVMC_DYNAMIC_PLUGINS@
# Optional flags supported by the compiler
# -Wno-missing-field-initializers
NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
# -Wno-variadic-macros
NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
DepModule:
BuildCmd: ./build-for-llvm-top.sh
CleanCmd: make clean -C ../build.llvm
InstallCmd: make install -C ../build.llvm

View file

@ -0,0 +1,13 @@
Low Level Virtual Machine (LLVM)
================================
This directory and its subdirectories contain source code for the Low Level
Virtual Machine, a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.
LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.
Please see the HTML documentation provided in docs/index.html for further
assistance with LLVM.

View file

@ -0,0 +1,58 @@
#!/bin/bash
die() {
echo "$@" 1>&2
exit 1
}
clean() {
echo $1 | sed -e 's/\\//g'
}
### NOTE: ############################################################
### These variables specify the tool versions we want to use.
### Periods should be escaped with backslash for use by grep.
###
### If you update these, please also update docs/GettingStarted.html
want_autoconf_version='2\.60'
want_autoheader_version=$want_autoconf_version
want_aclocal_version='1\.9\.6'
want_libtool_version='1\.5\.22'
### END NOTE #########################################################
outfile=configure
configfile=configure.ac
want_autoconf_version_clean=$(clean $want_autoconf_version)
want_autoheader_version_clean=$(clean $want_autoheader_version)
want_aclocal_version_clean=$(clean $want_aclocal_version)
want_libtool_version_clean=$(clean $want_libtool_version)
test -d autoconf && test -f autoconf/$configfile && cd autoconf
test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
autoconf --version | grep $want_autoconf_version > /dev/null
test $? -eq 0 || die "Your autoconf was not detected as being $want_autoconf_version_clean"
aclocal --version | grep '^aclocal.*'$want_aclocal_version > /dev/null
test $? -eq 0 || die "Your aclocal was not detected as being $want_aclocal_version_clean"
autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null
test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean"
libtool --version | grep $want_libtool_version > /dev/null
test $? -eq 0 || die "Your libtool was not detected as being $want_libtool_version_clean"
echo ""
echo "### NOTE: ############################################################"
echo "### If you get *any* warnings from autoconf below you MUST fix the"
echo "### scripts in the m4 directory because there are future forward"
echo "### compatibility or platform support issues at risk. Please do NOT"
echo "### commit any configure script that was generated with warnings"
echo "### present. You should get just three 'Regenerating..' lines."
echo "######################################################################"
echo ""
echo "Regenerating aclocal.m4 with aclocal $want_aclocal_version_clean"
cwd=`pwd`
aclocal --force -I $cwd/m4 || die "aclocal failed"
echo "Regenerating configure with autoconf $want_autoconf_version_clean"
autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
cd ..
echo "Regenerating config.h.in with autoheader $want_autoheader_version_clean"
autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
exit 0

View file

@ -0,0 +1,4 @@
{
global: main;
local: *;
};

View file

@ -0,0 +1,24 @@
------------------------------------------------------------------------------
Autoconf Files
------------------------------------------------------------------------------
All autoconf files are licensed under the LLVM license with the following
additions:
llvm/autoconf/install-sh:
This script is licensed under the LLVM license, with the following
additional copyrights and restrictions:
Copyright 1991 by the Massachusetts Institute of Technology
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of M.I.T. not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission. M.I.T. makes no representations about the
suitability of this software for any purpose. It is provided "as is"
without express or implied warranty.
Please see the source files for additional copyrights.

View file

@ -0,0 +1,49 @@
Upgrading Libtool
===============================================================================
If you are in the mood to upgrade libtool, you must do the following:
1. Get the new version of libtool and put it in <SRC>
2. configure/build/install libtool with --prefix=<PFX>
3. Copy <SRC>/ltdl.m4 to llvm/autoconf/m4
4. Copy <PFX>/share/aclocal/libtool.m4 to llvm/autoconf/m4/libtool.m4
5. Copy <PFX>/share/libtool/ltmain.sh to llvm/autoconf/ltmain.sh
6. Copy <PFX>/share/libtool/libltdl/ltdl.c to llvm/lib/System
7. Copy <PFX>/share/libtool/libltdl/ltdl.h to llvm/lib/System
8. Edit the ltdl.h file to #include "llvm/Config/config.h" at the very top. You
might also need to resolve some compiler warnings (typically about
comparison of signed vs. unsigned values). But, you won't find out about
those until you build LLVM (step 13).
9. Edit the llvm/autoconf/m4/libtool.m4 file so that:
a) in AC_PROB_LIBTOOL macro, the value of LIBTOOL is set to
$(top_builddir)/mklib, not $(top_builddir)/libtool
b) in AC_LIBTOOL_SETUP macro, the variable default_ofile is set to
"mklib" instead of "libtool"
c) s/AC_ENABLE_SHARED_DEFAULT/enable_shared_default/g
d) s/AC_ENABLE_STATIC_DEFAULT/enable_static_default/g
e) s/AC_ENABLE_FAST_INSTALL_DEFAULT/enable_fast_install_default/g
10. Run "autoupdate libtool.m4 ltdl.m4" in the llvm/autoconf/m4 directory.
This should correctly update the macro definitions in the libtool m4
files to match the version of autoconf that LLVM uses. This converts
AC_HELP_STRING to AS_HELP_STRING and AC_TRY_LINK to AC_LINK_IFELSE, amongst
other things. You may need to manually adjust the files.
11. Run AutoRegen.sh to get the new macros into configure script
12. If there are any warnings from AutoRegen.sh, go to step 9.
13. Rebuild LLVM, making sure it reconfigures
14. Test the JIT which uses libltdl
15. If it all works, only THEN commit the changes.
Upgrading autoconf
===============================================================================
If you are in the mood to upgrade autoconf, you should:
1. Consider not upgrading.
2. No really, this is a hassle, you don't want to do it.
3. Get the new version of autoconf and put it in <SRC>
4. configure/build/install autoconf with --prefix=<PFX>
5. Run autoupdate on all the m4 macros in llvm/autoconf/m4
6. Run autoupdate on llvm/autoconf/configure.ac
7. Regenerate configure script with AutoRegen.sh
8. If there are any warnings from AutoRegen.sh, fix them and go to step 7.
9. Test, test, test.

1498
libclamav/c++/llvm/autoconf/config.guess vendored Executable file

File diff suppressed because it is too large Load diff

1702
libclamav/c++/llvm/autoconf/config.sub vendored Executable file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,522 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2004-05-31.23
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program 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. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v | --v*)
echo "depcomp $scriptversion"
exit 0
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# Dependencies are output in .lo.d with libtool 1.4.
# With libtool 1.5 they are output both in $dir.libs/$base.o.d
# and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
# latter, because the former will be cleaned when $dir.libs is
# erased.
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir$base.o.d"
tmpdepfile3="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
tmpdepfile3="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
elif test -f "$tmpdepfile2"; then
tmpdepfile="$tmpdepfile2"
else
tmpdepfile="$tmpdepfile3"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -0,0 +1,322 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2004-09-10.20
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit 0;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit 0;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,15 @@
#
# Check for Bison.
#
# This macro verifies that Bison is installed. If successful, then
# 1) YACC is set to bison -y (to emulate YACC calls)
# 2) BISON is set to bison
#
AC_DEFUN([AC_PROG_BISON],
[AC_CACHE_CHECK([],[llvm_cv_has_bison],[AC_PROG_YACC()])
if test "$YACC" != "bison -y"; then
AC_SUBST(BISON,[])
AC_MSG_WARN([bison not found, can't rebuild grammars])
else
AC_SUBST(BISON,[bison])
fi])

View file

@ -0,0 +1,42 @@
# Check for the extension used for executables on build platform.
# This is necessary for cross-compiling where the build platform
# may differ from the host platform.
AC_DEFUN([AC_BUILD_EXEEXT],
[
AC_MSG_CHECKING([for executable suffix on build platform])
AC_CACHE_VAL(ac_cv_build_exeext,
[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
ac_cv_build_exeext=.exe
else
ac_build_prefix=${build_alias}-
AC_CHECK_PROG(BUILD_CC, ${ac_build_prefix}gcc, ${ac_build_prefix}gcc)
if test -z "$BUILD_CC"; then
AC_CHECK_PROG(BUILD_CC, gcc, gcc)
if test -z "$BUILD_CC"; then
AC_CHECK_PROG(BUILD_CC, cc, cc, , , /usr/ucb/cc)
fi
fi
test -z "$BUILD_CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
ac_build_link='${BUILD_CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AS_MESSAGE_LOG_FD'
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_build_exeext=
if AC_TRY_EVAL(ac_build_link); then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj | *.dSYM) ;;
*) ac_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
esac
done
else
AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.])
fi
rm -f conftest*
test x"${ac_cv_build_exeext}" = x && ac_cv_build_exeext=blank
fi])
BUILD_EXEEXT=""
test x"${ac_cv_build_exeext}" != xblank && BUILD_EXEEXT=${ac_cv_build_exeext}
AC_MSG_RESULT(${ac_cv_build_exeext})
ac_build_exeext=$BUILD_EXEEXT
AC_SUBST(BUILD_EXEEXT)])

View file

@ -0,0 +1,31 @@
#
# Determine if the printf() functions have the %a format character.
# This is modified from:
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
AC_DEFUN([AC_C_PRINTF_A],
[AC_CACHE_CHECK([if printf has the %a format character],[llvm_cv_c_printf_a],
[AC_LANG_PUSH([C])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
#include <stdio.h>
#include <stdlib.h>
]],[[
volatile double A, B;
char Buffer[100];
A = 1;
A /= 10.0;
sprintf(Buffer, "%a", A);
B = atof(Buffer);
if (A != B)
return (1);
if (A != 0x1.999999999999ap-4)
return (1);
return (0);]])],
llvm_cv_c_printf_a=yes,
llvmac_cv_c_printf_a=no,
llvmac_cv_c_printf_a=no)
AC_LANG_POP([C])])
if test "$llvm_cv_c_printf_a" = "yes"; then
AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string])
fi
])

View file

@ -0,0 +1,26 @@
#
# Check for GNU Make. This is originally from
# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html
#
AC_DEFUN([AC_CHECK_GNU_MAKE],
[AC_CACHE_CHECK([for GNU make],[llvm_cv_gnu_make_command],
dnl Search all the common names for GNU make
[llvm_cv_gnu_make_command=''
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null )
then
llvm_cv_gnu_make_command=$a ;
break;
fi
done])
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string,
dnl '#' otherwise
if test "x$llvm_cv_gnu_make_command" != "x" ; then
ifGNUmake='' ;
else
ifGNUmake='#' ;
AC_MSG_RESULT("Not found");
fi
AC_SUBST(ifGNUmake)
])

View file

@ -0,0 +1,9 @@
#
# Configure a Makefile without clobbering it if it exists and is not out of
# date. This macro is unique to LLVM.
#
AC_DEFUN([AC_CONFIG_MAKEFILE],
[AC_CONFIG_COMMANDS($1,
[${llvm_src}/autoconf/mkinstalldirs `dirname $1`
${SHELL} ${llvm_src}/autoconf/install-sh -m 0644 -c ${srcdir}/$1 $1])
])

View file

@ -0,0 +1,14 @@
#
# Provide the arguments and other processing needed for an LLVM project
#
AC_DEFUN([LLVM_CONFIG_PROJECT],
[AC_ARG_WITH([llvmsrc],
AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),
[llvm_src="$withval"],[llvm_src="]$1["])
AC_SUBST(LLVM_SRC,$llvm_src)
AC_ARG_WITH([llvmobj],
AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),
[llvm_obj="$withval"],[llvm_obj="]$2["])
AC_SUBST(LLVM_OBJ,$llvm_obj)
AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"])
])

View file

@ -0,0 +1,22 @@
#
# Check for bidirectional iterator extension. This is modified from
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
#
AC_DEFUN([AC_CXX_HAVE_BI_ITERATOR],
[AC_CACHE_CHECK(whether the compiler has the bidirectional iterator,
ac_cv_cxx_have_bi_iterator,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <iterator>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif]], [[bidirectional_iterator<int,int> t; return 0;]])],[ac_cv_cxx_have_bi_iterator=yes],[ac_cv_cxx_have_bi_iterator=no])
AC_LANG_POP([C++])
])
if test "$ac_cv_cxx_have_bi_iterator" = yes
then
AC_DEFINE(HAVE_BI_ITERATOR,1,[Have bi-directional iterator])
else
AC_DEFINE(HAVE_BI_ITERATOR,0,[Does not have bi-directional iterator])
fi
])

View file

@ -0,0 +1,2 @@
AC_DEFUN([CXX_FLAG_CHECK],
[AC_SUBST($1, `$CXX $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)])

View file

@ -0,0 +1,22 @@
# Check for forward iterator extension. This is modified from
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
AC_DEFUN([AC_CXX_HAVE_FWD_ITERATOR],
[AC_CACHE_CHECK(whether the compiler has forward iterators,
ac_cv_cxx_have_fwd_iterator,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <iterator>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif]], [[forward_iterator<int,int> t; return 0;]])],[ac_cv_cxx_have_fwd_iterator=yes],[ac_cv_cxx_have_fwd_iterator=no])
AC_LANG_POP([C++])
])
if test "$ac_cv_cxx_have_fwd_iterator" = yes
then
AC_DEFINE(HAVE_FWD_ITERATOR,1,[Have forward iterator])
else
AC_DEFINE(HAVE_FWD_ITERATOR,0,[Does not have forward iterator])
fi
])

View file

@ -0,0 +1,19 @@
# Check for C++ namespace support. This is from
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html
#
AC_DEFUN([AC_CXX_NAMESPACES],
[AC_CACHE_CHECK(whether the compiler implements namespaces,
ac_cv_cxx_namespaces,
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[namespace Outer { namespace Inner { int i = 0; }}]],
[[using namespace Outer::Inner; return i;]])],
ac_cv_cxx_namespaces=yes,
ac_cv_cxx_namespaces=no)
AC_LANG_POP([C++])
])
if test "$ac_cv_cxx_namespaces" = yes; then
AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces])
fi
])

View file

@ -0,0 +1,26 @@
# Check for standard iterator extension. This is modified from
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html
AC_DEFUN([AC_CXX_HAVE_STD_ITERATOR],
[AC_CACHE_CHECK(whether the compiler has the standard iterator,
ac_cv_cxx_have_std_iterator,
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <iterator>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif]],
[[iterator<int,int,int> t; return 0;]])],
ac_cv_cxx_have_std_iterator=yes,
ac_cv_cxx_have_std_iterator=no)
AC_LANG_POP([C++])
])
if test "$ac_cv_cxx_have_std_iterator" = yes
then
AC_DEFINE(HAVE_STD_ITERATOR,1,[Have std namespace iterator])
else
AC_DEFINE(HAVE_STD_ITERATOR,0,[Does not have std namespace iterator])
fi
])

View file

@ -0,0 +1,118 @@
dnl Check for a standard program that has a bin, include and lib directory
dnl
dnl Parameters:
dnl $1 - prefix directory to check
dnl $2 - program name to check
dnl $3 - header file to check
dnl $4 - library file to check
AC_DEFUN([CHECK_STD_PROGRAM],
[m4_define([allcapsname],translit($2,a-z,A-Z))
if test -n "$1" -a -d "$1" -a -n "$2" -a -d "$1/bin" -a -x "$1/bin/$2" ; then
AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"])
AC_SUBST(allcapsname(),[$1/bin/$2])
AC_SUBST(allcapsname()[_BIN],[$1/bin])
AC_SUBST(allcapsname()[_DIR],[$1])
if test -n "$3" -a -d "$1/include" -a -f "$1/include/$3" ; then
AC_SUBST(allcapsname()[_INC],[$1/include])
fi
if test -n "$4" -a -d "$1/lib" -a -f "$1/lib/$4" ; then
AC_SUBST(allcapsname()[_LIB],[$1/lib])
fi
fi
])
dnl Find a program via --with options, in the path, or well known places
dnl
dnl Parameters:
dnl $1 - program's executable name
dnl $2 - header file name to check (optional)
dnl $3 - library file name to check (optional)
dnl $4 - alternate (long) name for the program
AC_DEFUN([FIND_STD_PROGRAM],
[m4_define([allcapsname],translit($1,a-z,A-Z))
m4_define([stdprog_long_name],ifelse($4,,translit($1,[ !@#$%^&*()-+={}[]:;"',./?],[-]),translit($4,[ !@#$%^&*()-+={}[]:;"',./?],[-])))
AC_MSG_CHECKING([for ]stdprog_long_name()[ bin/lib/include locations])
AC_ARG_WITH($1,
AS_HELP_STRING([--with-]stdprog_long_name()[=DIR],
[Specify that the ]stdprog_long_name()[ install prefix is DIR]),
$1[pfxdir=$withval],$1[pfxdir=nada])
AC_ARG_WITH($1[-bin],
AS_HELP_STRING([--with-]stdprog_long_name()[-bin=DIR],
[Specify that the ]stdprog_long_name()[ binary is in DIR]),
$1[bindir=$withval],$1[bindir=nada])
AC_ARG_WITH($1[-lib],
AS_HELP_STRING([--with-]stdprog_long_name()[-lib=DIR],
[Specify that ]stdprog_long_name()[ libraries are in DIR]),
$1[libdir=$withval],$1[libdir=nada])
AC_ARG_WITH($1[-inc],
AS_HELP_STRING([--with-]stdprog_long_name()[-inc=DIR],
[Specify that the ]stdprog_long_name()[ includes are in DIR]),
$1[incdir=$withval],$1[incdir=nada])
eval pfxval=\$\{$1pfxdir\}
eval binval=\$\{$1bindir\}
eval incval=\$\{$1incdir\}
eval libval=\$\{$1libdir\}
if test "${pfxval}" != "nada" ; then
CHECK_STD_PROGRAM(${pfxval},$1,$2,$3)
elif test "${binval}" != "nada" ; then
if test "${libval}" != "nada" ; then
if test "${incval}" != "nada" ; then
if test -d "${binval}" ; then
if test -d "${incval}" ; then
if test -d "${libval}" ; then
AC_SUBST(allcapsname(),${binval}/$1)
AC_SUBST(allcapsname()[_BIN],${binval})
AC_SUBST(allcapsname()[_INC],${incval})
AC_SUBST(allcapsname()[_LIB],${libval})
AC_SUBST([USE_]allcapsname(),["USE_]allcapsname()[ = 1"])
AC_MSG_RESULT([found via --with options])
else
AC_MSG_RESULT([failed])
AC_MSG_ERROR([The --with-]$1[-libdir value must be a directory])
fi
else
AC_MSG_RESULT([failed])
AC_MSG_ERROR([The --with-]$1[-incdir value must be a directory])
fi
else
AC_MSG_RESULT([failed])
AC_MSG_ERROR([The --with-]$1[-bindir value must be a directory])
fi
else
AC_MSG_RESULT([failed])
AC_MSG_ERROR([The --with-]$1[-incdir option must be specified])
fi
else
AC_MSG_RESULT([failed])
AC_MSG_ERROR([The --with-]$1[-libdir option must be specified])
fi
else
tmppfxdir=`which $1 2>&1`
if test -n "$tmppfxdir" -a -d "${tmppfxdir%*$1}" -a \
-d "${tmppfxdir%*$1}/.." ; then
tmppfxdir=`cd "${tmppfxdir%*$1}/.." ; pwd`
CHECK_STD_PROGRAM($tmppfxdir,$1,$2,$3)
AC_MSG_RESULT([found in PATH at ]$tmppfxdir)
else
checkresult="yes"
eval checkval=\$\{"USE_"allcapsname()\}
CHECK_STD_PROGRAM([/usr],$1,$2,$3)
if test -z "${checkval}" ; then
CHECK_STD_PROGRAM([/usr/local],$1,$2,$3)
if test -z "${checkval}" ; then
CHECK_STD_PROGRAM([/sw],$1,$2,$3)
if test -z "${checkval}" ; then
CHECK_STD_PROGRAM([/opt],$1,$2,$3)
if test -z "${checkval}" ; then
CHECK_STD_PROGRAM([/],$1,$2,$3)
if test -z "${checkval}" ; then
checkresult="no"
fi
fi
fi
fi
fi
AC_MSG_RESULT($checkresult)
fi
fi
])

View file

@ -0,0 +1,17 @@
#
# Check for FLEX.
#
# This macro verifies that flex is installed. If successful, then
# 1) $LEX is set to "flex" (to emulate lex calls)
# 2) BISON is set to bison
AC_DEFUN([AC_PROG_FLEX],
[AC_CACHE_CHECK(,
ac_cv_has_flex,
[AC_PROG_LEX()
])
if test "$LEX" != "flex"; then
AC_MSG_ERROR([flex not found but required])
else
AC_SUBST(FLEX,[flex],[location of flex])
fi
])

View file

@ -0,0 +1,36 @@
#
# This function determins if the the isinf function isavailable on this
# platform.
#
AC_DEFUN([AC_FUNC_ISINF],[
AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_math_h],
[isinf], [<math.h>],
[float f; isinf(f);])
if test "$ac_cv_func_isinf_in_math_h" = "yes" ; then
AC_DEFINE([HAVE_ISINF_IN_MATH_H],1,[Set to 1 if the isinf function is found in <math.h>])
fi
AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_cmath],
[isinf], [<cmath>],
[float f; isinf(f);])
if test "$ac_cv_func_isinf_in_cmath" = "yes" ; then
AC_DEFINE([HAVE_ISINF_IN_CMATH],1,[Set to 1 if the isinf function is found in <cmath>])
fi
AC_SINGLE_CXX_CHECK([ac_cv_func_std_isinf_in_cmath],
[std::isinf], [<cmath>],
[float f; std::isinf(f)}])
if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then
AC_DEFINE([HAVE_STD_ISINF_IN_CMATH],1,[Set to 1 if the std::isinf function is found in <cmath>])
fi
AC_SINGLE_CXX_CHECK([ac_cv_func_finite_in_ieeefp_h],
[finite], [<ieeefp.h>],
[float f; finite(f);])
if test "$ac_cv_func_finite_in_ieeefp_h" = "yes" ; then
AC_DEFINE([HAVE_FINITE_IN_IEEEFP_H],1,[Set to 1 if the finite function is found in <ieeefp.h>])
fi
])

View file

@ -0,0 +1,27 @@
#
# This function determines if the isnan function is available on this
# platform.
#
AC_DEFUN([AC_FUNC_ISNAN],[
AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_math_h],
[isnan], [<math.h>],
[float f; isnan(f);])
if test "$ac_cv_func_isnan_in_math_h" = "yes" ; then
AC_DEFINE([HAVE_ISNAN_IN_MATH_H],1,[Set to 1 if the isnan function is found in <math.h>])
fi
AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_cmath],
[isnan], [<cmath>],
[float f; isnan(f);])
if test "$ac_cv_func_isnan_in_cmath" = "yes" ; then
AC_DEFINE([HAVE_ISNAN_IN_CMATH],1,[Set to 1 if the isnan function is found in <cmath>])
fi
AC_SINGLE_CXX_CHECK([ac_cv_func_std_isnan_in_cmath],
[std::isnan], [<cmath>],
[float f; std::isnan(f);])
if test "$ac_cv_func_std_isnan_in_cmath" = "yes" ; then
AC_DEFINE([HAVE_STD_ISNAN_IN_CMATH],1,[Set to 1 if the std::isnan function is found in <cmath>])
fi
])

View file

@ -0,0 +1,26 @@
#
# Check for the ability to mmap a file.
#
AC_DEFUN([AC_FUNC_MMAP_FILE],
[AC_CACHE_CHECK(for mmap of files,
ac_cv_func_mmap_file,
[ AC_LANG_PUSH([C])
AC_RUN_IFELSE([
AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
]],[[
int fd;
fd = creat ("foo",0777);
fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0);
unlink ("foo");
return (fd != (int) MAP_FAILED);]])],
[ac_cv_func_mmap_file=yes],[ac_cv_func_mmap_file=no],[ac_cv_func_mmap_file=no])
AC_LANG_POP([C])
])
if test "$ac_cv_func_mmap_file" = yes; then
AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory])
AC_SUBST(MMAP_FILE,[yes])
fi
])

View file

@ -0,0 +1,21 @@
#
# Check for anonymous mmap macros. This is modified from
# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
#
AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS],
[AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON,
ac_cv_header_mmap_anon,
[ AC_LANG_PUSH([C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>]],
[[mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);]])],
ac_cv_header_mmap_anon=yes,
ac_cv_header_mmap_anon=no)
AC_LANG_POP([C])
])
if test "$ac_cv_header_mmap_anon" = yes; then
AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON])
fi
])

View file

@ -0,0 +1,18 @@
#
# This function determins if the the HUGE_VAL macro is compilable with the
# -pedantic switch or not. XCode < 2.4.1 doesn't get it right.
#
AC_DEFUN([AC_HUGE_VAL_CHECK],[
AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
AC_LANG_PUSH([C++])
CXXFLAGS=-pedantic
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
[#include <math.h>],
[double x = HUGE_VAL; return x != x; ]),
[ac_cv_huge_val_sanity=yes],[ac_cv_huge_val_sanity=no],
[ac_cv_huge_val_sanity=yes])
AC_LANG_POP([C++])
])
AC_SUBST(HUGE_VAL_SANITY,$ac_cv_huge_val_sanity)
])

6389
libclamav/c++/llvm/autoconf/m4/libtool.m4 vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,41 @@
#
# Determine if the system can handle the -R option being passed to the linker.
#
# This macro is specific to LLVM.
#
AC_DEFUN([AC_LINK_USE_R],
[AC_CACHE_CHECK([for compiler -Wl,-R<path> option],[llvm_cv_link_use_r],
[ AC_LANG_PUSH([C])
oldcflags="$CFLAGS"
CFLAGS="$CFLAGS -Wl,-R."
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
[llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no])
CFLAGS="$oldcflags"
AC_LANG_POP([C])
])
if test "$llvm_cv_link_use_r" = yes ; then
AC_DEFINE([HAVE_LINK_R],[1],[Define if you can use -Wl,-R. to pass -R. to the linker, in order to add the current directory to the dynamic linker search path.])
fi
])
#
# Determine if the system can handle the -R option being passed to the linker.
#
# This macro is specific to LLVM.
#
AC_DEFUN([AC_LINK_EXPORT_DYNAMIC],
[AC_CACHE_CHECK([for compiler -Wl,-export-dynamic option],
[llvm_cv_link_use_export_dynamic],
[ AC_LANG_PUSH([C])
oldcflags="$CFLAGS"
CFLAGS="$CFLAGS -Wl,-export-dynamic"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
[llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no])
CFLAGS="$oldcflags"
AC_LANG_POP([C])
])
if test "$llvm_cv_link_use_export_dynamic" = yes ; then
AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -Wl,-export-dynamic.])
fi
])

View file

@ -0,0 +1,17 @@
#
# Some Linux machines run a 64-bit kernel with a 32-bit userspace. 'uname -m'
# shows these as x86_64. Ask the system 'gcc' what it thinks.
#
AC_DEFUN([AC_IS_LINUX_MIXED],
[AC_CACHE_CHECK(for 32-bit userspace on 64-bit system,llvm_cv_linux_mixed,
[ AC_LANG_PUSH([C])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#ifndef __x86_64__
error: Not x86-64 even if uname says so!
#endif
]])],
[llvm_cv_linux_mixed=no],
[llvm_cv_linux_mixed=yes])
AC_LANG_POP([C])
])
])

View file

@ -0,0 +1,418 @@
## ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
## Copyright (C) 1999-2000 Free Software Foundation, Inc.
##
## This file is free software; the Free Software Foundation gives
## unlimited permission to copy and/or distribute it, with or without
## modifications, as long as this notice is preserved.
# serial 7 AC_LIB_LTDL
# AC_WITH_LTDL
# ------------
# Clients of libltdl can use this macro to allow the installer to
# choose between a shipped copy of the ltdl sources or a preinstalled
# version of the library.
AC_DEFUN([AC_WITH_LTDL],
[AC_REQUIRE([AC_LIB_LTDL])
AC_SUBST([LIBLTDL])
AC_SUBST([INCLTDL])
# Unless the user asks us to check, assume no installed ltdl exists.
use_installed_libltdl=no
AC_ARG_WITH([included_ltdl],
[ --with-included-ltdl use the GNU ltdl sources included here])
if test "x$with_included_ltdl" != xyes; then
# We are not being forced to use the included libltdl sources, so
# decide whether there is a useful installed version we can use.
AC_CHECK_HEADER([ltdl.h],
[AC_CHECK_LIB([ltdl], [lt_dlcaller_register],
[with_included_ltdl=no],
[with_included_ltdl=yes])
])
fi
if test "x$enable_ltdl_install" != xyes; then
# If the user did not specify an installable libltdl, then default
# to a convenience lib.
AC_LIBLTDL_CONVENIENCE
fi
if test "x$with_included_ltdl" = xno; then
# If the included ltdl is not to be used. then Use the
# preinstalled libltdl we found.
AC_DEFINE([HAVE_LTDL], [1],
[Define this if a modern libltdl is already installed])
LIBLTDL=-lltdl
fi
# Report our decision...
AC_MSG_CHECKING([whether to use included libltdl])
AC_MSG_RESULT([$with_included_ltdl])
AC_CONFIG_SUBDIRS([libltdl])
])# AC_WITH_LTDL
# AC_LIB_LTDL
# -----------
# Perform all the checks necessary for compilation of the ltdl objects
# -- including compiler checks and header checks.
AC_DEFUN([AC_LIB_LTDL],
[AC_PREREQ(2.60)
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_C_CONST])
AC_REQUIRE([AC_HEADER_STDC])
AC_REQUIRE([AC_HEADER_DIRENT])
AC_REQUIRE([_LT_AC_CHECK_DLFCN])
AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])
AC_REQUIRE([AC_LTDL_SHLIBEXT])
AC_REQUIRE([AC_LTDL_SHLIBPATH])
AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])
AC_REQUIRE([AC_LTDL_OBJDIR])
AC_REQUIRE([AC_LTDL_DLPREOPEN])
AC_REQUIRE([AC_LTDL_DLLIB])
AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
AC_REQUIRE([AC_LTDL_DLSYM_USCORE])
AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])
AC_REQUIRE([AC_LTDL_FUNC_ARGZ])
AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \
stdio.h unistd.h])
AC_CHECK_HEADERS([dl.h sys/dl.h dld.h mach-o/dyld.h])
AC_CHECK_HEADERS([string.h strings.h], [break])
AC_CHECK_FUNCS([strchr index], [break])
AC_CHECK_FUNCS([strrchr rindex], [break])
AC_CHECK_FUNCS([memcpy bcopy], [break])
AC_CHECK_FUNCS([memmove strcmp])
AC_CHECK_FUNCS([closedir opendir readdir])
])# AC_LIB_LTDL
# AC_LTDL_ENABLE_INSTALL
# ----------------------
AC_DEFUN([AC_LTDL_ENABLE_INSTALL],
[AC_ARG_ENABLE([ltdl-install],
[AS_HELP_STRING([--enable-ltdl-install],[install libltdl])])
AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno)
AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)
])# AC_LTDL_ENABLE_INSTALL
# AC_LTDL_SYS_DLOPEN_DEPLIBS
# --------------------------
AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS],
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
[libltdl_cv_sys_dlopen_deplibs],
[# PORTME does your system automatically load deplibs for dlopen?
# or its logical equivalent (e.g. shl_load for HP-UX < 11)
# For now, we just catch OSes we know something about -- in the
# future, we'll try test this programmatically.
libltdl_cv_sys_dlopen_deplibs=unknown
case "$host_os" in
aix3*|aix4.1.*|aix4.2.*)
# Unknown whether this is true for these versions of AIX, but
# we want this `case' here to explicitly catch those versions.
libltdl_cv_sys_dlopen_deplibs=unknown
;;
aix[[45]]*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
darwin*)
# Assuming the user has installed a libdl from somewhere, this is true
# If you are looking for one http://www.opendarwin.org/projects/dlcompat
libltdl_cv_sys_dlopen_deplibs=yes
;;
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
# GNU and its variants, using gnu ld.so (Glibc)
libltdl_cv_sys_dlopen_deplibs=yes
;;
hpux10*|hpux11*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
interix*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
irix[[12345]]*|irix6.[[01]]*)
# Catch all versions of IRIX before 6.2, and indicate that we don't
# know how it worked for any of those versions.
libltdl_cv_sys_dlopen_deplibs=unknown
;;
irix*)
# The case above catches anything before 6.2, and it's known that
# at 6.2 and later dlopen does load deplibs.
libltdl_cv_sys_dlopen_deplibs=yes
;;
netbsd*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
openbsd*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
osf[[1234]]*)
# dlopen did load deplibs (at least at 4.x), but until the 5.x series,
# it did *not* use an RPATH in a shared library to find objects the
# library depends on, so we explictly say `no'.
libltdl_cv_sys_dlopen_deplibs=no
;;
osf5.0|osf5.0a|osf5.1)
# dlopen *does* load deplibs and with the right loader patch applied
# it even uses RPATH in a shared library to search for shared objects
# that the library depends on, but there's no easy way to know if that
# patch is installed. Since this is the case, all we can really
# say is unknown -- it depends on the patch being installed. If
# it is, this changes to `yes'. Without it, it would be `no'.
libltdl_cv_sys_dlopen_deplibs=unknown
;;
osf*)
# the two cases above should catch all versions of osf <= 5.1. Read
# the comments above for what we know about them.
# At > 5.1, deplibs are loaded *and* any RPATH in a shared library
# is used to find them so we can finally say `yes'.
libltdl_cv_sys_dlopen_deplibs=yes
;;
solaris*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
esac
])
if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then
AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1],
[Define if the OS needs help to load dependent libraries for dlopen().])
fi
])# AC_LTDL_SYS_DLOPEN_DEPLIBS
# AC_LTDL_SHLIBEXT
# ----------------
AC_DEFUN([AC_LTDL_SHLIBEXT],
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
AC_CACHE_CHECK([which extension is used for loadable modules],
[libltdl_cv_shlibext],
[
module=yes
eval libltdl_cv_shlibext=$shrext_cmds
])
if test -n "$libltdl_cv_shlibext"; then
AC_DEFINE_UNQUOTED([LTDL_SHLIB_EXT], ["$libltdl_cv_shlibext"],
[Define to the extension used for shared libraries, say, ".so".])
fi
])# AC_LTDL_SHLIBEXT
# AC_LTDL_SHLIBPATH
# -----------------
AC_DEFUN([AC_LTDL_SHLIBPATH],
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
AC_CACHE_CHECK([which variable specifies run-time library path],
[libltdl_cv_shlibpath_var], [libltdl_cv_shlibpath_var="$shlibpath_var"])
if test -n "$libltdl_cv_shlibpath_var"; then
AC_DEFINE_UNQUOTED([LTDL_SHLIBPATH_VAR], ["$libltdl_cv_shlibpath_var"],
[Define to the name of the environment variable that determines the dynamic library search path.])
fi
])# AC_LTDL_SHLIBPATH
# AC_LTDL_SYSSEARCHPATH
# ---------------------
AC_DEFUN([AC_LTDL_SYSSEARCHPATH],
[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
AC_CACHE_CHECK([for the default library search path],
[libltdl_cv_sys_search_path],
[libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"])
if test -n "$libltdl_cv_sys_search_path"; then
sys_search_path=
for dir in $libltdl_cv_sys_search_path; do
if test -z "$sys_search_path"; then
sys_search_path="$dir"
else
sys_search_path="$sys_search_path$PATH_SEPARATOR$dir"
fi
done
AC_DEFINE_UNQUOTED([LTDL_SYSSEARCHPATH], ["$sys_search_path"],
[Define to the system default library search path.])
fi
])# AC_LTDL_SYSSEARCHPATH
# AC_LTDL_OBJDIR
# --------------
AC_DEFUN([AC_LTDL_OBJDIR],
[AC_CACHE_CHECK([for objdir],
[libltdl_cv_objdir],
[libltdl_cv_objdir="$objdir"
if test -n "$objdir"; then
:
else
rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
if test -d .libs; then
libltdl_cv_objdir=.libs
else
# MS-DOS does not allow filenames that begin with a dot.
libltdl_cv_objdir=_libs
fi
rmdir .libs 2>/dev/null
fi
])
AC_DEFINE_UNQUOTED([LTDL_OBJDIR], ["$libltdl_cv_objdir/"],
[Define to the sub-directory in which libtool stores uninstalled libraries.])
])# AC_LTDL_OBJDIR
# AC_LTDL_DLPREOPEN
# -----------------
AC_DEFUN([AC_LTDL_DLPREOPEN],
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen],
[libltdl_cv_preloaded_symbols],
[if test -n "$lt_cv_sys_global_symbol_pipe"; then
libltdl_cv_preloaded_symbols=yes
else
libltdl_cv_preloaded_symbols=no
fi
])
if test x"$libltdl_cv_preloaded_symbols" = xyes; then
AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1],
[Define if libtool can extract symbol lists from object files.])
fi
])# AC_LTDL_DLPREOPEN
# AC_LTDL_DLLIB
# -------------
AC_DEFUN([AC_LTDL_DLLIB],
[LIBADD_DL=
AC_SUBST(LIBADD_DL)
AC_LANG_PUSH([C])
AC_CHECK_FUNC([shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
[Define if you have the shl_load function.])],
[AC_CHECK_LIB([dld], [shl_load],
[AC_DEFINE([HAVE_SHL_LOAD], [1],
[Define if you have the shl_load function.])
LIBADD_DL="$LIBADD_DL -ldld"],
[AC_CHECK_LIB([dl], [dlopen],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
]], [[dlopen(0, 0);]])],[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes"],[AC_CHECK_LIB([svld], [dlopen],
[AC_DEFINE([HAVE_LIBDL], [1],
[Define if you have the libdl library or equivalent.])
LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"],
[AC_CHECK_LIB([dld], [dld_link],
[AC_DEFINE([HAVE_DLD], [1],
[Define if you have the GNU dld library.])
LIBADD_DL="$LIBADD_DL -ldld"],
[AC_CHECK_FUNC([_dyld_func_lookup],
[AC_DEFINE([HAVE_DYLD], [1],
[Define if you have the _dyld_func_lookup function.])])
])
])
])
])
])
])
if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes
then
lt_save_LIBS="$LIBS"
LIBS="$LIBS $LIBADD_DL"
AC_CHECK_FUNCS([dlerror])
LIBS="$lt_save_LIBS"
fi
AC_LANG_POP
])# AC_LTDL_DLLIB
# AC_LTDL_SYMBOL_USCORE
# ---------------------
# does the compiler prefix global symbols with an underscore?
AC_DEFUN([AC_LTDL_SYMBOL_USCORE],
[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])
AC_CACHE_CHECK([for _ prefix in compiled symbols],
[ac_cv_sys_symbol_underscore],
[ac_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<EOF
void nm_test_func(){}
int main(){nm_test_func;return 0;}
EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
ac_nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
# See whether the symbols have a leading underscore.
if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
ac_cv_sys_symbol_underscore=yes
else
if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
:
else
echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD
fi
fi
else
echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
fi
else
echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
cat conftest.c >&AS_MESSAGE_LOG_FD
fi
rm -rf conftest*
])
])# AC_LTDL_SYMBOL_USCORE
# AC_LTDL_DLSYM_USCORE
# --------------------
AC_DEFUN([AC_LTDL_DLSYM_USCORE],
[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])
if test x"$ac_cv_sys_symbol_underscore" = xyes; then
if test x"$libltdl_cv_func_dlopen" = xyes ||
test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
[libltdl_cv_need_uscore],
[libltdl_cv_need_uscore=unknown
save_LIBS="$LIBS"
LIBS="$LIBS $LIBADD_DL"
_LT_AC_TRY_DLOPEN_SELF(
[libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes],
[], [libltdl_cv_need_uscore=cross])
LIBS="$save_LIBS"
])
fi
fi
if test x"$libltdl_cv_need_uscore" = xyes; then
AC_DEFINE([NEED_USCORE], [1],
[Define if dlsym() requires a leading underscore in symbol names.])
fi
])# AC_LTDL_DLSYM_USCORE
# AC_LTDL_FUNC_ARGZ
# -----------------
AC_DEFUN([AC_LTDL_FUNC_ARGZ],
[AC_CHECK_HEADERS([argz.h])
AC_CHECK_TYPES([error_t],
[],
[AC_DEFINE([error_t], [int],
[Define to a type to use for `error_t' if it is not otherwise available.])],
[#if HAVE_ARGZ_H
# include <argz.h>
#endif])
AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify])
])# AC_LTDL_FUNC_ARGZ

View file

@ -0,0 +1,17 @@
#
# When allocating RWX memory, check whether we need to use /dev/zero
# as the file descriptor or not.
#
AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP],
[AC_CACHE_CHECK([if /dev/zero is needed for mmap],
ac_cv_need_dev_zero_for_mmap,
[if test "$llvm_cv_os_type" = "Interix" ; then
ac_cv_need_dev_zero_for_mmap=yes
else
ac_cv_need_dev_zero_for_mmap=no
fi
])
if test "$ac_cv_need_dev_zero_for_mmap" = yes; then
AC_DEFINE([NEED_DEV_ZERO_FOR_MMAP],[1],
[Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary])
fi])

View file

@ -0,0 +1,16 @@
dnl Check for a reasonable version of Perl.
dnl $1 - Minimum Perl version. Typically 5.006.
dnl
AC_DEFUN([LLVM_PROG_PERL], [
AC_PATH_PROG(PERL, [perl], [none])
if test "$PERL" != "none"; then
AC_MSG_CHECKING(for Perl $1 or newer)
if $PERL -e 'use $1;' 2>&1 > /dev/null; then
AC_MSG_RESULT(yes)
else
PERL=none
AC_MSG_RESULT(not found)
fi
fi
])

View file

@ -0,0 +1,39 @@
dnl This macro checks for tclsh which is required to run dejagnu. On some
dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles
dnl that for us so we can get the latest installed tclsh version.
dnl
AC_DEFUN([DJ_AC_PATH_TCLSH], [
no_itcl=true
AC_MSG_CHECKING(for the tclsh program in tclinclude directory)
AC_ARG_WITH(tclinclude,
AS_HELP_STRING([--with-tclinclude],
[directory where tcl headers are]),
[with_tclinclude=${withval}],[with_tclinclude=''])
AC_CACHE_VAL(ac_cv_path_tclsh,[
dnl first check to see if --with-itclinclude was specified
if test x"${with_tclinclude}" != x ; then
if test -f ${with_tclinclude}/tclsh ; then
ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)`
elif test -f ${with_tclinclude}/src/tclsh ; then
ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)`
else
AC_MSG_ERROR([${with_tclinclude} directory doesn't contain tclsh])
fi
fi
dnl see if one is installed
if test x"${ac_cv_path_tclsh}" = x ; then
AC_MSG_RESULT(none)
AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh])
if test x"${TCLSH}" = x ; then
ac_cv_path_tclsh='';
else
ac_cv_path_tclsh="${TCLSH}";
fi
else
AC_MSG_RESULT(${ac_cv_path_tclsh})
TCLSH="${ac_cv_path_tclsh}"
AC_SUBST(TCLSH)
fi
])])

View file

@ -0,0 +1,12 @@
#
# This function determins if the the srand48,drand48,lrand48 functions are
# available on this platform.
#
AC_DEFUN([AC_FUNC_RAND48],[
AC_SINGLE_CXX_CHECK([ac_cv_func_rand48],
[srand48/lrand48/drand48], [<stdlib.h>],
[srand48(0);lrand48();drand48();])
if test "$ac_cv_func_rand48" = "yes" ; then
AC_DEFINE([HAVE_RAND48],1,[Define to 1 if srand48/lrand48/drand48 exist in <stdlib.h>])
fi
])

View file

@ -0,0 +1,31 @@
dnl Check a program for version sanity. The test runs a program, passes it an
dnl argument to make it print out some identification string, and filters that
dnl output with a regular expression. If the output is non-empty, the program
dnl passes the sanity check.
dnl $1 - Name or full path of the program to run
dnl $2 - Argument to pass to print out identification string
dnl $3 - grep RE to match identification string
dnl $4 - set to 1 to make errors only a warning
AC_DEFUN([CHECK_PROGRAM_SANITY],
[
AC_MSG_CHECKING([sanity for program ]$1)
sanity="0"
sanity_path=`which $1 2>/dev/null`
if test "$?" -eq 0 -a -x "$sanity_path" ; then
sanity=`$1 $2 2>&1 | grep "$3"`
if test -z "$sanity" ; then
AC_MSG_RESULT([no])
sanity="0"
if test "$4" -eq 1 ; then
AC_MSG_WARN([Program ]$1[ failed to pass sanity check.])
else
AC_MSG_ERROR([Program ]$1[ failed to pass sanity check.])
fi
else
AC_MSG_RESULT([yes])
sanity="1"
fi
else
AC_MSG_RESULT([not found])
fi
])

View file

@ -0,0 +1,10 @@
dnl AC_SINGLE_CXX_CHECK(CACHEVAR, FUNCTION, HEADER, PROGRAM)
dnl $1, $2, $3, $4,
dnl
AC_DEFUN([AC_SINGLE_CXX_CHECK],
[AC_CACHE_CHECK([for $2 in $3], [$1],
[AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include $3],[$4]),[$1=yes],[$1=no])
AC_LANG_POP([C++])])
])

View file

@ -0,0 +1,22 @@
#
# Determine if the compiler accepts -fvisibility-inlines-hidden
#
# This macro is specific to LLVM.
#
AC_DEFUN([AC_CXX_USE_VISIBILITY_INLINES_HIDDEN],
[AC_CACHE_CHECK([for compiler -fvisibility-inlines-hidden option],
[llvm_cv_cxx_visibility_inlines_hidden],
[ AC_LANG_PUSH([C++])
oldcxxflags="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[llvm_cv_cxx_visibility_inlines_hidden=yes],[llvm_cv_cxx_visibility_inlines_hidden=no])
CXXFLAGS="$oldcxxflags"
AC_LANG_POP([C++])
])
if test "$llvm_cv_cxx_visibility_inlines_hidden" = yes ; then
AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[1])
else
AC_SUBST([ENABLE_VISIBILITY_INLINES_HIDDEN],[0])
fi
])

View file

@ -0,0 +1,353 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2004-09-07.08
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program 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. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit 0
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit 0
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

Some files were not shown because too many files have changed in this diff Show more