Imported Debian patch 2.0.1+dfsg-1
[packages/binwalk.git] / configure.ac
1 AC_PREREQ([2.65])
2 AC_INIT()
3
4 AC_PROG_CC
5 AC_LANG(C)
6
7 AC_TYPE_SIZE_T
8 AC_FUNC_MALLOC
9
10 AC_ARG_WITH([python],
11             [AS_HELP_STRING([--with-python=python], [explicitly install using the specified python interpreter (python2, python3, etc)])],
12             [PYTHON=$withval],
13             [PYTHON=python])
14
15 AC_ARG_ENABLE([clibs],
16               [AS_HELP_STRING([--disable-clibs], [do not build/install binwalk c libraries])],
17               [BUILD_C_LIBS=0],
18               [BUILD_C_LIBS=1])
19
20 AC_ARG_ENABLE([bundles],
21               [AS_HELP_STRING([--disable-bundles], [do not build/install any bundled software])],
22               [BUILD_BUNDLES=0],
23               [BUILD_BUNDLES=1])
24
25 AC_ARG_ENABLE([libmagic],
26               [AS_HELP_STRING([--disable-libmagic], [do not build/install the bundled libmagic library])],
27               [BUILD_MAGIC=0],
28               [BUILD_MAGIC=1])
29
30 AC_ARG_ENABLE([libfuzzy],
31               [AS_HELP_STRING([--disable-libfuzzy], [do not build/install the bundled libfuzzy library])],
32               [BUILD_FUZZY=0],
33               [BUILD_FUZZY=1])
34
35 AC_ARG_ENABLE([pyqtgraph],
36               [AS_HELP_STRING([--disable-pyqtgraph], [do not build/install the bundled pyqtgraph module])],
37               [BUILD_PYQTGRAPH=0],
38               [BUILD_PYQTGRAPH=1])
39
40 CFLAGS="-Wall -fPIC $CFLAGS"
41 INSTALL_OPTIONS="-m644"
42
43 if test "$prefix" != "NONE"
44 then
45     echo "install prefix: $prefix"
46 fi
47
48 if test "$(uname)" == "Darwin"
49 then
50         SONAME="-install_name"
51         SOEXT="dylib"
52 else
53         SONAME="-soname"
54         SOEXT="so"
55 fi
56
57 if test "$BUILD_BUNDLES" == "0"
58 then
59     BUILD_MAGIC=0
60     BUILD_FUZZY=0
61     BUILD_PYQTGRAPH=0
62 fi
63
64 if test "$BUILD_MAGIC" != "0"
65 then
66     rm -rf $(ls ./src/bundles/file-*.tar.gz | sed -e 's/\.tar\.gz//')
67     (cd ./src/bundles && tar -zxvf file-*.tar.gz > /dev/null)
68     (cd ./src/bundles/file-*/ && ./configure) || exit 1
69 fi
70
71 if test "$BUILD_FUZZY" != "0"
72 then
73     rm -rf $(ls ./src/bundles/ssdeep-*.tar.gz | sed -e 's/\.tar\.gz//')
74     (cd ./src/bundles && tar -zxvf ssdeep-*.tar.gz > /dev/null)
75     (cd ./src/bundles/ssdeep-*/ && ./configure) || exit 1
76 fi
77
78 if test "$BUILD_PYQTGRAPH" != "0"
79 then
80     (cd ./src/bundles && tar -zxvf pyqtgraph-*.tar.gz > /dev/null)
81 fi
82
83 AC_SUBST(BUILD_C_LIBS, $BUILD_C_LIBS)
84 AC_SUBST(BUILD_BUNDLES, $BUILD_BUNDLES)
85 AC_SUBST(BUILD_MAGIC, $BUILD_MAGIC)
86 AC_SUBST(BUILD_FUZZY, $BUILD_FUZZY)
87 AC_SUBST(BUILD_PYQTGRAPH, $BUILD_PYQTGRAPH)
88 AC_SUBST(PYTHON, $PYTHON)
89 AC_SUBST(SONAME, $SONAME)
90 AC_SUBST(SOEXT, $SOEXT)
91 AC_SUBST(PLATFORM, $(uname -s))
92 AC_SUBST(INSTALL_OPTIONS, $INSTALL_OPTIONS)
93 AC_CONFIG_FILES([Makefile])
94 AC_OUTPUT