Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 357 lines (316 sloc) 13.081 kb
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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.


AC_PREREQ(2.59)

AC_INIT(sleuthkit, 4.0.0b1)
m4_include([m4/ax_pthread.m4])
# include the version from 1.12.1. This will work for
m4_include([m4/cppunit.m4])
m4_include([m4/ax_jni_include_dir.m4])
m4_include([m4/ac_prog_javac_works.m4])
m4_include([m4/ac_prog_javac.m4])


AC_CONFIG_SRCDIR([tsk3/base/tsk_base.h])
AM_CONFIG_HEADER([tsk3/tsk_config.h])
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE([foreign])
AM_PATH_CPPUNIT(1.12.1)
AM_CONDITIONAL([CPPUNIT],[test "x$no_cppunit" = x])
AM_PROG_LIBTOOL
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([m4])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PATH_PROG(PERL, perl)


# Checks for header files.
AC_HEADER_STDC
#AC_HEADER_MAJOR
#AC_HEADER_SYS_WAIT
#AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h locale.h memory.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/time.h unistd.h utime.h wchar.h wctype.h])
AC_CHECK_HEADERS([inttypes.h unistd.h sys/param.h])


# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
#AC_CHECK_MEMBERS([struct stat.st_rdev])
#AC_HEADER_TIME
#AC_STRUCT_TM

# check for large file support
AC_SYS_LARGEFILE

# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_ERROR_AT_LINE
#AC_FUNC_FORK
AC_FUNC_FSEEKO
AC_PROG_GCC_TRADITIONAL
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
#AC_FUNC_MALLOC
#AC_FUNC_MBRTOWC
#AC_FUNC_MEMCMP
#AC_FUNC_MKTIME
#AC_FUNC_MMAP
#AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
#AC_FUNC_STAT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
#AC_CHECK_FUNCS([dup2 gethostname isascii iswprint memset munmap regcomp select setlocale strcasecmp strchr strdup strerror strndup strrchr strtol strtoul strtoull utime wcwidth])
AX_PTHREAD( [
            AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
            CLIBS="$PTHREAD_LIBS $LIBS"
            CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
            LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS"
            CC="$PTHREAD_CC"],[])
# Not all compilers include /usr/local in the include and link path
if test -d /usr/local/include; then
    CFLAGS="$CFLAGS -I/usr/local/include"
    LDFLAGS="$LDFLAGS -L/usr/local/lib"
fi

# Checks for libraries.

# Check if we should link afflib.
AC_ARG_WITH([afflib],
    [AS_HELP_STRING([--without-afflib],[Do not use AFFLIB even if it is installed])]
    [AS_HELP_STRING([--with-afflib=dir],[Specify that AFFLIB is installed in directory 'dir'])],
    # If --with-afflib or --without-afflib is given
    [],
    # if nothing was specified, default to a test
    [with_afflib=yes])

# check for the lib if they did not specify no
AS_IF([test "x$with_afflib" != "xno"],
    # Test the dir if they specified something beyond yes/no
    [AS_IF([test "x$with_afflib" != "xyes"],
        [AS_IF([test -d ${with_afflib}/include],
            [CFLAGS="$CFLAGS -I${with_afflib}/include"
                LDFLAGS="$LDFLAGS -L${with_afflib}/lib"],
            # Dir given was not correct
            [AC_MSG_FAILURE([AFFLIB directory not found at ${with_afflib}])])
        ]
    )]
    # Check for the header file first to make sure they have the dev install
    [AC_CHECK_HEADERS([afflib/afflib.h],
      [AC_CHECK_LIB([afflib], [af_open])]
    )]
)
#needed for sqllite
AC_CHECK_LIB(dl, dlopen)


