Skip to content

Commit 61c434f

Browse files
author
Konrad Rieck
committed
Added basic autoconf/automake files
1 parent ccc6580 commit 61c434f

14 files changed

+888
-1
lines changed

Makefile.am

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# MALHEUR - Automatic Malware Analysis on Steroids
3+
# Copyright (c) 2009 Konrad Rieck (rieck@cs.tu-berlin.de)
4+
# Berlin Institute of Technology (TU Berlin).
5+
# --
6+
#
7+
8+
AUTOMAKE_OPTIONS = foreign
9+
SUBDIRS = src
10+
ACLOCAL_AMFLAGS = -I m4
11+
EXTRA_DIST = CHANGES README INSTALL COPYING
12+
13+
mostlyclean-local:
14+
rm -f *~
15+

README

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
MALHEUR - Automatic Malware Analysis on Steroids
33
Copyright (c) 2009 Konrad Rieck (rieck@cs.tu-berlin.de)
44
Berlin Institute of Technology (TU Berlin).
5-
5+
--
66

77
Software dependencies
88
--

bootstrap

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
# MALHEUR - Automatic Malware Analysis on Steroids
3+
# Copyright (c) 2009 Konrad Rieck (rieck@cs.tu-berlin.de)
4+
# Berlin Institute of Technology (TU Berlin).
5+
#
6+
7+
export PATH=/opt/local/bin:$PATH:/usr/local/bin
8+
9+
ACLOCAL=aclocal
10+
AUTOHEADER=autoheader
11+
AUTOMAKE=automake
12+
AUTOCONF=autoconf
13+
LIBTOOLIZE=libtoolize
14+
15+
case `uname -s` in
16+
OpenBSD)
17+
export AUTOMAKE_VERSION=1.9
18+
export AUTOCONF_VERSION=2.59
19+
;;
20+
esac
21+
22+
echo "Autotools"
23+
echo " + aclocal..." && $ACLOCAL -I m4 && \
24+
echo " + libtoolize..." && $LIBTOOLIZE --force --copy && \
25+
echo " + autoheader..." && $AUTOHEADER -f && \
26+
echo " + automake..." && $AUTOMAKE --foreign --add-missing --copy && \
27+
echo " + autoconf..." && $AUTOCONF
28+
29+
echo "Bootstrap complete"
30+
exit

compile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
# MALHEUR - Automatic Malware Analysis on Steroids
3+
# Copyright (c) 2009 Konrad Rieck (rieck@cs.tu-berlin.de)
4+
# Berlin Institute of Technology (TU Berlin).
5+
#
6+
7+
# Get requested configuration
8+
if test -n "$1" ; then
9+
arg=$1
10+
else
11+
arg=`hostname`
12+
fi
13+
14+
# Apply configuration
15+
case $arg in
16+
bot*|vnc*)
17+
echo "# Configuration: VNC/Bot"
18+
PKG_CONFIG_PATH="$HOME/usr/lib/pkgconfig" \
19+
CC="gcc-4.3" \
20+
CFLAGS="-fomit-frame-pointer -pedantic -pipe -O3 -march=opteron" \
21+
./configure --enable-matlab --with-matlab=/home/matrix/matlab \
22+
--enable-openmp \
23+
--prefix=$HOME/usr
24+
;;
25+
twoface*|rieck*)
26+
echo "# Configuration: Twoface/Rieck"
27+
CC="gcc-mp-4.3" \
28+
CFLAGS="-fomit-frame-pointer -pedantic -pipe -O3 -march=nocona" \
29+
./configure --enable-matlab -with-matlab=$HOME/Applications/Matlab \
30+
--enable-openmp \
31+
--prefix=/opt/malheur
32+
;;
33+
*)
34+
echo "# Configuration: Standard"
35+
CFLAGS="-g -pedantic -pipe -O3" \
36+
./configure
37+
;;
38+
esac
39+
40+
if test $? -gt 0 ; then
41+
echo "Error: Configuration failed"
42+
exit 1
43+
fi
44+
45+
# Compile
46+
make clean
47+
make -j 4

