// CMake uses config.cmake.h to generate config.h within the build folder.
#pragma once

#include <stddef.h>

// clang-format off
// it butchers @@ and ${} :(

#define PACKAGE_NAME "darktable"
#define PACKAGE_BUGREPORT "https://github.com/darktable-org/darktable/issues/new/choose"
#define PACKAGE_DOCS "https://www.darktable.org/resources/"

// these will be defined in build/bin/version_gen.c
extern const char darktable_package_version[];
extern const char darktable_package_string[];
extern const char darktable_last_commit_year[];

static const char *dt_supported_extensions[] __attribute__((unused)) = {"3fr", "ari", "arw", "bay", "bmq", "cap", "cine", "cr2", "crw", "cs1", "dc2", "dcr", "dng", "erf", "fff", "gpr", "hdr", "ia", "iiq", "jfif", "jpeg", "jpg", "k25", "kc2", "kdc", "mdc", "mef", "mos", "mrw", "nef", "nrw", "orf", "ori", "pbm", "pef", "pfm", "pgm", "png", "pnm", "ppm", "pxn", "qoi", "qtk", "raf", "raw", "rdc", "rw2", "rwl", "sr2", "srf", "srw", "sti", "tif", "tiff", "x3f", "exr", "jxl", "webp", "avif", "heif", "heic", "hif", "hej2", "avci", "cr3", "j2c", "j2k", "jp2", "jpc", "jpf", "jpx", "bmp", "cin", "dcm", "dpx", "fit", "fits", "fts", "gif", "jng", "miff", "mng", "pam", NULL};

#define GETTEXT_PACKAGE "darktable"

#define DARKTABLE_LOCALEDIR "../share/locale"
#define DARKTABLE_LIBDIR    "../lib/darktable"
#define DARKTABLE_DATADIR   "../share/darktable"
#define DARKTABLE_SHAREDIR  "../share"

#define SHARED_MODULE_PREFIX "lib"
#define SHARED_MODULE_SUFFIX ".so"

#define WANTED_STACK_SIZE (2097152)
#define WANTED_THREADS_STACK_SIZE (2097152)

#define ISO_CODES_LOCATION "/usr/share/iso-codes/json"
#define ISO_CODES_LOCALEDIR "/usr/share/locale"

// clang-format on

#ifndef __GNUC_PREREQ
// on OSX, gcc-4.6 and clang chokes if this is not here.
#if defined __GNUC__ && defined __GNUC_MINOR__
#define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
#else
#define __GNUC_PREREQ(maj, min) 0
#endif
#endif

#if defined(_OPENMP) && __GNUC_PREREQ(4, 9)
#define OPENMP_SIMD_
#define SIMD() simd
#else
#define SIMD()
#endif

// see http://clang.llvm.org/docs/LanguageExtensions.html
#ifndef __has_feature      // Optional of course.
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif
#ifndef __has_extension
#define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
#endif

// see https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
#include <sanitizer/asan_interface.h>
#else
#define ASAN_POISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
#define ASAN_UNPOISON_MEMORY_REGION(addr, size) ((void)(addr), (void)(size))
#endif

#define HAVE_CPUID_H 1
#define HAVE___GET_CPUID 1

#define HAVE_OMP_FIRSTPRIVATE_WITH_CONST 1

#define HAVE_THREAD_RWLOCK_ARCH_T_READERS 1

/* #undef HAVE_THREAD_RWLOCK_ARCH_T_NR_READERS */

/******************************************************************************
 * OpenCL target settings
 * OpenCL 1.2 is the version supported by Apple, otherwise we use 3.0
 *****************************************************************************/
#ifdef HAVE_APPLE_KEYCHAIN
 #define CL_TARGET_OPENCL_VERSION 120
#else
 #define CL_TARGET_OPENCL_VERSION 300
#endif
// clang-format off
// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
// vim: shiftwidth=2 expandtab tabstop=2 cindent
// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
// clang-format on
