forked from Cr4sh/openreil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
110 lines (87 loc) · 2.64 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(OpenREIL, 0.1, cr4sh0@gmail.com)
AC_CONFIG_SRCDIR([libasmir/src/irtoir.cpp])
AC_CONFIG_HEADER([libasmir/config.h])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AM_PATH_PYTHON(, , AC_MSG_ERROR([Python not found]))
AC_CHECK_PROG(CYTHON_FOUND, cython, yes)
if test x"$CYTHON_FOUND" != x"yes" ; then
AC_MSG_ERROR([Cython not found])
fi
# Python library
AC_CHECK_LIB([python$PYTHON_VERSION], [Py_Initialize], , AC_MSG_ERROR([Python library not found]))
# Add -DAMD64 when needed
if test "$(uname -m)" == "x86_64";
then export CFLAGS="$CFLAGS -DAMD64";
fi
AC_SUBST(XED_DIR)
XED_DIR=`pwd`/'xed2-ia32'
AC_SUBST(CAPSTONE_DIR)
CAPSTONE_DIR=`pwd`/'capstone/capstone'
AC_SUBST(DISASM_NAME)
DISASM_NAME='capstone'
AC_SUBST(DISASM_INC)
DISASM_INC='${CAPSTONE_DIR}/include'
# OS-specific stuff
AC_SUBST(LIB_EXT)
case "$(uname -a)" in
Linux*)
LIB_EXT="a"
;;
Darwin*)
LIB_EXT="a"
;;
MINGW*)
LIB_EXT="lib"
LIBS="$LIBS -lintl"
;;
esac
# VEX stuff
AC_SUBST(VEX_DIR)
VEX_DIR=`pwd`/'VEX'
VEX_VERSION=2201
AC_SUBST(INCDIRS)
rm -f libasmir/makefile.inc
echo "VEX_DIR=${VEX_DIR}" >> libasmir/makefile.inc
echo "LIBASMIR_CXXFLAGS=-I${VEX_DIR}/pub -I`pwd`/src/include $CXXFLAGS" >> libasmir/makefile.inc
echo "LIBASMIR_LDFLAGS=-L${VEX_DIR} -L`pwd`/src $LDFLAGS" >> libasmir/makefile.inc
echo "LIBASMIR_LIBS=-lasmir -lvex" >> libasmir/makefile.inc
echo "CLIBS=asmir vex stdc++" >> libasmir/makefile.inc
AC_SUBST(ASMIR_DIR)
ASMIR_DIR="`pwd`/libasmir"
AC_SUBST(BAP_DIR)
BAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
AC_SUBST(OPENREIL_DIR)
OPENREIL_DIR="`pwd`/libopenreil"
AC_SUBST(PYOPENREIL_DIR)
PYOPENREIL_DIR="`pwd`/pyopenreil"
echo "prefix=${prefix}" > pyopenreil/src/makefile.inc
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h stdio.h string.h unistd.h], ,
AC_MSG_ERROR([Standard headers missing]))
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
AC_DEFINE_UNQUOTED([VEX_VERSION], [${VEX_VERSION}], [The VEX SVN Version])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_CHECK_FUNCS([bzero memset strstr strtoul])
# Check for library function versions
AC_CONFIG_FILES([Makefile
libasmir/Makefile
libasmir/src/Makefile
libopenreil/Makefile
libopenreil/src/Makefile
libopenreil/apps/Makefile
pyopenreil/Makefile])
AC_OUTPUT