# ----------------------------- Other options ---------------------------------
-AC_MSG_CHECKING([whether to include error messages])
-AC_ARG_ENABLE([error_messages],
- AS_HELP_STRING([--disable-error-messages], [do not compile in error messages]),
- [ENABLE_ERROR_MESSAGES=$enableval],
- [ENABLE_ERROR_MESSAGES=yes])
-AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
-if test "$ENABLE_ERROR_MESSAGES" = "yes"; then
- AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages])
-fi
-
-AC_MSG_CHECKING([whether to include assertions])
-AC_ARG_ENABLE([assertions],
- AS_HELP_STRING([--disable-assertions], [do not include assertions]),
- [ENABLE_ASSERTIONS=$enableval],
- [ENABLE_ASSERTIONS=yes])
-AC_MSG_RESULT([$ENABLE_ASSERTIONS])
-if test "$ENABLE_ASSERTIONS" = "yes"; then
- AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions])
-fi
-
-AC_MSG_CHECKING([whether to include support for multi-threaded compression])
-AC_ARG_ENABLE([multithreaded-compression],
- AS_HELP_STRING([--disable-multithreaded-compression],
- [disable support for multithreaded compression]),
- [ENABLE_MULTITHREADED_COMPRESSION=$enableval],
- [ENABLE_MULTITHREADED_COMPRESSION=yes])
-AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION])
-if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then
- AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1],
- [Define to 1 to support multithreaded compression])
-fi
-
AC_ARG_WITH(pkgconfigdir,
[ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
[pkgconfigdir=$withval],
* This also enables error messages, as if by a call to
* wimlib_set_print_errors(true).
*
- * @return 0 on success; a ::wimlib_error_code value on failure.
- *
- * @retval ::WIMLIB_ERR_UNSUPPORTED
- * wimlib was compiled using the <c>--without-error-messages</c> option.
+ * @return 0
*/
extern int
wimlib_set_error_file(FILE *fp);
*
* @retval ::WIMLIB_ERR_OPEN
* The file named by @p path could not be opened for appending.
- * @retval ::WIMLIB_ERR_UNSUPPORTED
- * wimlib was compiled using the <c>--without-error-messages</c> option.
*/
extern int
wimlib_set_error_file_by_name(const wimlib_tchar *path);
* @c true if messages are to be printed; @c false if messages are not to
* be printed.
*
- * @return 0 on success; a ::wimlib_error_code value on failure.
- *
- * @retval ::WIMLIB_ERR_UNSUPPORTED
- * wimlib was compiled using the <c>--without-error-messages</c> option.
+ * @return 0
*/
extern int
wimlib_set_print_errors(bool show_messages);
#ifndef _WIMLIB_ASSERT_H
#define _WIMLIB_ASSERT_H
-#ifdef ENABLE_ASSERTIONS
#include <assert.h>
-# define wimlib_assert(expr) assert(expr)
-#else
-# define wimlib_assert(expr)
-#endif
+#define wimlib_assert(expr) assert(expr)
#endif /* _WIMLIB_ASSERT_H */
/* Functions that return implementations of the chunk_compressor interface. */
-#ifdef ENABLE_MULTITHREADED_COMPRESSION
int
new_parallel_chunk_compressor(int out_ctype, u32 out_chunk_size,
unsigned num_threads, u64 max_memory,
struct chunk_compressor **compressor_ret);
-#endif
int
new_serial_chunk_compressor(int out_ctype, u32 out_chunk_size,
return 0;
}
-#ifdef ENABLE_ERROR_MESSAGES
extern void
wimlib_error(const tchar *format, ...)
_format_attribute(printf, 1, 2) _cold_attribute;
# define WARNING_WITH_ERRNO(format, ...) wimlib_warning_with_errno(T(format), ## __VA_ARGS__)
extern bool wimlib_print_errors;
extern FILE *wimlib_error_file;
-#else /* ENABLE_ERROR_MESSAGES */
-# define wimlib_print_errors 0
-# define wimlib_error_file NULL
-# define ERROR(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__)
-# define ERROR_WITH_ERRNO(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__)
-# define WARNING(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__)
-# define WARNING_WITH_ERRNO(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__)
-#endif /* !ENABLE_ERROR_MESSAGES */
extern void
print_byte_field(const u8 *field, size_t len, FILE *out);
# include "config.h"
#endif
-#ifdef ENABLE_MULTITHREADED_COMPRESSION
-
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>
parallel_chunk_compressor_destroy(&ctx->base);
return ret;
}
-
-#endif /* ENABLE_MULTITHREADED_COMPRESSION */
#include "wimlib/util.h"
#include "wimlib/win32.h"
-#ifdef ENABLE_ERROR_MESSAGES
bool wimlib_print_errors = false;
FILE *wimlib_error_file = NULL; /* Set in wimlib_global_init() */
static bool wimlib_owns_error_file = false;
wimlib_vmsg(T("\r[WARNING] "), format, va, true);
va_end(va);
}
-#endif /* ENABLE_ERROR_MESSAGES */
void
print_byte_field(const u8 *field, size_t len, FILE *out)
WIMLIBAPI int
wimlib_set_print_errors(bool show_error_messages)
{
-#ifdef ENABLE_ERROR_MESSAGES
wimlib_print_errors = show_error_messages;
-#else
- if (show_error_messages)
- return WIMLIB_ERR_UNSUPPORTED;
-#endif
return 0;
}
WIMLIBAPI int
wimlib_set_error_file(FILE *fp)
{
-#ifdef ENABLE_ERROR_MESSAGES
if (wimlib_owns_error_file)
fclose(wimlib_error_file);
wimlib_error_file = fp;
wimlib_print_errors = (fp != NULL);
wimlib_owns_error_file = false;
return 0;
-#else
- return WIMLIB_ERR_UNSUPPORTED;
-#endif
}
WIMLIBAPI int
wimlib_set_error_file_by_name(const tchar *path)
{
-#ifdef ENABLE_ERROR_MESSAGES
FILE *fp;
#ifdef __WIN32__
wimlib_set_error_file(fp);
wimlib_owns_error_file = true;
return 0;
-#else
- return WIMLIB_ERR_UNSUPPORTED;
-#endif
}
static const tchar * const error_strings[] = {
blob_file_path(blob), expected_hashstr, actual_hashstr);
return WIMLIB_ERR_CONCURRENT_MODIFICATION_DETECTED;
} else if (blob->blob_location == BLOB_IN_WIM) {
- #ifdef ENABLE_ERROR_MESSAGES
const struct wim_resource_descriptor *rdesc = blob->rdesc;
(recover_data ? wimlib_warning : wimlib_error)(
rdesc->compression_type),
rdesc->chunk_size,
expected_hashstr, actual_hashstr);
- #endif /* ENABLE_ERROR_MESSAGES */
if (recover_data)
return 0;
return WIMLIB_ERR_INVALID_RESOURCE_HASH;
if (lib_initialized)
goto out_unlock;
-#ifdef ENABLE_ERROR_MESSAGES
if (!wimlib_error_file)
wimlib_error_file = stderr;
-#endif
ret = WIMLIB_ERR_INVALID_PARAM;
if (init_flags & ~(WIMLIB_INIT_FLAG_ASSUME_UTF8 |
* specified number of threads, unless the upper bound on the number
* bytes needing to be compressed is less than a heuristic value. */
if (num_nonraw_bytes != 0 && out_ctype != WIMLIB_COMPRESSION_TYPE_NONE) {
- #ifdef ENABLE_MULTITHREADED_COMPRESSION
if (num_nonraw_bytes > max(2000000, out_chunk_size)) {
ret = new_parallel_chunk_compressor(out_ctype,
out_chunk_size,
wimlib_get_error_string(ret));
}
}
- #endif
if (ctx.compressor == NULL) {
ret = new_serial_chunk_compressor(out_ctype, out_chunk_size,