1dnl -*- Autoconf -*- 2dnl Process this file with autoconf to produce a configure script. 3dnl 4dnl This file is Copyright (c) 2014 by JimF and magnum. 5dnl Redistribution and use in source and binary forms, with or without 6dnl modification, are permitted. 7dnl 8dnl There's ABSOLUTELY NO WARRANTY, express or implied. 9dnl 10 11dnl TODO: This is the suggested order for tests: 12dnl checks for programs 13dnl checks for libraries 14dnl checks for header files 15dnl checks for types 16dnl checks for structures 17dnl checks for compiler characteristics 18dnl checks for library functions 19dnl checks for system services 20 21dnl this MUST be done early, so that the proper JtR overridden help message 22dnl creation macro is the one that gets set first. 23m4_include([m4/jtr_specific_configure_help_message.m4]) 24 25AC_PREREQ([2.69]) 26AC_INIT([john], [jumbo],[john-users mailing list at openwall.com]) 27AC_CONFIG_SRCDIR([john.c]) 28AC_CONFIG_HEADERS([autoconfig.h]) 29AC_PREFIX_DEFAULT([../run]) 30 31dnl Include our extra macro code 32m4_include([m4/pkg.m4]) 33m4_include([m4/ax_opencl.m4]) 34m4_include([m4/ax_pthread.m4]) 35m4_include([m4/ax_prog_cc_mpi.m4]) 36m4_include([m4/ax_lang_compiler_ms.m4]) 37m4_include([m4/ax_check_gnu_make.m4]) 38m4_include([m4/jtr_asm_magic.m4]) 39m4_include([m4/jtr_x86_logic.m4]) 40m4_include([m4/jtr_mic_logic.m4]) 41m4_include([m4/jtr_ppc_logic.m4]) 42m4_include([m4/jtr_arm_logic.m4]) 43m4_include([m4/jtr_generic_logic.m4]) 44m4_include([m4/jtr_systems_specific_logic.m4]) 45m4_include([m4/jtr_utility_macros.m4]) 46m4_include([m4/ax_ztex.m4]) 47 48dnl Define precious variables. They get included in --help and need no AC_SUBST 49AC_ARG_VAR([CFLAGS_EXTRA], [additional CFLAGS for -Woptions and other things, not used during ./configure but put in resulting Makefile]) 50AC_ARG_VAR([YASM], [full pathname of yasm (for optional AES-NI support)]) 51AC_ARG_VAR([AS], [full pathname of assembler to use]) 52AC_ARG_VAR([AR], [full pathname of "ar" to use]) 53AC_ARG_VAR([LD], [full pathname of linker to use]) 54 55dnl Define Packages. 56dnl Use OpenSSL (default: yes). 57AC_ARG_WITH(openssl, [AS_HELP_STRING([--without-openssl],[Do not use Openssl (CommonCrypto must be enabled)])],,[with_openssl=yes]) 58dnl Use CommonCrypto (default: no) 59AC_ARG_WITH(commoncrypto, [AS_HELP_STRING([--with-commoncrypto],[Use CommonCrypto])],,[with_commoncrypto=no]) 60dnl Cludge for endian (if not auto detected) 61AC_ARG_WITH(endian, [AS_HELP_STRING([--with-endian=little|big],[Set endianness for target if it doesn't detect properly])],,[endian=unknown]) 62dnl -DJOHN_SYSTEMWIDE 63AC_ARG_WITH(systemwide, [AS_HELP_STRING([--with-systemwide],[install for all users])],,[with_systemwide=no]) 64AC_ARG_WITH(flock, [AS_HELP_STRING([--with-flock],[use flock() file locking instead of fcntl()])],,[with_flock=no]) 65 66AC_ARG_ENABLE([asan], [AS_HELP_STRING([--enable-asan], [* Build with AddressSanitizer])], [asan=$enableval], [asan=no]) 67AC_ARG_ENABLE([ubsan], [AS_HELP_STRING([--enable-ubsan], [* Build with UndefinedBehaviorSanitizer])], [ubsan=$enableval], [ubsan=no]) 68AC_ARG_ENABLE([ubsantrap], [AS_HELP_STRING([--enable-ubsantrap], [* Build with UndefinedBehaviorSanitizer, crashes on failure])], [ubsantrap=$enableval], [ubsantrap=no]) 69AC_ARG_ENABLE([simd], [AS_HELP_STRING([--disable-simd, --enable-simd=foo], [* Build forcing SIMD logic to be disabled, or force use of "foo" for SIMD (eg. --enable-simd=altivec)])], [simd=$enableval], [simd=yes]) 70AC_ARG_ENABLE([plugin-dependencies], [AS_HELP_STRING([--disable-plugin-dependencies], [Do not create best-effort Makefile dependencies for plugins])], [plug_deps=$enableval], [plug_deps=yes]) 71 72AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [Treat warnings as errors])], [werror=$enableval], [werror=no]) 73 74dnl Define Features. OpenMP and OpenCL are defined in their respective macros. 75dnl We define "--disable-FEATURE" when default is "auto". 76dnl MPI is not "auto" because its network usage might scare people: 77AC_ARG_ENABLE([openmp-for-fast-formats], [AC_HELP_STRING([--enable-openmp-for-fast-formats], [Enable OpenMP for fast formats (usually a bad idea - use fork instead)])], [ompfast=$enableval], [ompfast=no]) 78AC_ARG_ENABLE([mpi], [AC_HELP_STRING([--enable-mpi], [Use OpenMPI])], [enable_mpi=$enableval], [enable_mpi=no]) 79AC_ARG_ENABLE([rexgen], [AC_HELP_STRING([--enable-rexgen], [Enable use of rexgen library (experimental)])], [enable_rexgen=$enableval], [enable_rexgen=no]) 80AC_ARG_ENABLE([pcap], [AC_HELP_STRING([--disable-pcap], [Do not build helpers depending on PCAP])], [enable_pcap=$enableval], [enable_pcap=auto]) 81AC_ARG_ENABLE([native-tests], [AC_HELP_STRING([--disable-native-tests], [Do not test build system for target features.])], [enable_native_tests=$enableval], [enable_native_tests=auto]) 82AC_ARG_ENABLE([native-march], [AC_HELP_STRING([--enable-native-march], [Use things like -march=native if valid compiler option(s).])], [enable_native_march=$enableval], [enable_native_march=no]) 83AC_ARG_ENABLE([ln-s], [AS_HELP_STRING([--enable-ln-s],[Use ln -s vs symlink.c wrappers (Cygwin only)])], [enable_ln_s=$enableval], [enable_ln_s=no]) 84AC_ARG_ENABLE([pkg-config], [AS_HELP_STRING([--enable-pkg-config],[use pkg-config for some probing tests])], [enable_pkg_config=$enableval], [enable_pkg_config=no]) 85AC_ARG_ENABLE([nt-full-unicode], [AS_HELP_STRING([--enable-nt-full-unicode],[support 4-byte UTF-8 for MS formats])], [enable_nt_unicode=$enableval], [enable_nt_unicode=no]) 86AC_ARG_ENABLE([int128], [AC_HELP_STRING([--disable-int128], [Do not use int128])], [enable_int128=$enableval], [enable_int128=auto]) 87AC_ARG_ENABLE([experimental-code], [AC_HELP_STRING([--enable-experimental-code], [Use experimental code])], [experimental=$enableval], [experimental=no]) 88AC_ARG_ENABLE([fuzz], [AC_HELP_STRING([--enable-fuzz], [Fuzzing prepare(), valid(), init(), etc])], [fuzz=$enableval], [fuzz=no]) 89AC_ARG_ENABLE([libfuzzer], [AC_HELP_STRING([--enable-libfuzzer], [Fuzzing using libFuzzer])], [libfuzzer=$enableval], [libfuzzer=no]) 90 91dnl ===================== Actual tests start here ======================== 92 93dnl Assert that we don't have a stray GNUmakefile left in the tree :-( 94if test -f GNU?akefile; then 95 AC_MSG_ERROR([Stray GNUmakefile (or GNUMakefile) detected. Please remove it]) 96fi 97 98dnl Support cross compile 99AC_CANONICAL_HOST 100 101dnl Check for MPI. Only if MPI not found/wanted: Check for CC. 102using_mpi=no 103AX_PROG_CC_MPI([test "x$enable_mpi" != xno], 104 [AC_SUBST(HAVE_MPI,[-DHAVE_MPI])] 105 [using_mpi=yes], 106 [AS_IF([test "x$enable_mpi" = xyes], 107 [AC_MSG_FAILURE([No MPI compiler found])], 108 [test "x$enable_mpi" != xno], 109 [AC_MSG_NOTICE([No MPI compiler found, disabling MPI])]) 110 AC_PROG_CC([gcc cc icc ccc]) 111 ] 112) 113 114dnl At this point we know whether this is a cross compile 115dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. 116if test "x$enable_native_tests" = xauto; then 117 if test "x$cross_compiling" != xno; then 118 AC_MSG_NOTICE([This is a cross-compile; all native tests disabled]) 119 enable_native_tests=no 120 else 121 enable_native_tests=yes 122 fi 123fi 124 125dnl ====================================================================== 126dnl Here we call setting up many -I in CFLAGS, and -L in 127dnl LDFLAGS for 'normal' paths, IF we find them. 128dnl ====================================================================== 129AS_IF([test "x$cross_compiling" = xno], [JTR_SET_NORMAL_INCLUDES]) 130 131dnl ====================================================================== 132dnl only do auto unit-tests logic IF we are not cross compiling 133dnl ====================================================================== 134AS_IF([test "x$enable_native_tests" = xyes], [AC_SUBST(UNIT_TESTS_DEPENDENCY,[unit-tests])]) 135 136dnl ====================================================================== 137dnl check compiler switches here. OPT_NORMAL, then 138dnl OPT_INLINE, then extra CFLAGS are checked. 139dnl ====================================================================== 140dnl 141dnl first test a totally BOGUS command line switch, to make sure that the 142dnl detection logic actually detects BAD command switches 143CFLAGS_EX="" 144JTR_FLAG_CHECK([-fFOO_BAR_SWITCH_NOT_VALID], 0) 145dnl note, check message must be done after the first call to JTR_FLAG_CHECK. Since this is 146dnl the first macro that will use $CC, a lot of messages will happen. We need to make that first 147dnl macro 'call', so that those messages are output, THEN we make our checking message. 148AC_MSG_CHECKING([arg check macro for -m with $CC]) 149JTR_FLAG_CHECK([-mFOO_BAR_SWITCH_NOT_VALID], 0) 150JTR_FLAG_CHECK([-m666], 0) 151AS_IF([test "x${CFLAGS_EX}" = x], 152 [AC_MSG_RESULT([yes])] 153 JTR_FLAG_CHECK_WORKS=yes 154 ,[AC_MSG_RESULT([no])]) 155 156dnl This gave false positives on gcc 4.4.7, see issue 682 157CFLAGS_EX="" 158AC_MSG_CHECKING([arg check macro for -Q with $CC]) 159JTR_FLAG_CHECK([-QFOO_BAR_SWITCH_NOT_VALID], 0) 160AS_IF([test "x${CFLAGS_EX}" = x], 161 [AC_MSG_RESULT([yes])] 162 JTR_FLAG_Q_CHECK_WORKS=yes 163 ,[AC_MSG_RESULT([no])]) 164 165dnl Now, we only do option checking, IF this worked, i.e. that option was not detected as valid 166AS_IF([test "x$JTR_FLAG_CHECK_WORKS" = xyes], 167[ 168 CFLAGS_EX="" 169 dnl first fill out JtR's OPT_NORMAL= value 170 JTR_FLAG_CHECK([-funroll-loops], 1) 171 OPT_NORMAL_V=${CFLAGS_EX} 172 AC_SUBST([OPT_NORMAL_FLAGS],["${OPT_NORMAL_V}"]) 173 174 dnl now fill in extras for JtR's OPT_INLINE= value 175 CFLAGS_EX="" 176 JTR_FLAG_CHECK([-Os], 1) 177 JTR_FLAG_CHECK([-funroll-loops], 0) 178 JTR_FLAG_CHECK([-finline-functions], 1) 179 AC_SUBST([OPT_INLINE_FLAGS],["${CFLAGS_EX}"]) 180 181 dnl pick -Og or -O1 for debug targets (applies to ASan/UbSan too) 182 CFLAGS_EX="" 183 JTR_FLAG_CHECK([-Og], 1) 184 if test "x${CFLAGS_EX}" != x ; then 185 O_DEBUG=${CFLAGS_EX} 186 else 187 O_DEBUG="-O1" 188 fi 189 AC_SUBST([O_DEBUG],[$O_DEBUG]) 190 191 dnl if user requested ASan, make sure we can properly build/link with it. 192if test "x$asan" = xyes ; then 193 CFLAGS_EX="" 194 LDFLAGS_BAK=${LDFLAGS} 195 JTR_FLAG_CHECK_LINK([-fsanitize=address], 1) 196 if test "x${CFLAGS_EX}" = x ; then 197 JTR_FLAG_CHECK_LINK([-faddress-sanitizer], 1) 198 if test "x${CFLAGS_EX}" = x ; then 199 AC_MSG_FAILURE([Could not find all required ASAN components]) 200 else 201 LDFLAGS="-faddress-sanitizer $LDFLAGS" 202 fi 203 else 204 LDFLAGS="-fsanitize=address $LDFLAGS" 205 fi 206 LDFLAGS=${LDFLAGS_BAK} 207fi 208 209 dnl if user requested UbSan, make sure we can properly build/link with it. 210if test "x$ubsan" = xyes ; then 211 CFLAGS_EX="" 212 LDFLAGS_BAK=${LDFLAGS} 213 JTR_FLAG_CHECK_LINK([-DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 -fsanitize=undefined], 1) 214 if test "x${CFLAGS_EX}" = x ; then 215 AC_MSG_FAILURE([Could not find all required UBSAN components]) 216 else 217 LDFLAGS="-fsanitize=undefined $LDFLAGS" 218 fi 219 LDFLAGS=${LDFLAGS_BAK} 220fi 221if test "x$ubsantrap" = xyes ; then 222 CFLAGS_EX="" 223 LDFLAGS_BAK=${LDFLAGS} 224 JTR_FLAG_CHECK_LINK([-DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 -fsanitize=undefined -fsanitize-undefined-trap-on-error], 1) 225 if test "x${CFLAGS_EX}" = x ; then 226 AC_MSG_FAILURE([Could not find all required UBSAN components]) 227 else 228 LDFLAGS="-fsanitize=undefined $LDFLAGS" 229 fi 230 LDFLAGS=${LDFLAGS_BAK} 231fi 232 233 234 dnl now fill out CFLAGS 235 CFLAGS_EX="" 236 JTR_FLAG_CHECK([-Wall], 1) 237 238 dnl False positives from gcc 8 239 if (test "x$asan" != xyes); then 240 JTR_NOWARN_CHECK([stringop-truncation], 1) 241 JTR_NOWARN_CHECK([format-overflow], 1) 242 fi 243 244 dnl False positives from gcc 9 245 if (test "x$asan" != xyes); then 246 JTR_NOWARN_CHECK([format-truncation], 1) 247 fi 248 249 dnl Really silly clang warnings stopping us from doing sanity checks 250 JTR_NOWARN_CHECK([tautological-constant-out-of-range-compare], 1) 251 252 AS_IF([test "x$werror" = xyes], 253 JTR_FLAG_CHECK([-Werror], 1) 254 JTR_NOWARN_CHECK([error=cpp], 1) 255 JTR_NOWARN_CHECK([[error=#warnings]], 1) 256 JTR_NOWARN_CHECK([error=stringop-truncation], 1) 257 JTR_NOWARN_CHECK([error=format-overflow], 1) 258 ) 259 if test "x$asan" = xyes || test "x$ubsan" = xyes || test "x$ubsantrap" ; then 260 JTR_FLAG_CHECK([-fno-omit-frame-pointer], 1) 261 else 262 JTR_FLAG_CHECK([-fomit-frame-pointer], 1) 263 fi 264 265 dnl gcc bug workaround, see issue 632 266 JTR_FLAG_CHECK([--param allow-store-data-races=0], 1) 267 dnl Silly OSX warnings 268 JTR_NOWARN_CHECK([deprecated-declarations], 1) 269 dnl clang warnings 270 JTR_FLAG_CHECK([-Wformat-extra-args], 1) 271 JTR_FLAG_CHECK([-Wunused-but-set-variable], 1) 272 dnl JTR_NOWARN_CHECK([unneeded-internal-declaration], 1) 273 AS_IF([test "x$JTR_FLAG_Q_CHECK_WORKS" = xyes], [JTR_FLAG_CHECK([-Qunused-arguments],1)]) 274 dnl Justified and Ancient (see issue 1093) 275 JTR_FLAG_CHECK([-std=gnu89], 1) 276 dnl We like reproducible builds 277 JTR_FLAG_CHECK([-Wdate-time], 1) 278 JTR_LIST_ADD(CFLAGS_EXTRA, ["$CFLAGS_EX"]) 279], 280 AC_MSG_NOTICE([Unable to validate $CC command line arguments. Using standard values.]) 281 CFLAGS_EXTRA="-Wall -O2 -fomit-frame-pointer" 282) 283 284dnl early check of 64 bit systems. 285case "$host_cpu" in 286 ia64|mips64|mips64eb|mipseb64|mips64el|mipsel64|mips64*|powerpc64*|sparc64|x86_64) 287 CFLAGS_EX="" 288 JTR_FLAG_CHECK_LINK([-m64], 1) 289 if test "x${CFLAGS_EX}" != x ; then 290 LDFLAGS="-m64 $LDFLAGS" 291 CFLAGS="-m64 $CFLAGS" 292 ASFLAGS="-m64 $ASFLAGS" 293 fi 294 ;; 295 *) 296 AC_MSG_CHECKING([if gcc supports -m64]) 297 AC_MSG_RESULT([skipped]) 298 ;; 299esac 300 301dnl Cross compile compliant 32/64 bit test code. 302AC_MSG_CHECKING([for 32/64 bit]) 303AC_LINK_IFELSE( 304 [AC_LANG_SOURCE( 305 [extern void exit(int); 306 int main() { 307 #if defined(_LP64) || defined(__LP64__) || defined(_LLP64) || defined(__LLP64__) || \ 308 defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__amd64__) || \ 309 defined(_M_AMD64) || defined(_M_X64) || defined(WIN64) || \ 310 defined(__IA64__) || defined(__ia64) || defined(_M_IA64) || \ 311 defined(__aarch64__) || defined(__ppc64__) 312 exit(0);} 313 #else 314 BORK! 315 #endif 316 ] 317 )] 318 ,[CPU_BITS="-m64"] 319 [CPU_BIT_STR="64"] 320 [AC_MSG_RESULT([64-bit])] 321 ,[CPU_BITS="-m32"] 322 [CPU_BIT_STR="32"] 323 [AC_MSG_RESULT([32-bit])] 324) 325 326if test "x${CPU_BITS}" = x-m64 ; then 327 JTR_SET_64_INCLUDES 328fi 329 330dnl Checks for programs. 331AC_PROG_LN_S 332AC_PROG_GREP 333dnl AC_PROG_EGREP Do not trust this one 334AC_PROG_SED 335dnl AC_PROG_CXX 336AX_CHECK_GNU_MAKE() 337AC_PROG_MAKE_SET 338AC_PROG_CPP 339AC_PROG_MKDIR_P 340AC_CACHE_SAVE 341AC_PATH_PROG([SORT], [sort]) 342AC_PATH_PROG([FIND], [find]) 343AC_PATH_PROG([PERL], [perl]) 344AS_IF([test -z "$AS"], [AS="$CC"]) 345AS_IF([test -z "$LD"], [LD="$CC"]) 346AS_IF([test -z "$AR"], [AC_CHECK_TOOL([AR], [ar])]) 347AS_IF([test -z "$STRIP"], [AC_CHECK_TOOL([STRIP], [strip])]) 348 349dnl Check if we have this at all 350PKG_PROG_PKG_CONFIG 351AC_MSG_CHECKING([if pkg-config will be used]) 352if test "x$PKG_CONFIG" = x || test "x$enable_pkg_config" == xno ; then 353 JTR_MSG_RESULT_FAILIF_FORCED([xno], [x$enable_pkg_config], [pkg-config is NOT available]) 354 PKG_CONFIG=no 355else 356 AC_MSG_RESULT([yes]) 357fi 358 359dnl 360dnl Here, we use perl (if it was found!) and if there is a ../run/john.pot 361dnl file, to find out if there are any .pot lines that will be TOO long 362dnl for this version of JtR. WE have reduced the max pot line length to 363dnl 1k (it was 30000 or 300000 bytes long before). So we now need to make 364dnl sure that all lines are approprate. We use ../run/potcheck.pl to validate 365dnl the .pot file here. IF there are problems, we simply inform the user to 366dnl fix his .pot file (with ../run/potcheck.pl) and do NOT allow configure 367dnl to succeeed. 368dnl 369if ( test -e ../run/john.pot ) ; then 370AC_MSG_CHECKING([if potcheck.pl succeeds]) 371if test "x$PERL" == x ; then 372 AC_MSG_RESULT([no Perl (unable to check)]) 373else 374 $PERL ../run/potcheck.pl -validate < ../run/john.pot 375 ret=$? 376 if ( test $ret -ne 0 ) ; then 377 AC_MSG_RESULT([no]) 378 AC_MSG_ERROR([NOTE, john will not run properly until you fix your ../run/john.pot file using '../run/potcheck.pl -longline_fix']) 379 fi 380 AC_MSG_RESULT([yes]) 381fi 382fi 383 384dnl Cross-compile compliant size checks 385dnl size_t and off_t are post-poned to after feature macros are set 386 387AC_CHECK_SIZEOF([short]) 388AC_CHECK_SIZEOF([int]) 389AC_CHECK_SIZEOF([long]) 390AC_CHECK_SIZEOF([long long]) 391AC_CHECK_SIZEOF([wchar_t]) 392AC_CHECK_SIZEOF([int *]) 393AC_CHECK_SIZEOF([void *]) 394dnl Not sure how to do sizeof function pointer in configure. I will add this 395dnl one to jumbo.h 'by hand' 396dnl AC_CHECK_SIZEOF([int *function()] 397 398dnl Handle --disable-simd or --enable-simd=foo 399SIMD_FLAGS="" 400CFLAGS_EX="" 401case "$simd" in 402 yes|auto) 403 ;; 404 no) 405 AC_MSG_NOTICE([SIMD logic disabled by request]) 406 AC_SUBST([JOHN_NO_SIMD], ["-DJOHN_NO_SIMD"]) 407 [case "$host_cpu" in 408 aarch64|arm*|powerpc*) 409 SIMD_NAME="(SIMD disabled)" 410 ;; 411 esac] 412 ;; 413 neon) 414 AS_CASE([$host_cpu], 415 [arm*], 416 JTR_FLAG_CHECK_LINK([-mfpu=neon], 2) 417 SIMD_NAME="NEON", 418 [aarch64], 419 JTR_FLAG_CHECK_LINK([-march=armv8-a+simd], 2) 420 SIMD_NAME="ASIMD", 421 AC_ERROR([NEON/ASIMD only applicable for ARM CPU's]) 422 ) 423 JTR_ARM_SIMD_LOGIC 424 ;; 425 asimd) 426 JTR_FLAG_CHECK_LINK([-march=armv8-a+simd], 2) 427 SIMD_NAME="ASIMD" 428 JTR_ARM_SIMD_LOGIC 429 ;; 430 altivec1) 431 JTR_FLAG_CHECK_LINK([-maltivec], 2) 432 JTR_FLAG_CHECK_LINK([-msvx], 2) 433 SIMD_NAME="Altivec" 434 ;; 435 altivec*) 436 JTR_FLAG_CHECK_LINK([-maltivec], 2) 437 JTR_FLAG_CHECK_LINK([-msvx], 2) 438 JTR_FLAG_CHECK_LINK([-mpower8vector], 2) 439 SIMD_NAME="Altivec2" 440 ;; 441 dnl Handle known cases of --enable-simd=foo --> -mfoo 442 mmx|sse*|ssse3|avx*|xop*) 443 SIMD_NAME=`echo $simd | tr a-z A-Z` 444 AC_MSG_NOTICE([Trying to force $SIMD_NAME using default method (--enable-simd=$simd).]) 445 JTR_FLAG_CHECK_LINK([-m${simd}], 2) 446 ;; 447 *) 448 SIMD_NAME=`echo $simd | tr a-z A-Z` 449 AC_MSG_ERROR([SIMD type $SIMD_NAME not supported (--enable-simd=$simd)]) 450esac 451JTR_LIST_ADD(SIMD_FLAGS, ["$CFLAGS_EX"]) 452 453dnl ====================================================================== 454dnl Available arch.h's: 455dnl alpha.h 456dnl arm32le.h (mfpu=neon) (we may override the "le") 457dnl arm64le.h (we may override the "le") 458dnl ia64.h 459dnl mips32.h (we override the BE defined within it) 460dnl mips64.h 461dnl pa-risc.h 462dnl ppc32.h (with or without -maltivec) 463dnl ppc64.h (-m64 with or without -maltivec) 464dnl sparc32.h 465dnl sparc64.h (-m64 -mcpu=ultrasparc) (-xarch=native64) 466dnl vax.h 467dnl x86-64.h (-mx32, -m64) 468dnl x86-any.h 469dnl x86-mmx.h 470dnl x86-sse.h 471 472cpu_family="unkown" 473case "$host_cpu" in 474 alpha*) ARCH_LINK=alpha.h endian=little ;; 475 armeb) ARCH_LINK=arm32le.h endian=big ;; 476 aarch64) ARCH_LINK=arm64le.h endian=little 477 AC_MSG_CHECKING([special compiler flags]) 478 AC_MSG_RESULT([ARM64]) 479 AS_IF([test $simd != no], 480 [SIMD_NAME="ASIMD"] 481 JTR_ARM_SIMD_LOGIC 482 ) 483 ;; 484 arm*) ARCH_LINK=arm32le.h endian=little 485 AC_MSG_CHECKING([special compiler flags]) 486 AC_MSG_RESULT([ARM]) 487 JTR_ARM_SPECIAL_LOGIC 488 JTR_ARM_SIMD_LOGIC 489 ;; 490 ia64) ARCH_LINK=ia64.h endian=little cpu_family=intel ;; 491 i?86) ARCH_LINK=x86-any.h endian=little cpu_family=intel ;; 492 m68k*) ARCH_LINK=autoconf_arch.h endian=big ;; 493 mic) ARCH_LINK=mic.h endian=little 494 AC_MSG_CHECKING([special compiler flags]) 495 AC_MSG_RESULT([MIC]) 496 JTR_MIC_SPECIAL_LOGIC 497 ;; 498 mips|mipseb) ARCH_LINK=mips32.h endian=big ;; 499 mipsel) ARCH_LINK=mips32.h endian=little ;; 500 mips64|mips64eb|mipseb64) ARCH_LINK=mips64.h endian=big ;; 501 mips64el|mipsel64) ARCH_LINK=mips64.h endian=little ;; 502 mips64*) ARCH_LINK=mips64.h endian=big ;; 503 mips*) ARCH_LINK=mips32.h endian=big ;; 504 pdp*) ARCH_LINK=autoconf_arch.h endian=little ;; 505 powerpc64le) ARCH_LINK=ppc64.h endian=little 506 AC_MSG_CHECKING([special compiler flags]) 507 AC_MSG_RESULT([PPC64le]) 508 JTR_PPC64_SPECIAL_LOGIC 509 ;; 510 powerpc64*) ARCH_LINK=ppc64.h endian=big 511 AC_MSG_CHECKING([special compiler flags]) 512 AC_MSG_RESULT([PPC64]) 513 JTR_PPC64_SPECIAL_LOGIC 514 ;; 515 powerpcle) ARCH_LINK=ppc32.h endian=little 516 AC_MSG_CHECKING([special compiler flags]) 517 AC_MSG_RESULT([PPC32le]) 518 JTR_PPC32_SPECIAL_LOGIC 519 ;; 520 powerpc*) ARCH_LINK=ppc32.h endian=big 521 AC_MSG_CHECKING([special compiler flags]) 522 AC_MSG_RESULT([PPC32]) 523 JTR_PPC32_SPECIAL_LOGIC 524 ;; 525 sparc64) ARCH_LINK=sparc64.h endian=big ;; 526 sparc*) ARCH_LINK=sparc32.h endian=big ;; 527 vax*) ARCH_LINK=vax.h endian=little ;; 528 x86_64) ARCH_LINK=x86-64.h endian=little cpu_family=intel ;; 529 *) 530 AC_MSG_WARN([Uncertain support for ${host}, please report!]) 531 ARCH_LINK=autoconf_arch.h 532 ;; 533esac 534 535dnl NOTE, later, we will probably do this by parsing the host or target to figure 536dnl out the system, then have a switch statement, based upon the system, calling 537dnl the proper JTR_cputype_SPECIAL_LOGIC function (and of course have to write 538dnl macros for each environment. We probably should fall back to calling 539dnl make -f Makefile.legacy clean generic or failing with an echo of that message, 540dnl for any environment we do not handle. 541JTR_ASM_MAGIC 542AS_IF([test "x$cpu_family" = xintel], 543 AC_MSG_CHECKING([special compiler flags]) 544 AC_MSG_RESULT([Intel x86]) 545 [JTR_X86_SPECIAL_LOGIC] 546 ) 547AC_MSG_CHECKING([for arch.h alternative]) 548AC_MSG_RESULT([${ARCH_LINK}]) 549JTR_GENERIC_LOGIC 550 551dnl Set a variable detecting x86-64 w/ X32 ABI 552if test "x$ax_intel_x32" = xyes; then 553 using_x32=", X32 ABI" 554else 555 using_x32="" 556fi 557 558dnl ====================================================================== 559dnl Check for LE/BE CPU 560dnl ====================================================================== 561if test "x$endian" = "xunknown"; then 562 AC_C_BIGENDIAN([endian=big], [endian=little]) 563else 564 AC_MSG_CHECKING([for byte ordering according to target triple]) 565 AC_MSG_RESULT([${endian}]) 566fi 567if test "x$endian" = "xbig"; then 568 AC_DEFINE([ARCH_LITTLE_ENDIAN], 0, ["Enable if CPU is LITTLE ENDIAN arch"]) 569elif test "x$endian" = "xlittle"; then 570 AC_DEFINE([ARCH_LITTLE_ENDIAN], 1, ["Enable if CPU is LITTLE ENDIAN arch"]) 571else 572 AC_MSG_FAILURE([Could not determine endianity. Supply '--with-endian=little|big' and re-run]) 573fi 574 575dnl ====================================================================== 576dnl Checks for libraries. 577dnl 578dnl NOTE, be VERY careful of spaces around the comma's in the AC_CHECK_LIB. Best 579dnl to not have any. If there are space, then often that will get a lib to NOT 580dnl be added to @LIBS@ and cause linkage problems. Also note, if action if found 581dnl is specified, the -llibname will NOT get appended to LIBS. So it has to be 582dnl done by 'hand'. 583dnl ====================================================================== 584 585AS_IF([test "x$with_commoncrypto" != xyes && test "x$with_openssl" = xno], 586 [AC_MSG_FAILURE([At least one of OpenSSL and CommonCrypto must be used],1)] 587) 588 589AS_IF([test "x$with_commoncrypto" = xyes], 590 [AC_CHECK_HEADER([CommonCrypto/CommonDigest.h], 591 [AC_CHECK_LIB([System], [CCKeyDerivationPBKDF], 592 [AC_CHECK_LIB([System], [CCCryptorCreate], [JTR_LIST_ADD(CFLAGS,"-DCOMMON_DIGEST_FOR_OPENSSL")] [AC_SUBST(COMMONCRYPTO_LIBS, [-lSystem])] [AC_DEFINE(HAVE_COMMONCRYPTO,1,[Define to 1 if you have the CommonCrypto library.])], [AC_MSG_FAILURE([No CommonCrypto found],1)] )] )] )] ) 593 594AS_IF([test "x$with_openssl" != xno], 595 [if test "x$enable_native_tests" != xno -a "x$PKG_CONFIG" != xno; then 596 PKG_CHECK_MODULES([OPENSSL], [openssl], 597 AC_DEFINE(HAVE_LIBCRYPTO,1,[Define to 1 if you have the `crypto' library (-lcrypto).]) 598 AC_DEFINE(HAVE_LIBSSL,1,[Define to 1 if you have the `ssl' library (-lssl).]), 599 AC_MSG_FAILURE([JtR requires OpenSSL and OpenSSL-devel being installed. Install if not installed. 600Try using --disable-pkg-config and possibly helping configure find oSSL by providing hints in CFLAGS and LDFLAGS],1)) 601else 602 AS_IF([test "x${OPENSSL_CFLAGS}${OPENSSL_LIBS}" != "x" -o "x$cross_compiling" = "xyes" -o "x$enable_native_tests" = xno -o "x$PKG_CONFIG" = xno], 603 [AC_MSG_CHECKING([supplied paths for OpenSSL])] 604 [JTR_LIST_ADD(CFLAGS, [$OPENSSL_CFLAGS])] 605 [if test "x$cross_compiling" = "xyes" -a "x$OPENSSL_LIBS" = "x"; then 606 OPENSSL_LIBS="-lssl -lcrypto" 607 fi] 608 LIBS_ORIG="$LIBS" 609 LIBS="$LIBS $OPENSSL_LIBS" 610 [AC_MSG_RESULT([$OPENSSL_CFLAGS $OPENSSL_LIBS])] 611 [if test "x$cross_compiling" = xno; then 612 JTR_SET_NORMAL_SSL_INCLUDES([/usr/local/ssl]) 613 fi] 614 [AC_CHECK_HEADER([openssl/opensslv.h], 615 [AC_CHECK_LIB([ssl],[SSL_CTX_new], 616 [AC_CHECK_LIB([crypto],[MD5_Update], 617 [AC_DEFINE(HAVE_LIBSSL,1,[Define to 1 if you have the `ssl' library (-lssl).])] 618 [AC_DEFINE(HAVE_LIBCRYPTO,1,[Define to 1 if you have the `crypto' library (-lcrypto).])] 619 [OPENSSL_LIBS="-lssl -lcrypto"], 620 [AC_MSG_FAILURE(JtR requires libssl/libcrypto being installed,1)])], 621 [AC_MSG_FAILURE(JtR requires libssl being installed,1)] 622 ) 623 LIBS="$LIBS_ORIG"], 624 [AC_MSG_FAILURE(JtR requires OpenSSL headers being installed,1)] 625 )] 626 ) 627 fi] 628) 629 630dnl ====================================================================== 631dnl libz is found in pkg-config --switch zlib 632dnl ====================================================================== 633AC_CHECK_LIB([m],[sqrt],[AC_DEFINE(HAVE_LIBM,1,[Define to 1 if you have the `m' library (-lm).])] [AC_SUBST(M_LIBS, [-lm])],[AC_MSG_FAILURE(JtR requires libm being installed,1)]) 634AC_CHECK_LIB([z],[deflate],[AC_DEFINE(HAVE_LIBZ,1,[Define to 1 if you have the `z' library (-lz).])] [AC_SUBST(Z_LIBS, [-lz])]) 635BACKUP_LIBS="$LIBS" 636LIBS="" 637AC_SEARCH_LIBS([crypt],[crypt],[AC_DEFINE(HAVE_CRYPT,1,[Define to 1 if you have the `crypt' library (-lcrypt).])]) 638AC_SUBST(CRYPT_LIBS, [$LIBS]) 639LIBS="$BACKUP_LIBS" 640 641AC_CHECK_HEADERS([gmp.h] [gmp/gmp.h], [AC_CHECK_LIB([gmp],[__gmpz_init], AC_DEFINE([HAVE_LIBGMP],1,[Define to 1 if you have the `gmp' library (-lgmp).]) [AC_SUBST(GMP_LIBS, [-lgmp])])] [break]) 642AC_CHECK_HEADER([skey.h], [AC_CHECK_LIB([skey],[skey_set_algorithm], 643 AC_DEFINE([HAVE_SKEY],1,[Define to 1 if you have skey library and headers]) [AC_SUBST(SKEY_LIBS, [-lskey])])]) 644AC_MSG_CHECKING([for S/Key]) 645AS_IF([test "x${ac_cv_lib_skey_skey_set_algorithm}" != xyes], 646 [AC_MSG_RESULT([using our own code])], 647 [AC_MSG_RESULT([using system library])] 648) 649AC_CHECK_HEADER([bzlib.h], [AC_CHECK_LIB([bz2],[main], 650 AC_DEFINE([HAVE_LIBBZ2],1,[Define to 1 if you have bz2 library and headers]) [AC_SUBST(BZ2_LIBS, [-lbz2])])]) 651AC_CHECK_LIB([kernel32],[main]) 652AC_CHECK_LIB([dl],[dlopen],[AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if you have the `dl' library (-ldl).])] [AC_SUBST(DL_LIBS, [-ldl])]) 653 654AC_CHECK_HEADERS([intrin.h], break) 655AC_CHECK_HEADERS([openssl/cmac.h], break) 656 657BACKUP_LIBS="$LIBS" 658 659LIBS="" 660using_rexgen=no 661dnl Check for rexgen only if rexgen wanted 662if test "x$enable_rexgen" != xno ; then 663 AC_CHECK_HEADER([librexgen/version.h], 664 [AC_SEARCH_LIBS([rexgen_version_int],[rexgen librexgen], 665 [AC_MSG_CHECKING([librexgen minimum version])] && [AC_TRY_RUN([int main() { return ! (rexgen_version_int() >= 0x020006); }], 666 AC_MSG_RESULT([usable]) && [using_rexgen=yes], 667 AC_MSG_RESULT([TOO old. Rexgen not usable!]))] 668 )] 669 ) 670 if test "x$using_rexgen" == "xyes" ; then 671 AC_DEFINE(HAVE_LIBREXGEN,1,[Define to 1 if you have the `rexgen' library (-lrexgen).]) 672 else 673 if test "x$enable_rexgen" == "xyes" ; then 674 AC_MSG_FAILURE([rexgen not installed, or unusable version]) 675 fi 676 fi 677 AC_SUBST(REXGEN_LIBS, [$LIBS]) 678else 679 AC_MSG_NOTICE([rexgen check not enabled]) 680fi 681 682if test "x$ompfast" = xyes ; then 683 AC_DEFINE([FAST_FORMATS_OMP], 1, ["Enable if you want OpenMP for fast formats"]) 684fi 685 686LIBS="$BACKUP_LIBS" 687dnl in makefile, we need to know if building extra pcap items. 688if test "x$enable_pcap" != xno ; then 689 AC_CHECK_HEADERS([pcap.h pcap/pcap.h],[AC_CHECK_LIB([pcap],[pcap_compile], 690 [AC_SUBST(HAVE_PCAP,[-DHAVE_PCAP])] [AC_SUBST(PCAP_LIBS, [-lpcap])])] 691 [break]) 692 AC_CHECK_HEADERS([pcap.h pcap/pcap.h],[AC_CHECK_LIB([wpcap],[pcap_compile], 693 [AC_SUBST(HAVE_PCAP,[-DHAVE_PCAP])] [AC_SUBST(PCAP_LIBS, [-lwpcap])])] 694 [break]) 695 if test x"$enable_pcap" = xyes ; then 696 if test x"$ac_cv_lib_pcap_pcap_compile" != xyes ; then 697 if test x"$ac_cv_lib_wpcap_pcap_compile" != xyes; then 698 AC_MSG_FAILURE([PCAP not installed/usable]) 699 fi 700 fi 701 fi 702else 703 AC_MSG_NOTICE([PCAP check disabled]) 704fi 705 706dnl ====================================================================== 707dnl Check for variations we can handle 708dnl ====================================================================== 709AC_HEADER_TIME 710ACX_HEADER_STRING 711dnl Check missing stuff in OpenSSL (too old, or disabled features) 712LIBS_ORIG="$LIBS" 713CFLAGS_ORIG="$CFLAGS" 714LIBS="$OPENSSL_LIBS $COMMONCRYPTO_LIBS $LIBS" 715CFLAGS="$OPENSSL_CFLAGS $CFLAGS" 716AS_IF([test "$with_commoncrypto" = yes], [AC_DEFINE([HAVE_SHA256],1,[Define to 1 if you have the `SHA256' function.])]) 717AC_CHECK_FUNCS([SHA256 WHIRLPOOL RIPEMD160 AES_encrypt DSA_get0_pqg]) 718LIBS="$LIBS_ORIG" 719CFLAGS="$CFLAGS_ORIG" 720 721AC_CACHE_SAVE 722 723dnl ====================================================================== 724dnl Check packages: 725dnl ====================================================================== 726 727dnl Check for openMP (enable/disable handled within the macro). 728AC_OPENMP 729 730dnl Check for OpenCL (enable/disable handled within the macro) 731AS_IF([test "x$cross_compiling" = xno -a "x$enable_opencl" != xno], 732 [JTR_SET_OPENCL_INCLUDES]) 733AX_OPENCL(C) 734if test "x$CL_LIBS" = x; then 735 using_cl=no 736else 737 using_cl=yes 738 HAVE_OPENCL=-DHAVE_OPENCL 739fi 740 741dnl ZTEX USB-FPGA module support (if --enable-ztex=yes) 742AX_ZTEX 743 744dnl Checks for header files. 745dnl Eg. if sys/times.h is found, the below will define HAVE_SYS_TIMES_H 746AC_CHECK_HEADERS([arpa/inet.h crypt.h dirent.h fcntl.h limits.h locale.h \ 747 malloc.h net/ethernet.h netdb.h netinet/in.h \ 748 netinet/in_systm.h string.h strings.h \ 749 sys/ethernet.h sys/file.h sys/param.h sys/socket.h \ 750 sys/time.h sys/times.h sys/types.h termios.h \ 751 unistd.h unixlib/local.h windows.h]) 752dnl ====================================================================== 753dnl AC_CHECK_HEADERS([OS.h]) dnl (wrapped with __BEOS__) 754dnl AC_CHECK_HEADERS([stddef.h]) dnl too many to worry about. If this is an issue later, we will deal with it. 755dnl AC_CHECK_HEADERS([stdlib.h ]) dnl too many to worry about. If this is an issue later, we will deal with it. NOTE, it is included sometime earlier on some other check 756dnl AC_CHECK_HEADERS([sys/timeb.h]) dnl (wrapped with windows/msc/cygwin wrappers) 757dnl AC_CHECK_HEADERS([wchar.h ]) dnl (wrapped with __linux__ & HAVE_LIBDL) 758dnl ====================================================================== 759dnl Quirks for Solaris and OpenBSD 760AC_CHECK_HEADERS([net/if.h], [], [],[ 761#ifdef HAVE_SYS_SOCKET_H 762#include <sys/socket.h> 763#endif 764#ifdef HAVE_SYS_TYPES_H 765#include <sys/types.h> 766#endif 767]) 768AC_CHECK_HEADERS([net/if_arp.h], [], [],[ 769#ifdef HAVE_SYS_SOCKET_H 770#include <sys/socket.h> 771#endif 772#ifdef HAVE_SYS_TYPES_H 773#include <sys/types.h> 774#endif 775#ifdef HAVE_NET_IF_H 776#include <net/if.h> 777#endif 778]) 779AC_CHECK_HEADERS([netinet/if_ether.h], [], [],[ 780#ifdef HAVE_SYS_SOCKET_H 781#include <sys/socket.h> 782#endif 783#ifdef HAVE_ARPA_INET_H 784#include <arpa/inet.h> 785#endif 786#ifdef HAVE_SYS_TYPES_H 787#include <sys/types.h> 788#endif 789#ifdef HAVE_NET_IF_ARP_H 790#include <net/if_arp.h> 791#endif 792#ifdef HAVE_NET_IF_H 793#include <net/if.h> 794#endif 795]) 796AC_CHECK_HEADERS([netinet/ip.h], [], [], [ 797#ifdef HAVE_SYS_TYPES_H 798#include <sys/types.h> 799#endif 800#ifdef HAVE_NETINET_IN_SYSTM_H 801#include <netinet/in_systm.h> 802#endif 803#ifdef HAVE_NETINET_IN_H 804#include <netinet/in.h> 805#endif 806]) 807AC_CACHE_SAVE 808 809dnl Checks for typedefs, structures, and compiler characteristics. 810AC_CHECK_HEADER_STDBOOL 811AC_C_INLINE 812AC_TYPE_INT32_T 813AC_TYPE_INT64_T 814AC_TYPE_OFF_T 815AC_TYPE_SIZE_T 816AC_TYPE_SSIZE_T 817AC_TYPE_UINT16_T 818AC_TYPE_UINT32_T 819AC_TYPE_UINT64_T 820AC_TYPE_UINT8_T 821AC_CHECK_TYPES([ptrdiff_t]) 822AS_IF([test $CPU_BIT_STR -ge 64], [AS_IF([test "x$enable_int128" != xno], [AC_CHECK_TYPES([int128, __int128, __int128_t])])]) 823 824if test "x$enable_int128" = xno; then 825 have_int128=disabled 826elif test "x$ac_cv_type_int128" = xyes || 827 test "x$ac_cv_type___int128" = xyes || 828 test "x$ac_cv_type___int128_t" = xyes; then 829 have_int128=yes 830else 831 if test "x$enable_int128" = xyes; then 832 AC_MSG_FAILURE([int128 is not capable on this build]) 833 fi 834 have_int128=no 835fi 836 837dnl Checks for library functions. 838AC_FUNC_ERROR_AT_LINE 839 840dnl JtR's usage of fork may not work on minwin, even though the AC_FUNC_FORK says it should 841case "$host_os" in 842 mingw*) 843 dnl FORK is known to 'compile' but to fail and not be usable. 844 ac_cv_func_fork=no 845 ac_cv_func_fork_works=no 846 ac_cv_func_vfork=no 847 ac_cv_func_vfork_works=no 848 AC_MSG_CHECKING([for working fork]) 849 AC_MSG_RESULT([no - os disabled]) 850 AC_MSG_CHECKING([for working vfork]) 851 AC_MSG_RESULT([no - os disabled]) 852 ;; 853 *) 854 AC_FUNC_FORK 855 ;; 856esac 857 858dnl ====================================================================== 859dnl these checks HAVE to be there (we have code using them) 860dnl setenv/putenv fseek/ftell set, memmem sleep 861dnl stri*cmp/strcasecmp strlwr/strupr/strrev 862dnl ====================================================================== 863AC_CHECK_FUNCS([fseek64 fseeko fseeko64 _fseeki64 lseek64 lseek ftell64 ftello \ 864 ftello64 _ftelli64 fopen64 _fopen64 memmem mmap sleep \ 865 setenv putenv strcasecmp strncasecmp \ 866 stricmp strcmpi _stricmp _strcmpi strnicmp strncmpi _strnicmp \ 867 _strncmpi strnlen strlwr strupr strrev \ 868 atoll _atoi64 snprintf sprintf_s strcasestr]) 869dnl AC_CHECK_FUNCS([memchr memmove memset munmap pow \ 870dnl select setlocale socket strchr \ 871dnl strdup strerror strstr 872dnl these extras removed for issue 910 873dnl endpwent isascii mkdir rmdir atexit floor 874dnl ftruncate gethostbyname gettimeofday inet_ntoa 875dnl strrchr strcspn strspn strtol strtoul 876dnl ]) 877 878dnl Mesa claims to support OpenCL 1.2, but does not. 879CFLAGS_BACKUP=$CFLAGS 880LIBS_BACKUP=$LIBS 881CFLAGS="$CFLAGS $CL_CFLAGS" 882LIBS="$LIBS $CL_LIBS" 883AC_CHECK_FUNC([clGetKernelArgInfo], [AC_DEFINE(HAVE_OPENCL_1_2, 1, [Define to 1 if you (really) have OpenCL 1.2.])]) 884CFLAGS=$CFLAGS_BACKUP 885LIBS=$LIBS_BACKUP 886 887dnl This will stop at first found, will be used for mem_alloc_aligned() 888AC_CHECK_FUNCS([posix_memalign aligned_alloc memalign __mingw_aligned_malloc _aligned_malloc], break) 889 890AC_CACHE_SAVE 891 892if test "x$simd" != xno ; then 893 CPU_BEST_FLAGS_MAIN=-DJOHN_$(echo ${SIMD_NAME} | tr .a-z _A-Z) 894fi 895 896AC_SUBST([CC_CPU],["${CPU_BEST_FLAGS}"]) 897AC_SUBST([CC_MAIN_CPU],["${CPU_BEST_FLAGS_MAIN}"]) 898AC_SUBST([CC_ASM_OBJS],["${CC_ASM_OBJS}"]) 899AC_SUBST([CPU_BITS],["${CPU_BITS}"]) 900AC_SUBST([CPU_BIT_STR],["${CPU_BIT_STR}"]) 901AC_SUBST([ASFLAGS],["${ASFLAGS}"]) 902AC_SUBST([EXTRA_AS_FLAGS],["${EXTRA_AS_FLAGS}"]) 903 904AS_IF([test $ac_cv_sizeof_int -gt 4], 905 [AC_DEFINE([ARCH_INT_GT_32], 1, ["Enable if sizeof(int) > 4"])], 906 [AC_DEFINE([ARCH_INT_GT_32], 0, ["Enable if sizeof(int) > 4"])]) 907 908AS_IF([[test "$CPU_BIT_STR" -eq 64] && [test "$ac_cv_sizeof_long" -eq 4]], 909 [AC_DEFINE([ARCH_WORD], [long long], ["Type with native size"])], 910 [AC_DEFINE([ARCH_WORD], [long], ["Type with native size"])]) 911 912AS_IF([test "$CPU_BIT_STR" -eq 64], 913 [AC_DEFINE([ARCH_SIZE], 8, ["Native CPU width"])], 914 [AC_DEFINE([ARCH_SIZE], 4, ["Native CPU width"])]) 915AC_DEFINE_UNQUOTED([ARCH_BITS], [$CPU_BIT_STR], ["Native CPU width, bits"]) 916AS_IF([test "$CPU_BIT_STR" -eq 64], 917 [AC_DEFINE([ARCH_BITS_LOG], 6, ["Native CPU width, log"])], 918 [AC_DEFINE([ARCH_BITS_LOG], 5, ["Native CPU width, log"])]) 919AC_DEFINE_UNQUOTED([ARCH_BITS_STR], ["$CPU_BIT_STR"], ["Native CPU width, string"]) 920 921if test "$CPU_BIT_STR" = "32"; then 922 aesni_arch="86" 923else 924 aesni_arch="64" 925fi 926AC_SUBST([AESNI_ARCH],["$aesni_arch"]) 927 928aesni_os="" 929aesni_options="DISABLED" 930 931if test "x$ax_intel_x32" = xyes; then 932 aesni_os=linux aesni_options="-g dwarf2 -f elfx32" 933else 934 case "${host}_${CFLAGS}" in 935 *_*-mno-mmx*) ;; 936 *_*-mno-sse2*) ;; 937 x86_64*darwin*) 938 aesni_os=darwin 939 aesni_options="--prefix=_ -f macho${CPU_BIT_STR}" 940 ;; 941 i?86*darwin*) 942 aesni_os=darwin 943 aesni_options="-f macho${CPU_BIT_STR}" 944 ;; 945 *86*linux*) 946 aesni_os=linux 947 aesni_options="-g dwarf2 -f elf${CPU_BIT_STR}" 948 ;; 949 *86*cygwin*) 950 aesni_os=cygwin 951 aesni_options="-f win${CPU_BIT_STR}" 952 ;; 953 esac 954fi 955if test "x$aesni_options" != xDISABLED; then 956 AC_CACHE_CHECK([for yasm that supports "$aesni_options"], [ac_cv_path_YASM], 957 [AC_PATH_PROGS_FEATURE_CHECK([YASM], [yasm], 958 [[yasmout=`$ac_path_YASM $aesni_options 2>&1 | grep "No input files"` 959 test "x$yasmout" != x \ 960 && ac_cv_path_YASM=$ac_path_YASM ac_path_YASM_found=:]] 961 )]) 962fi 963 964if test "x$aesni_options" != xDISABLED -a "x$ac_path_YASM_found" != xfalse; then 965 using_aesni="run-time detection" 966elif test "$cpu_family" = intel; then 967 using_aesni="depends on OpenSSL" 968else 969 using_aesni=no 970fi 971AC_SUBST([YASM], [$ac_cv_path_YASM]) 972AC_SUBST([AESNI_OS],["$aesni_os"]) 973AC_SUBST([YASM_OPTIONS],["$aesni_options"]) 974 975JTR_SYSTEMS_SPECIFIC_LOGIC 976 977dnl The size of size_t and/or off_t might change when feature macros (chosen in 978dnl JTR_SYSTEMS_SPECIFIC_LOGIC) are used. 979CFLAGS_BACKUP="$CFLAGS" 980CFLAGS="$CFLAGS $CFLAGS_EXTRA" 981AC_CHECK_SIZEOF([size_t]) 982AC_CHECK_SIZEOF([off_t]) 983CFLAGS="$CFLAGS_BACKUP" 984 985if test "x$asan" = xyes ; then 986 CFLAGS=`echo $CFLAGS | sed 's/-g //g; s/-O2 //g'` 987 CFLAGS=`echo $CFLAGS | sed 's/-g$//g; s/-O2$//g'` 988 CFLAGS="-g $O_DEBUG -fsanitize=address $CFLAGS" 989 LDFLAGS="-fsanitize=address $LDFLAGS" 990fi 991 992if test "x$ubsan" = xyes ; then 993 CFLAGS=`echo $CFLAGS | sed 's/-g //g; s/-O2 //g'` 994 CFLAGS=`echo $CFLAGS | sed 's/-g$//g; s/-O2$//g'` 995 CFLAGS="-g $O_DEBUG -DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 -fsanitize=undefined $CFLAGS" 996 ASFLAGS="-DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 -fsanitize=undefined $ASFLAGS" 997 CPPFLAGS="-DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 $CPPFLAGS" 998 LDFLAGS="-fsanitize=undefined $LDFLAGS" 999fi 1000 1001if test "x$ubsantrap" = xyes ; then 1002 if test "x$ubsan" = xyes ; then 1003 AC_MSG_ERROR([--enable-ubsan and --enable-ubsantrap are mutually exclusive. Pick one or the other (or NONE)]) 1004 fi 1005 CFLAGS=`echo $CFLAGS | sed 's/-g //g; s/-O2 //g'` 1006 CFLAGS=`echo $CFLAGS | sed 's/-g$//g; s/-O2$//g'` 1007 CFLAGS="-g $O_DEBUG -DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 -fsanitize=undefined -fsanitize-undefined-trap-on-error $CFLAGS" 1008 ASFLAGS="-DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 -fsanitize=undefined -fsanitize-undefined-trap-on-error $ASFLAGS" 1009 CPPFLAGS="-DWITH_UBSAN -DARCH_ALLOWS_UNALIGNED=0 $CPPFLAGS" 1010 LDFLAGS="-fsanitize=undefined -fsanitize-undefined-trap-on-error $LDFLAGS" 1011fi 1012 1013dnl add ARCH_LITTLE_ENDIAN to command line, IF we know it is big or little 1014if test "x$endian" = "xbig"; then 1015 CFLAGS="$CFLAGS -DARCH_LITTLE_ENDIAN=0" 1016 ASFLAGS="$ASFLAGS -DARCH_LITTLE_ENDIAN=0" 1017else 1018 if test "x$endian" = "xlittle"; then 1019 CFLAGS="$CFLAGS -DARCH_LITTLE_ENDIAN=1" 1020 ASFLAGS="$ASFLAGS -DARCH_LITTLE_ENDIAN=1" 1021 fi 1022fi 1023 1024dnl build proper 'link' to the arch file (based on bit only, for 32 bit, we may 1025dnl want different ones, and for other CPU's we need different ones) 1026dnl note, we remove it first. 1027AS_IF([rm -f arch.h]) 1028AC_CONFIG_LINKS([arch.h:$ARCH_LINK]) 1029 1030dnl For the fastest MS formats, full Unicode support (4-byte UTF-8) can 1031dnl mean a 10% performance hit. Default is support for up to 3-byte UTF-8 1032dnl which corresponds to full UCS-2 or Unicode BMP. 1033AS_IF([test "x$enable_nt_unicode" != xno], [AC_DEFINE([NT_FULL_UNICODE],1,[Define to 1 if you want support for 4-byte UTF-8 in fast MS formats.])]) 1034 1035dnl Use features that may not yet be stable 1036AS_IF([test "x$experimental" != xno], [AC_DEFINE([USE_EXPERIMENTAL],1,[Define to 1 if you want to include experimental code.])]) 1037 1038dnl In makefile, we need to know if building extra fuzz items. 1039if test "x$fuzz" != xno ; then 1040 AC_SUBST(HAVE_FUZZ,[-DHAVE_FUZZ]) 1041else 1042 AC_MSG_NOTICE([Fuzz check disabled]) 1043fi 1044 1045dnl In makefile, we need to know if building with libFuzzer. 1046if test "x$libfuzzer" != xno ; then 1047 AC_SUBST(HAVE_LIBFUZZER,[-DHAVE_LIBFUZZER]) 1048else 1049 AC_MSG_NOTICE([Fuzzing (using libFuzzer) check disabled]) 1050fi 1051 1052dnl code to create M4_INCLUDES (all ./m4/*.m4 ) 1053AC_SUBST([M4_INCLUDES],[`echo m4/*.m4`]) 1054 1055dnl Handle --prefix -> JOHN_SYSTEMWIDE 1056dnl A prefix of /usr/local will mean execs in /usr/local/bin and the rest 1057dnl in /usr/local/share/john 1058AS_IF([test $prefix != "../run" && test $prefix != "NONE" ], 1059 [CFLAGS="$CFLAGS -DJOHN_SYSTEMWIDE -DJOHN_SYSTEMWIDE_EXEC='\"$prefix/bin\"' -DJOHN_SYSTEMWIDE_HOME='\"$prefix/share/john\"'"], 1060 [AS_IF([test $with_systemwide != no], [CFLAGS="$CFLAGS -DJOHN_SYSTEMWIDE" 1061 prefix=/usr/libexec/john])] 1062) 1063 1064if test x$with_flock != xno; then 1065 CFLAGS="$CFLAGS -DPREFER_FLOCK" 1066fi 1067 1068dnl if test ${SIMD_NAME} = "AVX2" || test ${host_cpu} = "k1om"; then 1069dnl if test x$experimental = xno; then 1070dnl AC_DEFINE([DYNAMIC_DISABLED], 1, [Disables Dynamic format completely]) 1071dnl fi 1072dnl fi 1073 1074dnl ====================================================================== 1075dnl Code to create @PLUGFORMATS_OBJS@ and 1076dnl john_buildrule.h moved from Makefile.in to here. 1077dnl don't build opencl_*plug.c unless an opencl build 1078dnl ====================================================================== 1079if test x$using_cl = xyes ; then 1080 AC_MSG_NOTICE([creating *_plug.c and OpenCL object rules]) 1081else 1082 AC_MSG_NOTICE([creating *_plug.c rules, WITHOUT OpenCL objects]) 1083fi 1084AC_SUBST([KERNEL_OBJS],[]) 1085AC_SUBST([KERNEL_DEPS],[]) 1086if test "`echo *_plug.c`" != "*_plug.c"; then 1087 AC_SUBST([PLUGFORMATS_OBJS],[`echo *_plug.c | sed 's/opencl[[A-Za-z0-9_\-]]*\.c //g;s/\.c/.o/g'`]) 1088 AC_SUBST([OPENCL_PLUGFORMATS_OBJS],[`echo opencl*_plug.c | sed 's/\.c/.o/g'`]) 1089 if test x$using_cl = xyes ; then 1090 AC_SUBST([KERNEL_OBJS],[`echo opencl/*.cl | sed 's/opencl\//..\/run\/kernels\//g'`]) 1091 fi 1092 if test "x$plug_deps" = xyes -a "x$PERL" != x ; then 1093 AC_MSG_NOTICE([creating Makefile dependencies]) 1094 AC_SUBST([PLUGFORMATS_DEPS],[`$PERL ./plugin_deps.pl *_plug.c`]) 1095 if test x$using_cl = xyes ; then 1096 AC_SUBST([KERNEL_DEPS],[`$PERL ./plugin_deps.pl opencl/*.cl`]) 1097 fi 1098 fi 1099fi 1100 1101AC_MSG_NOTICE([creating ./john_build_rule.h]) 1102echo "#define JOHN_BLD \"${host_os} ${CPU_BIT_STR}-bit${using_x32} ${host_cpu} ${SIMD_NAME} AC\"" > john_build_rule.h 1103 1104AC_SUBST([HOST_OS],["$host_os"]) 1105AC_CONFIG_FILES([Makefile 1106 aes/Makefile 1107 aes/aesni/Makefile 1108 aes/openssl/Makefile 1109 secp256k1/Makefile 1110 ed25519-donna/Makefile]) 1111 1112dnl Escaping the '#' in things like "-Wno-error=#warnings" is required in 1113dnl Makefile but forbidden when *not* in Makefile so we need to back-up 1114dnl CFLAGS_EXTRA before writing Makefile, and revert after (duh!) 1115CFLAGS_EXTRA_BACKUP=$CFLAGS_EXTRA 1116CFLAGS_EXTRA=$(echo $CFLAGS_EXTRA | sed 's/#/\\#/g') 1117 1118dnl This actually writes Makefile et al. 1119AC_OUTPUT(,echo "timestamp from configure.in" > autoconfig-stamp-h) 1120 1121CFLAGS_EXTRA=$CFLAGS_EXTRA_BACKUP 1122 1123dnl ====================================================================== 1124dnl Create fmt_externs.h and fmt_registers.h 1125dnl This needs arch.h to be linked so can't happen before 1126dnl AC_OUTPUT 1127dnl ====================================================================== 1128AC_MSG_NOTICE([creating ./fmt_externs.h]) 1129rm -f fmt_externs.h 1130 1131CFLAGS_EX2= 1132if test "x$simd" = xno ; then 1133 CFLAGS_EX2=-DJOHN_NO_SIMD 1134fi 1135 1136if test "`echo *_fmt_plug.c`" != "*_fmt_plug.c"; then 1137 $CPP -P -DAC_BUILT $CFLAGS_EX2 $CPPFLAGS $CPU_BEST_FLAGS $CFLAGS $HAVE_OPENCL $CFLAGS_EXTRA $OPENMP_CFLAGS $OPENSSL_CFLAGS -DFMT_EXTERNS_H *_fmt_plug.c | LC_ALL=C $GREP "extern struct fmt_main" | LC_ALL=C $SORT -f > fmt_externs.h 1138fi 1139dnl if the file was not created, then bail. 1140if test -f fmt_externs.h -a ! -s fmt_externs.h; then 1141 cp Makefile.stub Makefile 1142 AC_MSG_ERROR([The build of fmt_externs.h failed. Can not continue!]) 1143fi 1144dnl if file does not exist, then create a blank one (i.e. no *_plug.c files) 1145if test ! -f fmt_externs.h; then 1146 echo >fmt_externs.h 1147fi 1148AC_MSG_NOTICE([creating ./fmt_registers.h]) 1149rm -f fmt_registers.h 1150if test "`echo *_fmt_plug.c`" != "*_fmt_plug.c"; then 1151 $CPP -P -DAC_BUILT $CFLAGS_EX2 $CPPFLAGS $CPU_BEST_FLAGS $CFLAGS $CFLAGS_EXTRA $OPENMP_CFLAGS $OPENSSL_CFLAGS -DFMT_REGISTERS_H *_fmt_plug.c | LC_ALL=C $GREP "john_register_one" | LC_ALL=C $SORT -f > fmt_registers.h 1152fi 1153dnl if the file was not created, then bail. 1154if test -f fmt_registers.h -a ! -s fmt_registers.h; then 1155 cp Makefile.stub Makefile 1156 AC_MSG_ERROR([The build of fmt_registers.h failed. Can not continue!]) 1157fi 1158dnl if file does not exist, then create a blank one (i.e. no *_plug.c files) 1159if test ! -f fmt_registers.h; then 1160 echo >fmt_registers.h 1161fi 1162 1163if test "`echo opencl_*_fmt_plug.c`" != "opencl_*_fmt_plug.c"; then 1164 $CPP -P -DAC_BUILT $CFLAGS_EX2 $CPPFLAGS $CPU_BEST_FLAGS $CFLAGS $HAVE_OPENCL $CFLAGS_EXTRA $OPENMP_CFLAGS $OPENSSL_CFLAGS -DFMT_REGISTERS_H opencl_*_fmt_plug.c | LC_ALL=C $GREP "john_register_one" | LC_ALL=C $SORT -f >> fmt_registers.h 1165fi 1166 1167dnl ====================================================================== 1168dnl ONLY _COSMETICAL_ OUTPUT STUFF BELOW THIS LINE 1169dnl ====================================================================== 1170 1171dnl Hard to get proper info from AC_OPENMP. If it's enabled with no special 1172dnl options needed, we might end up listing it as disabled 1173if test "x$ac_cv_prog_c_openmp" != x -a "x$enable_openmp" != xno -a dnl 1174 "x$ac_cv_prog_c_openmp" != xunsupported ; then 1175 if test "x$ompfast" = "xyes"; then 1176 using_omp=yes 1177 else 1178 using_omp="yes (not for fast formats)" 1179 fi 1180else 1181 if test "x$ompfast" = "xyes"; then 1182 AC_MSG_FAILURE([OMP for fast formats requested, but no OMP on this system]) 1183 fi 1184 using_omp=no 1185fi 1186 1187if test "x$ac_cv_search_crypt" != xno; then 1188 using_crypt=yes 1189else 1190 using_crypt=no 1191fi 1192 1193if test "x$ac_cv_lib_z_deflate" = xyes; then 1194 using_zlib=yes 1195else 1196 using_zlib=no 1197fi 1198 1199if test "x$ac_cv_lib_bz2_main" = xyes; then 1200 using_bz2=yes 1201else 1202 using_bz2=no 1203fi 1204 1205if test "x$ac_cv_func_mmap" != xno; then 1206 using_mmap=yes 1207else 1208 using_mmap=no 1209fi 1210 1211if test -n "$SIMD_NAME"; then 1212 CPU_NAME="$host_cpu $SIMD_NAME" 1213else 1214 CPU_NAME=$host_cpu 1215fi 1216 1217dnl Ensure reports of tests does not show up blank: 1218if test "x$ac_cv_func_fork_works" = x ; then 1219 ac_cv_func_fork_works=no 1220fi 1221if test "x$ac_cv_lib_gmp___gmpz_init" = x ; then 1222 ac_cv_lib_gmp___gmpz_init=no 1223fi 1224using_pcap=no 1225if test "x$ac_cv_lib_pcap_pcap_compile" = xyes ; then 1226 using_pcap=yes 1227fi 1228if test "x$ac_cv_lib_wpcap_pcap_compile" = xyes; then 1229 using_pcap=yes 1230fi 1231if test $(echo "$CFLAGS" | ${GREP} -c -- "-O") -eq 0 && 1232 test $(echo "$CFLAGS" | ${GREP} -c -- "-xO") -eq 0 && 1233 test $(echo "$CFLAGS" | ${GREP} -c -- "-fast\b") -eq 0; then 1234 AC_MSG_WARN([No recognized optimization option present in CFLAGS "$CFLAGS"]) 1235fi 1236if test "x$endian" = "xbig"; then 1237 using_endian="BE" 1238else 1239 using_endian="LE" 1240fi 1241if test x$_cv_gnu_make_command = x; then 1242 use_make=make 1243else 1244 use_make=$_cv_gnu_make_command 1245fi 1246 1247if test "x$asan" = xyes ; then 1248 asan="enabled" 1249else 1250 asan="disabled" 1251fi 1252 1253if test "x$ubsan" = xyes ; then 1254 ubsan="enabled" 1255else 1256 ubsan="disabled" 1257fi 1258 1259if test "x$ubsantrap" = xyes ; then 1260 ubsan="enabled (trap)" 1261fi 1262 1263cat <<EOF 1264dnl ====================================================================== 1265 1266Configured for building John the Ripper ${PACKAGE_VERSION}: 1267 1268Target CPU ................................. ${CPU_NAME}, ${CPU_BIT_STR}-bit ${using_endian}${using_x32} 1269AES-NI support ............................. ${using_aesni} 1270Target OS .................................. ${host_os} 1271Cross compiling ............................ ${cross_compiling} 1272Legacy arch header ......................... ${ARCH_LINK} 1273 1274Optional libraries/features found: 1275Memory map (share/page large files) ........ ${using_mmap} 1276Fork support ............................... ${ac_cv_func_fork_works} 1277OpenMP support ............................. ${using_omp} 1278OpenCL support ............................. ${using_cl} 1279Generic crypt(3) format .................... ${using_crypt} 1280libgmp (PRINCE mode and faster SRP formats) ${ac_cv_lib_gmp___gmpz_init} 1281128-bit integer (faster PRINCE mode) ....... ${have_int128} 1282libz (pkzip and some other formats) ........ ${using_zlib} 1283libbz2 (gpg2john extra decompression logic) ${using_bz2} 1284libpcap (vncpcap2john and SIPdump) ......... ${using_pcap} 1285OpenMPI support (default disabled) ......... ${using_mpi} 1286ZTEX USB-FPGA module 1.15y support ......... ${ztex} 1287 1288EOF 1289 1290dnl === this section is NOT output, unless there is some debugging flag enabled. 1291if test "$ubsan" != "disabled" || test "$asan" != "disabled" || 1292 test "$fuzz" != "no" || test "$experimental" != "no" || 1293 test "$using_rexgen" != "no" ; then 1294cat <<EOF 1295Development options (these may hurt performance when enabled): 1296AddressSanitizer ("ASan") .................. ${asan} 1297UndefinedBehaviorSanitizer ("UbSan") ....... ${ubsan} 1298Fuzzing test ............................... ${fuzz} 1299Experimental code .......................... ${experimental} 1300 - librexgen (regex mode) .................. ${using_rexgen} 1301 1302EOF 1303fi 1304 1305echo "Install missing libraries to get any needed features that were omitted." 1306echo "" 1307echo "Configure finished. Now \"${use_make} -s clean && ${use_make} -sj4\" to compile." 1308dnl ====================================================================== 1309