# Check if we should link libewf.
AC_ARG_WITH([libewf],
    [AS_HELP_STRING([--without-libewf],[Do not use libewf even if it is installed])]
    [AS_HELP_STRING([--with-libewf=dir],[Specify that libewf is installed in directory 'dir'])],
    # If --with-libewf or --without-libewf is given
    [],
    # if nothing was specified, default to a test
    [with_libewf=yes])

# check for the lib if they did not specify no
AS_IF([test "x$with_libewf" != "xno"],
    # Test the dir if they specified something beyond yes/no
    [AS_IF([test "x$with_libewf" != "xyes"],
        [AS_IF([test -d ${with_libewf}/include],
            [CFLAGS="$CFLAGS -I${with_libewf}/include"
                LDFLAGS="$LDFLAGS -L${with_libewf}/lib"],
            # Dir given was not correct
            [AC_MSG_FAILURE([libewf directory not found at ${with_libewf}])])
        ]
    )]
    # Check for the header file first to make sure they have the dev install
    [AC_CHECK_HEADERS([libewf.h],
      [AC_CHECK_LIB([ewf], [libewf_open])]
    )]
)

# Check if we should build fiwalk.
AC_ARG_ENABLE(fiwalk,
    [AS_HELP_STRING([--disable-fiwalk],[Disable fiwalk build])],
    #if --diable-fiwalk
# [echo option provided:fiwalk" | "$fiwalk" | "$enable_fiwalk]
    [],
    #Default to fiwalk build enabled
# [echo "option not provided: "fiwalk" | "$fiwalk" | "$enable_fiwalk]
    [enable_fiwalk=yes]
# [echo fiwalk $fiwalk $enable_fiwalk]
    )

AS_IF([test "x$enable_fiwalk" = "xyes"], [AC_DEFINE([BUILD_FIWALK],[1],[Define if fiwalk will be built])],
    [test "x$enable_fiwalk" = "xno"], [AC_DEFINE([BUILD_FIWALK],[0],[Define if fiwalk will not be built])],
    [AC_MSG_FAILURE([unsupported fiwalk build option: ${enable_fiwalk}])]
)