configure.in

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# MALHEUR - Automatic Malware Analysis on Steroids
2+
# Copyright (c) 2009 Konrad Rieck (rieck@cs.tu-berlin.de)
3+
# Berlin Institute of Technology (TU Berlin).
4+
#
5+
6+
# Malheur version
7+
AC_INIT([malheur], [0.1.0], [rieck@cs.tu-berlin.de])
8+
9+
# Defines (suitable for loading and saving versioned files)
10+
AC_DEFINE(MALHEUR_MAJOR, 0, Major version number)
11+
AC_DEFINE(MALHEUR_MINOR, 1, Minor version number)
12+
AC_DEFINE(MALHEUR_PATCH, 0, Patch version number)
13+
14+
echo
15+
echo " :: MALHEUR - Automatic Malware Analysis on Steroids"
16+
echo " Copyright (c) 2009 Konrad Rieck (rieck@cs.tu-berlin.de)"
17+
echo " Berlin Institute of Technology (TU Berlin)."
18+
echo
19+
20+
# Init automake & config.h
21+
AM_INIT_AUTOMAKE
22+
AM_CONFIG_HEADER([config.h])
23+
24+
# Check for important programs
25+
AC_PROG_CC
26+
AC_PROG_LD
27+
AC_PROG_INSTALL
28+
29+
# Libtool stuff
30+
AC_CONFIG_MACRO_DIR(m4)
31+
AC_PROG_LIBTOOL
32+
33+
# Set GCC and C99 flags if present
34+
if test "${GCC}" = "yes" ; then
35+
CFLAGS="${CFLAGS} -std=c99 -Wall"
36+
fi
37+
38+
AC_ARG_ENABLE(openmp,
39+
[ --enable-openmp enable support for OpenMP (experimental) ],
40+
[
41+
if test "x$enableval" = "xyes" ; then
42+
MALHEUR_OPENMP=yes
43+
AC_DEFINE(MALHEUR_OPENMP, 1, [Enable support for OpenMP (experimental)])
44+
else
45+
MALHEUR_OPENMP=no
46+
fi
47+
], [ MALHEUR_OPENMP=no ]
48+
)
49+
50+
# OpenMP support
51+
AX_OPENMP([
52+
HAVE_OPENMP=yes
53+
AC_DEFINE(HAVE_OPENMP, 1, [Enable OpenMP support])
54+
],[
55+
HAVE_OPENMP=no
56+
])
57+
58+
if test "x$MALHEUR_OPENMP" = "xyes" ; then
59+
if test "x$HAVE_OPENMP" = "xno" ; then
60+
AC_MSG_ERROR([OpenMP support enabled but OpenMP not available])
61+
fi
62+
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
63+
fi
64+
65+
# Library checks
66+
PKG_CHECK_MODULES([PKGCONFIG], [libconfig >= 1.3.1])
67+
CFLAGS="$CFLAGS $PKGCONFIG_CFLAGS"
68+
LIBS="$LIBS $PKGCONFIG_LIBS"
69+
INCLUDES="$INCLUDES `pkg-config --cflags-only-I libconfig`"
70+
71+
# Math library
72+
AC_CHECK_HEADERS([math.h], HEADER_MATH="yes")
73+
AC_CHECK_LIB([m], pow, LIBRARY_MATH="yes")
74+
if test "x$LIBRARY_MATH" != "x" && test "x$HEADER_MATH" != "x" ; then
75+
LIBS="-lm $LIBS"
76+
else
77+
AC_MSG_ERROR([The math library (libm) is required for compilation])
78+
fi
79+
80+
# Check headers
81+
AC_CHECK_HEADERS([string.h strings.h])
82+
83+
# Check functions
84+
AC_CHECK_FUNC(round, AC_DEFINE(HAVE_FUNC_ROUND, 1,
85+
[Define to 1 if you have the function round]))
86+
AC_CHECK_FUNC(log2, AC_DEFINE(HAVE_FUNC_LOG2, 1,
87+
[Define to 1 if you have the function log2]))
88+
89+
# Check matlab support
90+
AC_ARG_ENABLE(matlab,
91+
[ --enable-matlab enable optional Matlab tools],
92+
[
93+
if test "x$enableval" = "xyes" ; then
94+
MATLAB_TOOLS=yes
95+
else
96+
MATLAB_TOOLS=no
97+
fi
98+
], [ MATLAB_TOOLS=no ]
99+
)
100+
if test $MATLAB_TOOLS = yes ; then
101+
AX_MATLAB
102+
AX_MATLAB_ARCH
103+
AX_MATLAB_VERSION
104+
AX_MATLAB_DIR
105+
AX_MEX_OPTIONS
106+
AX_PATH_MEX
107+
AX_MEXEXT
108+
if test x$ax_enable_matlab = xyes ; then
109+
HAVE_MATLAB="yes"
110+
else
111+
HAVE_MATLAB="no"
112+
fi
113+
fi
114+
115+
if test "x$MATLAB_TOOLS" = "xyes" && test "x$HAVE_MATLAB" = "xno" ; then
116+
AC_MSG_ERROR([Matlab tools enabled but Matlab not available])
117+
fi
118+
AM_CONDITIONAL(MATLAB_TOOLS, test "x$MATLAB_TOOLS" = "xyes")
119+
120+
AC_SUBST([INCLUDES])
121+
122+
AC_CONFIG_FILES([
123+
Makefile \
124+
])
125+
126+
AC_OUTPUT_COMMANDS([],[
127+
MALHEUR_OPENMP=$MALHEUR_OPENMP
128+
])
129+
130+
AC_OUTPUT
131+
132+
echo
133+
echo " :: Environment: "
134+
echo " CC: '$CC'"
135+
echo " CFLAGS: '$CFLAGS'"
136+
echo " LD: '$LD'"
137+
echo " LDFLAGS: '$LDFLAGS'"
138+
echo " :: Features:"
139+
echo " Matlab tools: $MATLAB_TOOLS "
140+
echo " OpenMP support: $MALHEUR_OPENMP "

m4/ac_openmp.m4

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
AC_DEFUN([AX_OPENMP], [
2+
AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
3+
4+
AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
5+
ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
6+
# Flags to try: -fopenmp (gcc), -openmp (icc), -mp (SGI & PGI),
7+
# -xopenmp (Sun), -omp (Tru64), -qsmp=omp (AIX), none
8+
ax_openmp_flags="-fopenmp -openmp -mp -xopenmp -omp -qsmp=omp none"
9+
if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then
10+
ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags"
11+
fi
12+
for ax_openmp_flag in $ax_openmp_flags; do
13+
case $ax_openmp_flag in
14+
none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
15+
*) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
16+
esac
17+
AC_TRY_LINK_FUNC(omp_set_num_threads,
18+
[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break])
19+
done
20+
[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
21+
])
22+
if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then
23+
m4_default([$2],:)
24+
else
25+
if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then
26+
OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp
27+
fi
28+
m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])])
29+
fi
30+
])dnl AX_OPENMP

0 commit comments

Comments
 (0)