OLD | NEW |
(Empty) | |
| 1 # -*- Autoconf -*- |
| 2 # Process this file with autoconf to produce a configure script. |
| 3 |
| 4 ############################################################################### |
| 5 # |
| 6 # Author: Lasse Collin |
| 7 # |
| 8 # This file has been put into the public domain. |
| 9 # You can do whatever you want with this file. |
| 10 # |
| 11 ############################################################################### |
| 12 |
| 13 # NOTE: Don't add useless checks. autoscan detects this and that, but don't |
| 14 # let it confuse you. For example, we don't care about checking for behavior |
| 15 # of malloc(), stat(), or lstat(), since we don't use those functions in |
| 16 # a way that would cause the problems the autoconf macros check. |
| 17 |
| 18 AC_PREREQ([2.64]) |
| 19 |
| 20 AC_INIT([XZ Utils], m4_esyscmd([/bin/sh version.sh]), |
| 21 [lasse.collin@tukaani.org], [xz], [http://tukaani.org/xz/]) |
| 22 AC_CONFIG_SRCDIR([src/liblzma/common/common.h]) |
| 23 AC_CONFIG_AUX_DIR([build-aux]) |
| 24 AC_CONFIG_MACRO_DIR([m4]) |
| 25 AC_CONFIG_HEADER([config.h]) |
| 26 |
| 27 echo |
| 28 echo "$PACKAGE_STRING" |
| 29 |
| 30 echo |
| 31 echo "System type:" |
| 32 # This is needed to know if assembler optimizations can be used. |
| 33 AC_CANONICAL_HOST |
| 34 |
| 35 # We do some special things on Windows (32-bit or 64-bit) builds. |
| 36 case $host_os in |
| 37 mingw* | cygwin*) is_w32=yes ;; |
| 38 *) is_w32=no ;; |
| 39 esac |
| 40 AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes]) |
| 41 |
| 42 # We need to use $EXEEXT with $(LN_S) when creating symlinks to |
| 43 # executables. Cygwin is an exception to this, since it is recommended |
| 44 # that symlinks don't have the .exe suffix. To make this work, we |
| 45 # define LN_EXEEXT. |
| 46 case $host_os in |
| 47 cygwin) LN_EXEEXT= ;; |
| 48 *) LN_EXEEXT='$(EXEEXT)' ;; |
| 49 esac |
| 50 AC_SUBST([LN_EXEEXT]) |
| 51 |
| 52 echo |
| 53 echo "Configure options:" |
| 54 AM_CFLAGS= |
| 55 |
| 56 |
| 57 ############# |
| 58 # Debugging # |
| 59 ############# |
| 60 |
| 61 AC_MSG_CHECKING([if debugging code should be compiled]) |
| 62 AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [Enable debugging code.]
), |
| 63 [], enable_debug=no) |
| 64 if test "x$enable_debug" = xyes; then |
| 65 AC_MSG_RESULT([yes]) |
| 66 else |
| 67 AC_DEFINE([NDEBUG], [1], [Define to 1 to disable debugging code.]) |
| 68 AC_MSG_RESULT([no]) |
| 69 fi |
| 70 |
| 71 |
| 72 ########### |
| 73 # Filters # |
| 74 ########### |
| 75 |
| 76 m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,
sparc])dnl |
| 77 m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,sparc]) |
| 78 m4_define([LZ_FILTERS], [lzma1,lzma2]) |
| 79 |
| 80 m4_foreach([NAME], [SUPPORTED_FILTERS], |
| 81 [enable_filter_[]NAME=no |
| 82 enable_encoder_[]NAME=no |
| 83 enable_decoder_[]NAME=no |
| 84 ])dnl |
| 85 |
| 86 AC_MSG_CHECKING([which encoders to build]) |
| 87 AC_ARG_ENABLE([encoders], AC_HELP_STRING([--enable-encoders=LIST], |
| 88 [Comma-separated list of encoders to build. Default=all. |
| 89 Available encoders:] |
| 90 m4_translit(m4_defn([SUPPORTED_FILTERS]), [,], [ ])), |
| 91 [], [enable_encoders=SUPPORTED_FILTERS]) |
| 92 enable_encoders=`echo "$enable_encoders" | sed 's/,/ /g'` |
| 93 if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then |
| 94 AC_MSG_RESULT([(none)]) |
| 95 else |
| 96 AC_DEFINE([HAVE_ENCODER], [1], |
| 97 [Define to 1 if encoder components are enabled.]) |
| 98 for arg in $enable_encoders |
| 99 do |
| 100 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [ |
| 101 NAME) |
| 102 enable_filter_[]NAME=yes |
| 103 enable_encoder_[]NAME=yes |
| 104 AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1], |
| 105 [Define to 1 if] NAME [encoder is enabled.]) |
| 106 ;;]) |
| 107 *) |
| 108 AC_MSG_RESULT([]) |
| 109 AC_MSG_ERROR([unknown filter: $arg]) |
| 110 ;; |
| 111 esac |
| 112 done |
| 113 AC_MSG_RESULT([$enable_encoders]) |
| 114 fi |
| 115 |
| 116 AC_MSG_CHECKING([which decoders to build]) |
| 117 AC_ARG_ENABLE([decoders], AC_HELP_STRING([--enable-decoders=LIST], |
| 118 [Comma-separated list of decoders to build. Default=all. |
| 119 Available decoders are the same as available encoders.]), |
| 120 [], [enable_decoders=SUPPORTED_FILTERS]) |
| 121 enable_decoders=`echo "$enable_decoders" | sed 's/,/ /g'` |
| 122 if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then |
| 123 AC_MSG_RESULT([(none)]) |
| 124 else |
| 125 AC_DEFINE([HAVE_DECODER], [1], |
| 126 [Define to 1 if decoder components are enabled.]) |
| 127 for arg in $enable_decoders |
| 128 do |
| 129 case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [ |
| 130 NAME) |
| 131 enable_filter_[]NAME=yes |
| 132 enable_decoder_[]NAME=yes |
| 133 AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1], |
| 134 [Define to 1 if] NAME [decoder is enabled.]) |
| 135 ;;]) |
| 136 *) |
| 137 AC_MSG_RESULT([]) |
| 138 AC_MSG_ERROR([unknown filter: $arg]) |
| 139 ;; |
| 140 esac |
| 141 done |
| 142 |
| 143 # LZMA2 requires that LZMA1 is enabled. |
| 144 test "x$enable_encoder_lzma2" = xyes && enable_encoder_lzma1=yes |
| 145 test "x$enable_decoder_lzma2" = xyes && enable_decoder_lzma1=yes |
| 146 |
| 147 AC_MSG_RESULT([$enable_decoders]) |
| 148 fi |
| 149 |
| 150 if test "x$enable_encoder_lzma2$enable_encoder_lzma1" = xyesno \ |
| 151 || test "x$enable_decoder_lzma2$enable_decoder_lzma1" = xyesno;
then |
| 152 AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.]) |
| 153 fi |
| 154 |
| 155 AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno && test "x$ena
ble_encoders" != x) |
| 156 AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno && test "x$ena
ble_decoders" != x) |
| 157 |
| 158 m4_foreach([NAME], [SUPPORTED_FILTERS], |
| 159 [AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" =
xyes) |
| 160 AM_CONDITIONAL(COND_ENCODER_[]m4_toupper(NAME), test "x$enable_encoder_[]NAME" =
xyes) |
| 161 AM_CONDITIONAL(COND_DECODER_[]m4_toupper(NAME), test "x$enable_decoder_[]NAME" =
xyes) |
| 162 ])dnl |
| 163 |
| 164 # The so called "simple filters" share common code. |
| 165 enable_filter_simple=no |
| 166 enable_encoder_simple=no |
| 167 enable_decoder_simple=no |
| 168 m4_foreach([NAME], [SIMPLE_FILTERS], |
| 169 [test "x$enable_filter_[]NAME" = xyes && enable_filter_simple=yes |
| 170 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_simple=yes |
| 171 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_simple=yes |
| 172 ])dnl |
| 173 AM_CONDITIONAL(COND_FILTER_SIMPLE, test "x$enable_filter_simple" = xyes) |
| 174 AM_CONDITIONAL(COND_ENCODER_SIMPLE, test "x$enable_encoder_simple" = xyes) |
| 175 AM_CONDITIONAL(COND_DECODER_SIMPLE, test "x$enable_decoder_simple" = xyes) |
| 176 |
| 177 # LZ-based filters share common code. |
| 178 enable_filter_lz=no |
| 179 enable_encoder_lz=no |
| 180 enable_decoder_lz=no |
| 181 m4_foreach([NAME], [LZ_FILTERS], |
| 182 [test "x$enable_filter_[]NAME" = xyes && enable_filter_lz=yes |
| 183 test "x$enable_encoder_[]NAME" = xyes && enable_encoder_lz=yes |
| 184 test "x$enable_decoder_[]NAME" = xyes && enable_decoder_lz=yes |
| 185 ])dnl |
| 186 AM_CONDITIONAL(COND_FILTER_LZ, test "x$enable_filter_lz" = xyes) |
| 187 AM_CONDITIONAL(COND_ENCODER_LZ, test "x$enable_encoder_lz" = xyes) |
| 188 AM_CONDITIONAL(COND_DECODER_LZ, test "x$enable_decoder_lz" = xyes) |
| 189 |
| 190 |
| 191 ################# |
| 192 # Match finders # |
| 193 ################# |
| 194 |
| 195 m4_define([SUPPORTED_MATCH_FINDERS], [hc3,hc4,bt2,bt3,bt4]) |
| 196 |
| 197 m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], |
| 198 [enable_match_finder_[]NAME=no |
| 199 ]) |
| 200 |
| 201 AC_MSG_CHECKING([which match finders to build]) |
| 202 AC_ARG_ENABLE([match-finders], AC_HELP_STRING([--enable-match-finders=LIST], |
| 203 [Comma-separated list of match finders to build. Default=all. |
| 204 At least one match finder is required for encoding with |
| 205 the LZMA1 and LZMA2 filters. Available match finders:] |
| 206 m4_translit(m4_defn([SUPPORTED_MATCH_FINDERS]), [,], [ ])), [], |
| 207 [enable_match_finders=SUPPORTED_MATCH_FINDERS]) |
| 208 enable_match_finders=`echo "$enable_match_finders" | sed 's/,/ /g'` |
| 209 if test "x$enable_encoder_lz" = xyes ; then |
| 210 for arg in $enable_match_finders |
| 211 do |
| 212 case $arg in m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [ |
| 213 NAME) |
| 214 enable_match_finder_[]NAME=yes |
| 215 AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1], |
| 216 [Define to 1 to enable] NAME [match finder.]) |
| 217 ;;]) |
| 218 *) |
| 219 AC_MSG_RESULT([]) |
| 220 AC_MSG_ERROR([unknown match finder: $arg]) |
| 221 ;; |
| 222 esac |
| 223 done |
| 224 AC_MSG_RESULT([$enable_match_finders]) |
| 225 else |
| 226 AC_MSG_RESULT([(none because not building any LZ-based encoder)]) |
| 227 fi |
| 228 |
| 229 |
| 230 #################### |
| 231 # Integrity checks # |
| 232 #################### |
| 233 |
| 234 m4_define([SUPPORTED_CHECKS], [crc32,crc64,sha256]) |
| 235 |
| 236 m4_foreach([NAME], [SUPPORTED_FILTERS], |
| 237 [enable_check_[]NAME=no |
| 238 ])dnl |
| 239 |
| 240 AC_MSG_CHECKING([which integrity checks to build]) |
| 241 AC_ARG_ENABLE([checks], AC_HELP_STRING([--enable-checks=LIST], |
| 242 [Comma-separated list of integrity checks to build. |
| 243 Default=all. Available integrity checks:] |
| 244 m4_translit(m4_defn([SUPPORTED_CHECKS]), [,], [ ])), |
| 245 [], [enable_checks=SUPPORTED_CHECKS]) |
| 246 enable_checks=`echo "$enable_checks" | sed 's/,/ /g'` |
| 247 if test "x$enable_checks" = xno || test "x$enable_checks" = x; then |
| 248 AC_MSG_RESULT([(none)]) |
| 249 else |
| 250 for arg in $enable_checks |
| 251 do |
| 252 case $arg in m4_foreach([NAME], [SUPPORTED_CHECKS], [ |
| 253 NAME) |
| 254 enable_check_[]NAME=yes |
| 255 AC_DEFINE(HAVE_CHECK_[]m4_toupper(NAME), [1], |
| 256 [Define to 1 if] NAME |
| 257 [integrity check is enabled.]) |
| 258 ;;]) |
| 259 *) |
| 260 AC_MSG_RESULT([]) |
| 261 AC_MSG_ERROR([unknown integrity check: $arg]) |
| 262 ;; |
| 263 esac |
| 264 done |
| 265 AC_MSG_RESULT([$enable_checks]) |
| 266 fi |
| 267 if test "x$enable_checks_crc32" = xno ; then |
| 268 AC_MSG_ERROR([For now, the CRC32 check must always be enabled.]) |
| 269 fi |
| 270 |
| 271 m4_foreach([NAME], [SUPPORTED_CHECKS], |
| 272 [AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xy
es) |
| 273 ])dnl |
| 274 |
| 275 |
| 276 ########################### |
| 277 # Assembler optimizations # |
| 278 ########################### |
| 279 |
| 280 AC_MSG_CHECKING([if assembler optimizations should be used]) |
| 281 AC_ARG_ENABLE([assembler], AC_HELP_STRING([--disable-assembler], |
| 282 [Do not use assembler optimizations even if such exist |
| 283 for the architecture.]), |
| 284 [], [enable_assembler=yes]) |
| 285 if test "x$enable_assembler" = xyes; then |
| 286 enable_assembler=no |
| 287 case $host_os in |
| 288 # Darwin should work too but only if not creating universal |
| 289 # binaries. Solaris x86 could work too but I cannot test. |
| 290 linux* | *bsd* | mingw* | cygwin*) |
| 291 case $host_cpu in |
| 292 i?86) enable_assembler=x86 ;; |
| 293 x86_64) enable_assembler=x86_64 ;; |
| 294 esac |
| 295 ;; |
| 296 esac |
| 297 fi |
| 298 case $enable_assembler in |
| 299 x86 | x86_64 | no) |
| 300 AC_MSG_RESULT([$enable_assembler]) |
| 301 ;; |
| 302 *) |
| 303 AC_MSG_RESULT([]) |
| 304 AC_MSG_ERROR([--enable-assembler accepts only \`yes', \`no', \`x
86', or \`x86_64'.]) |
| 305 ;; |
| 306 esac |
| 307 AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86) |
| 308 AM_CONDITIONAL(COND_ASM_X86_64, test "x$enable_assembler" = xx86_64) |
| 309 |
| 310 |
| 311 ##################### |
| 312 # Size optimization # |
| 313 ##################### |
| 314 |
| 315 AC_MSG_CHECKING([if small size is preferred over speed]) |
| 316 AC_ARG_ENABLE([small], AC_HELP_STRING([--enable-small], |
| 317 [Make liblzma smaller and a little slower. |
| 318 This is disabled by default to optimize for speed.]), |
| 319 [], [enable_small=no]) |
| 320 if test "x$enable_small" = xyes; then |
| 321 AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.]) |
| 322 elif test "x$enable_small" != xno; then |
| 323 AC_MSG_RESULT([]) |
| 324 AC_MSG_ERROR([--enable-small accepts only \`yes' or \`no']) |
| 325 fi |
| 326 AC_MSG_RESULT([$enable_small]) |
| 327 AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes) |
| 328 |
| 329 |
| 330 ############# |
| 331 # Threading # |
| 332 ############# |
| 333 |
| 334 AC_MSG_CHECKING([if threading support is wanted]) |
| 335 AC_ARG_ENABLE([threads], AC_HELP_STRING([--disable-threads], |
| 336 [Disable threading support. |
| 337 This makes some things thread-unsafe.]), |
| 338 [], [enable_threads=yes]) |
| 339 if test "x$enable_threads" != xyes && test "x$enable_threads" != xno; then |
| 340 AC_MSG_RESULT([]) |
| 341 AC_MSG_ERROR([--enable-threads accepts only \`yes' or \`no']) |
| 342 fi |
| 343 AC_MSG_RESULT([$enable_threads]) |
| 344 # We use the actual result a little later. |
| 345 |
| 346 |
| 347 ######################### |
| 348 # Assumed amount of RAM # |
| 349 ######################### |
| 350 |
| 351 # We use 128 MiB as default, because it will allow decompressing files |
| 352 # created with "xz -9". It would be slightly safer to guess a lower value, |
| 353 # but most systems, on which we don't have any way to determine the amount |
| 354 # of RAM, will probably have at least 128 MiB of RAM. |
| 355 AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown]) |
| 356 AC_ARG_ENABLE([assume-ram], AC_HELP_STRING([--enable-assume-ram=SIZE], |
| 357 [If and only if the real amount of RAM cannot be determined, |
| 358 assume SIZE MiB. The default is 128 MiB. This affects the |
| 359 default memory usage limit.]), |
| 360 [], [enable_assume_ram=128]) |
| 361 assume_ram_check=`echo "$enable_assume_ram" | tr -d 0123456789` |
| 362 if test -z "$enable_assume_ram" || test -n "$assume_ram_check"; then |
| 363 AC_MSG_RESULT([]) |
| 364 AC_MSG_ERROR([--enable-assume-ram accepts only an integer argument]) |
| 365 fi |
| 366 AC_MSG_RESULT([$enable_assume_ram MiB]) |
| 367 AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram], |
| 368 [How many MiB of RAM to assume if the real amount cannot |
| 369 be determined.]) |
| 370 |
| 371 |
| 372 ############################################ |
| 373 # xz/xzdec/lzmadec linkage against liblzma # |
| 374 ############################################ |
| 375 |
| 376 # Link the xz, xzdec, and lzmadec command line tools against static liblzma |
| 377 # unless using --enable-dynamic. Using static liblzma gives a little bit |
| 378 # faster executable on x86, because no register is wasted for PIC. We also |
| 379 # have one dependency less, which allows users to more freely copy the xz |
| 380 # binary to other boxes. However, I wouldn't be surprised if distro |
| 381 # maintainers still prefer dynamic linking, so let's make it easy for them. |
| 382 |
| 383 AC_MSG_CHECKING([how programs should be linked against liblzma]) |
| 384 AC_ARG_ENABLE([dynamic], [AC_HELP_STRING([--enable-dynamic=TYPE], |
| 385 [Set how command line tools are linked against liblzma. |
| 386 TYPE can be mixed, yes, or no. The default is mixed.])], |
| 387 [], [enable_dynamic=mixed]) |
| 388 case $enable_dynamic in |
| 389 mixed) |
| 390 AC_MSG_RESULT([mixed (some dynamically, some statically)]) |
| 391 ;; |
| 392 yes) |
| 393 AC_MSG_RESULT([dynamically]) |
| 394 ;; |
| 395 no) |
| 396 AC_MSG_RESULT([statically]) |
| 397 ;; |
| 398 *) |
| 399 AC_MSG_RESULT([]) |
| 400 AC_MSG_ERROR([--enable-dynamic accepts only \`mixed', \`yes', or
\`no']) |
| 401 ;; |
| 402 esac |
| 403 # We use the actual results later, because we don't know yet |
| 404 # if --disable-shared or --disable-static was used. |
| 405 |
| 406 |
| 407 ############################################################################### |
| 408 # Checks for programs. |
| 409 ############################################################################### |
| 410 |
| 411 echo |
| 412 gl_POSIX_SHELL |
| 413 if test -z "$POSIX_SHELL" ; then |
| 414 AC_MSG_ERROR([No POSIX conforming shell (sh) was found.]) |
| 415 fi |
| 416 |
| 417 echo |
| 418 echo "Initializing Automake:" |
| 419 |
| 420 AM_INIT_AUTOMAKE([1.10 foreign tar-v7 filename-length-max=99]) |
| 421 AC_PROG_LN_S |
| 422 |
| 423 AC_PROG_CC_C99 |
| 424 if test x$ac_cv_prog_cc_c99 = xno ; then |
| 425 AC_MSG_ERROR([No C99 compiler was found.]) |
| 426 fi |
| 427 |
| 428 AM_PROG_CC_C_O |
| 429 AM_PROG_AS |
| 430 AC_USE_SYSTEM_EXTENSIONS |
| 431 |
| 432 if test "x$enable_threads" = xyes; then |
| 433 echo |
| 434 echo "Threading support:" |
| 435 ACX_PTHREAD |
| 436 LIBS="$LIBS $PTHREAD_LIBS" |
| 437 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS" |
| 438 CC="$PTHREAD_CC" |
| 439 fi |
| 440 |
| 441 echo |
| 442 echo "Initializing Libtool:" |
| 443 LT_PREREQ([2.2]) |
| 444 LT_INIT([win32-dll]) |
| 445 LT_LANG([Windows Resource]) |
| 446 |
| 447 # This is a bit wrong since it is possible to request that only some libs |
| 448 # are built as shared. Using that feature isn't so common though, and this |
| 449 # breaks only on Windows (at least for now) if the user enables only some |
| 450 # libs as shared. |
| 451 AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno]) |
| 452 |
| 453 |
| 454 ############################################################################### |
| 455 # Checks for libraries. |
| 456 ############################################################################### |
| 457 |
| 458 echo |
| 459 echo "Initializing gettext:" |
| 460 AM_GNU_GETTEXT_VERSION([0.16.1]) |
| 461 AM_GNU_GETTEXT([external]) |
| 462 |
| 463 ############################################################################### |
| 464 # Checks for header files. |
| 465 ############################################################################### |
| 466 |
| 467 echo |
| 468 echo "System headers and functions:" |
| 469 |
| 470 # There is currently no workarounds in this package if some of |
| 471 # these headers are missing. |
| 472 AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h], |
| 473 [], |
| 474 [AC_MSG_ERROR([Required header file(s) are missing.])]) |
| 475 |
| 476 |
| 477 ############################################################################### |
| 478 # Checks for typedefs, structures, and compiler characteristics. |
| 479 ############################################################################### |
| 480 |
| 481 dnl We don't need these as long as we need a C99 compiler anyway. |
| 482 dnl AC_C_INLINE |
| 483 dnl AC_C_RESTRICT |
| 484 |
| 485 AC_HEADER_STDBOOL |
| 486 |
| 487 AC_TYPE_UINT8_T |
| 488 AC_TYPE_UINT16_T |
| 489 AC_TYPE_INT32_T |
| 490 AC_TYPE_UINT32_T |
| 491 AC_TYPE_INT64_T |
| 492 AC_TYPE_UINT64_T |
| 493 AC_TYPE_UINTPTR_T |
| 494 |
| 495 AC_CHECK_SIZEOF([size_t]) |
| 496 |
| 497 # The command line tool can copy high resolution timestamps if such |
| 498 # information is availabe in struct stat. Otherwise one second accuracy |
| 499 # is used. |
| 500 AC_CHECK_MEMBERS([ |
| 501 struct stat.st_atim.tv_nsec, |
| 502 struct stat.st_atimespec.tv_nsec, |
| 503 struct stat.st_atimensec, |
| 504 struct stat.st_uatime, |
| 505 struct stat.st_atim.st__tim.tv_nsec]) |
| 506 |
| 507 AC_SYS_LARGEFILE |
| 508 AC_C_BIGENDIAN |
| 509 |
| 510 |
| 511 ############################################################################### |
| 512 # Checks for library functions. |
| 513 ############################################################################### |
| 514 |
| 515 # Gnulib replacements as needed |
| 516 gl_GETOPT |
| 517 |
| 518 # Find the best function to set timestamps. |
| 519 AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break]) |
| 520 |
| 521 TUKLIB_PROGNAME |
| 522 TUKLIB_INTEGER |
| 523 TUKLIB_PHYSMEM |
| 524 TUKLIB_CPUCORES |
| 525 |
| 526 |
| 527 ############################################################################### |
| 528 # If using GCC, set some additional AM_CFLAGS: |
| 529 ############################################################################### |
| 530 |
| 531 if test "$GCC" = yes ; then |
| 532 echo |
| 533 echo "GCC extensions:" |
| 534 fi |
| 535 |
| 536 # Always do the visibility check but don't set AM_CFLAGS on Windows. |
| 537 # This way things get set properly even on Windows. |
| 538 gl_VISIBILITY |
| 539 if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then |
| 540 AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY" |
| 541 fi |
| 542 |
| 543 if test "$GCC" = yes ; then |
| 544 # Enable as much warnings as possible. These commented warnings won't |
| 545 # work for this package though: |
| 546 # * -Wunreachable-code breaks several assert(0) cases, which are |
| 547 # backed up with "return LZMA_PROG_ERROR". |
| 548 # * -Wcast-qual would break various things where we need a non-const |
| 549 # pointer although we don't modify anything through it. |
| 550 # * -Wcast-align breaks optimized CRC32 and CRC64 implementation |
| 551 # on some architectures (not on x86), where this warning is bogus, |
| 552 # because we take care of correct alignment. |
| 553 # * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations |
| 554 # don't seem so useful here; at least the last one gives some |
| 555 # warnings which are not bugs. |
| 556 for NEW_FLAG in \ |
| 557 -Wall \ |
| 558 -Wextra \ |
| 559 -Wformat=2 \ |
| 560 -Winit-self \ |
| 561 -Wmissing-include-dirs \ |
| 562 -Wstrict-aliasing \ |
| 563 -Wfloat-equal \ |
| 564 -Wundef \ |
| 565 -Wshadow \ |
| 566 -Wpointer-arith \ |
| 567 -Wbad-function-cast \ |
| 568 -Wwrite-strings \ |
| 569 -Wlogical-op \ |
| 570 -Waggregate-return \ |
| 571 -Wstrict-prototypes \ |
| 572 -Wold-style-definition \ |
| 573 -Wmissing-prototypes \ |
| 574 -Wmissing-declarations \ |
| 575 -Wmissing-noreturn \ |
| 576 -Wredundant-decls |
| 577 do |
| 578 AC_MSG_CHECKING([if $CC accepts $NEW_FLAG]) |
| 579 OLD_CFLAGS="$CFLAGS" |
| 580 CFLAGS="$CFLAGS $NEW_FLAG" |
| 581 AC_COMPILE_IFELSE([void foo(void) { }], [ |
| 582 AM_CFLAGS="$AM_CFLAGS $NEW_FLAG" |
| 583 AC_MSG_RESULT([yes]) |
| 584 ], [ |
| 585 AC_MSG_RESULT([no]) |
| 586 ]) |
| 587 CFLAGS="$OLD_CFLAGS" |
| 588 done |
| 589 |
| 590 AC_ARG_ENABLE([werror], |
| 591 AC_HELP_STRING([--enable-werror], [Enable -Werror to abort |
| 592 compilation on all compiler warnings.]), |
| 593 [], [enable_werror=no]) |
| 594 if test "x$enable_werror" = "xyes"; then |
| 595 AM_CFLAGS="$AM_CFLAGS -Werror" |
| 596 fi |
| 597 fi |
| 598 |
| 599 |
| 600 ############################################################################### |
| 601 # Create the makefiles and config.h |
| 602 ############################################################################### |
| 603 |
| 604 echo |
| 605 |
| 606 # Don't build the lib directory at all if we don't need any replacement |
| 607 # functions. |
| 608 AM_CONDITIONAL([COND_GNULIB], test -n "$LIBOBJS") |
| 609 |
| 610 # Add default AM_CFLAGS. |
| 611 AC_SUBST([AM_CFLAGS]) |
| 612 |
| 613 # Set additional flags for static/dynamic linking. The idea is that every |
| 614 # program (not library) being built will use either STATIC_{CPPFLAGS,LDFLAGS} |
| 615 # or DYNAMIC_{CPPFLAGS,LDFLAGS} depending on which type of linkage is |
| 616 # preferred. These preferences get overridden by use of --disable-static, |
| 617 # --disable-shared, or --enable-dynamic. |
| 618 # |
| 619 # This is quite messy, because we want to use LZMA_API_STATIC when linking |
| 620 # against static liblzma. It's needed on Windows. |
| 621 if test "x$enable_static" = xno; then |
| 622 enable_dynamic=yes |
| 623 fi |
| 624 if test "x$enable_shared" = xno; then |
| 625 enable_dynamic=no |
| 626 fi |
| 627 case $enable_dynamic in |
| 628 yes) |
| 629 STATIC_CPPFLAGS= |
| 630 STATIC_LDFLAGS= |
| 631 DYNAMIC_CPPFLAGS= |
| 632 DYNAMIC_LDFLAGS= |
| 633 ;; |
| 634 mixed) |
| 635 STATIC_CPPFLAGS="-DLZMA_API_STATIC" |
| 636 STATIC_LDFLAGS="-static" |
| 637 DYNAMIC_CPPFLAGS= |
| 638 DYNAMIC_LDFLAGS= |
| 639 ;; |
| 640 no) |
| 641 STATIC_CPPFLAGS="-DLZMA_API_STATIC" |
| 642 STATIC_LDFLAGS="-static" |
| 643 DYNAMIC_CPPFLAGS="-DLZMA_API_STATIC" |
| 644 DYNAMIC_LDFLAGS="-static" |
| 645 ;; |
| 646 esac |
| 647 AC_SUBST([STATIC_CPPFLAGS]) |
| 648 AC_SUBST([STATIC_LDFLAGS]) |
| 649 AC_SUBST([DYNAMIC_CPPFLAGS]) |
| 650 AC_SUBST([DYNAMIC_LDFLAGS]) |
| 651 |
| 652 # This is needed for src/scripts. |
| 653 xz=`echo xz | sed "$program_transform_name"` |
| 654 AC_SUBST([xz]) |
| 655 |
| 656 AC_CONFIG_FILES([ |
| 657 Doxyfile |
| 658 Makefile |
| 659 po/Makefile.in |
| 660 lib/Makefile |
| 661 src/Makefile |
| 662 src/liblzma/liblzma.pc |
| 663 src/liblzma/Makefile |
| 664 src/liblzma/api/Makefile |
| 665 src/xz/Makefile |
| 666 src/xzdec/Makefile |
| 667 src/lzmainfo/Makefile |
| 668 src/scripts/Makefile |
| 669 src/scripts/xzdiff |
| 670 src/scripts/xzgrep |
| 671 src/scripts/xzmore |
| 672 src/scripts/xzless |
| 673 tests/Makefile |
| 674 debug/Makefile |
| 675 ]) |
| 676 |
| 677 AC_OUTPUT |
| 678 |
| 679 # Some warnings |
| 680 if test x$tuklib_cv_physmem_method = xunknown; then |
| 681 echo |
| 682 echo "WARNING:" |
| 683 echo "No supported method to detect the amount of RAM." |
| 684 echo "Consider using --enable-assume-ram (if you didn't already)" |
| 685 echo "or make a patch to add support for this operating system." |
| 686 fi |
| 687 |
| 688 # Not threading yet so don't warn. |
| 689 #if test x$tuklib_cv_cpucores_method = xunknown; then |
| 690 # echo |
| 691 # echo "WARNING:" |
| 692 # echo "No supported method to detect the number of CPU cores." |
| 693 #fi |
OLD | NEW |