AM_CONDITIONAL([BUILD_FIWALK], [test x$enable_fiwalk = xyes])
if test "x$enable_fiwalk" == xyes; then
   ## These will be removed after complete integration
   ## At that point fiwalk will just be part of TSK not a separate package
   AC_DEFINE([FIWALK_VERSION], ["0.6.18"], [version of fiwalk subpackage])
   AC_DEFINE([FIWALK_PACKAGE], ["FIWALK"], [name of fiwalk subpackage])

   ################################################################
   ##
   ## Bloom support
   AC_TYPE_INT64_T
   AC_CHECK_HEADERS([openssl/hmac.h openssl/pem.h err.h sys/mman.h sys/resource.h unistd.h])
   AC_CHECK_FUNCS([printf getrusage err errx warn warnx mmap])
   
   ################################################################
   ##
   ## utils.h/utils.c support:
   AC_CHECK_HEADERS([err.h openssl/hmac.h openssl/pem.h err.h sys/mman.h sys/resource.h unistd.h])
   AC_CHECK_FUNCS([ishexnumber unistd.h err errx warn warnx ishexnumber pread64 pread _lseeki64 ])
   
   ################################################################
   ##
   ## xml.cpp support
   AC_CHECK_FUNCS([vasprintf])
   
   ################################################################
   
   ################################################################
   ### pthread support
   ###
   AC_CHECK_HEADERS([pthread.h])
   #m4_include([ax_pthread.m4]) #Redundant
   #AX_PTHREAD() #Redundant
   #LIBS="$PTHREAD_LIBS $LIBS" #Redundant
   #CFLAGS="$CFLAGS $PTHREAD_CFLAGS" #Redundant
   #CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" #Redundant
   #CC="$PTHREAD_CC" #Redundant
   ################################################################
   
   # Specific headers that I plan to use
   #AC_HEADER_STDC #Redundant
   AC_HEADER_DIRENT
   AC_CHECK_HEADERS([ctype.h err.h stdio.h strings.h string.h stdlib.h stdint.h sys/mman.h sys/types.h sys/time.h sys/resource.h sys/signal.h inttypes.h sys/resource.h sys/utsname.h])
   AC_CHECK_HEADERS([openssl/evp.h openssl/hmac.h openssl/x509.h openssl/pem.h])
   AC_CHECK_HEADERS([CommonCrypto/CommonDigest.h])
   AC_CHECK_HEADERS([magic.h])
   AC_CHECK_MEMBERS([struct glob_t.gl_matchc],,,[[#include <glob.h>]])
   AC_CHECK_MEMBERS([struct dirent.d_name],,,[[#include <dirent.h>]])
   AC_CHECK_MEMBERS([struct dirent.d_namlen],,,[[#include <dirent.h>]])
   
   # Specific functions that we want to know about
   AC_CHECK_FUNCS([printf getrusage strcasestr err ishexnumber])
   
   AC_CHECK_LIB([regex],[regcomp]) # see if we need -lregex
   
   
   # Special features that can be enabled or disabled
   AC_ARG_ENABLE(opt,
    AC_HELP_STRING([--enable-opt],
    [Drop -O C flags]))
   if test "x$with_afflib" != "xno"; then
      AC_CHECK_LIB([z],[uncompress],,AC_MSG_WARN([zlib not installed; required for AFFLIB and libewf]))
      AC_CHECK_LIB([afflib],[af_open],,AC_MSG_WARN([AFFLIB not found]))
   fi
   AC_CHECK_LIB([ssl],[ssl3_new])
   AC_CHECK_LIB([system],[CC_MD2_Init])
   AC_CHECK_LIB([crypto],[EVP_md5])
   if test "x$with_libewf" != "xno"; then
      AC_CHECK_LIB([ewf],[libewf_get_version],,AC_MSG_WARN([libewf not found; no E01 support]))
   else
      AC_MSG_WARN([libewf support disabled: no E01 support])
   fi
   AC_CHECK_LIB([magic],[magic_open])
   AC_DEFINE_UNQUOTED([UNAMES],"`(uname -s)`",[Host operating system])
   
   if test "x$with_afflib" != "xno"; then
      # Check to see if we have the modern AFFLIB
      AC_MSG_NOTICE([Checking for modern AFFLIB])
      AC_TRY_COMPILE([
      #include <afflib/afflib.h>
      #include <afflib/afflib_i.h>
      int af_get_seg(AFFILE *af,const char *name,uint32_t *arg,
       unsigned char *data,size_t *datalen);
      ],
                     [AFFILE *af=0;const char *segname="";uint32_t arg;u_char *data = 0;size_t datalen=0;
       af_get_seg(af,segname,&arg,data,&datalen);],
       [AC_MSG_NOTICE([AFFLIB is not obsolete])
        afflib_obsolete=no],
       [AC_MSG_NOTICE([AFFLIB is obsolete; disabling AFFLIB support.])
                      afflib_obsolete=yes])
      
      if test $afflib_obsolete = yes ; then
         AC_DEFINE(AFFLIB_OBSOLETE, 1,[AFFLIB rejects uint32_t])
      else
         AC_CHECK_FUNCS([af_display_as_quad af_display_as_hex])
      fi
   fi
   
   
   ################################################################
   ## Sleuthkit support
   ## Notice that SleuthKit now requires C++ due to autotools
   ## This needs to come last, because once we -ltsk3, everything needs
   ## to be C++ includes
   ##
   AC_LANG_PUSH([C++])
   # AC_CHECK_LIB([tsk3],[tsk_fs_open_img],,AC_MSG_ERROR([Requires TSK 3.2.1 or above library]))
   # AC_CHECK_HEADER([tsk3/libtsk.h],,AC_MSG_ERROR([Requires TSK 3.2.1 or above include files]))
     AC_CHECK_MEMBER([struct TSK_IMG_INFO.sector_size],
     AC_DEFINE([HAVE_TSK_IMG_INFO_SECTOR_SIZE],
      [1 /* Released in TSK 3.0.1 */], [Description]),
    [],
    [[#include "tsk3/libtsk.h"]])
     AC_CHECK_FUNCS([tsk_fs_meta_make_ls])
   AC_LANG_POP([C++])
fi

# sqlite requires pthread libraries - this was copied from its configure.ac
# AC_SEARCH_LIBS(pthread_create, pthread)
AC_SEARCH_LIBS(dlopen, dl)

# Test for java/jni so that we can compile the java bindings
AC_PROG_JAVAC
if test "x$JAVAC" != x; then
    AX_JNI_INCLUDE_DIR
    for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
    do
        JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR"
    done
    # Export the paths so that the makefile gets them
    AC_SUBST(JNI_CPPFLAGS, $JNI_CPPFLAGS)
fi
AM_CONDITIONAL([X_JNI],[test "x$JNI_CPPFLAGS" != x])

AC_CONFIG_COMMANDS([tsk3/tsk_incs.h],
        [
          echo "#ifndef _TSK_INCS_H" > tsk3/tsk_incs.h
          echo "#define _TSK_INCS_H" >> tsk3/tsk_incs.h
          echo "// automatically by ./configure" >> tsk3/tsk_incs.h
          echo "// Contains the config.h data needed by programs that use libtsk" >> tsk3/tsk_incs.h
          echo "" >> tsk3/tsk_incs.h
          if test x$ac_cv_header_unistd_h = xyes; then
            echo "#include <unistd.h>" >> tsk3/tsk_incs.h
          fi
          if test x$ac_cv_header_inttypes_h = xyes; then
            echo "#ifndef __STDC_FORMAT_MACROS" >> tsk3/tsk_incs.h
            echo "#define __STDC_FORMAT_MACROS" >> tsk3/tsk_incs.h
            echo "#endif" >> tsk3/tsk_incs.h
            echo "#include <inttypes.h>" >> tsk3/tsk_incs.h
          fi
          if test x$ac_cv_header_sys_param_h = xyes; then
            echo "#include <sys/param.h>" >> tsk3/tsk_incs.h
          fi

          if test x$ax_pthread_ok = xyes; then
            echo "#define TSK_MULTITHREAD_LIB" >> tsk3/tsk_incs.h
          fi

          echo "" >> tsk3/tsk_incs.h
          echo "#endif" >> tsk3/tsk_incs.h
        ],
        [
          ac_cv_header_unistd_h=$ac_cv_header_unistd_h
          ac_cv_header_inttypes_h=$ac_cv_header_inttypes_h
          ac_cv_header_sys_param_h=$ac_cv_header_sys_param_h
          ax_pthread_ok=$ax_pthread_ok
        ])

AC_CONFIG_FILES([Makefile
                 tsk3/Makefile
                 tsk3/base/Makefile
                 tsk3/img/Makefile
                 tsk3/vs/Makefile
                 tsk3/fs/Makefile
                 tsk3/hashdb/Makefile
                 tsk3/auto/Makefile
                 tools/Makefile
                 tools/imgtools/Makefile
                 tools/vstools/Makefile
                 tools/fstools/Makefile
                 tools/hashtools/Makefile
                 tools/srchtools/Makefile
                 tools/autotools/Makefile
                 tools/sorter/Makefile
                 tools/timeline/Makefile
                 tools/fiwalk/Makefile
tools/fiwalk/src/Makefile
tools/fiwalk/plugins/Makefile
                 tests/Makefile
                 samples/Makefile
                 man/Makefile
                 bindings/java/jni/Makefile
                 unit_tests/Makefile
                 unit_tests/base/Makefile])
AC_OUTPUT
Something went wrong with that request. Please try again.