// ================================================================ //
//                                                                  //
//   File      : gccver.h                                           //
//   Purpose   : central place for gcc-version-dependent defs       //
//                                                                  //
//   Coded by Ralf Westram (coder@reallysoft.de) in December 2012   //
//   Institute of Microbiology (Technical University Munich)        //
//   http://www.arb-home.de/                                        //
//                                                                  //
// ================================================================ //

#ifndef GCCVER_H
#define GCCVER_H

#ifndef __GNUC__
# error You have to use the gnu compiler!
#endif

#define GCC_VERSION_CODE    ((__GNUC__ * 100) + __GNUC_MINOR__)
#define GCC_PATCHLEVEL_CODE ((GCC_VERSION_CODE * 100) + __GNUC_PATCHLEVEL__)

#ifdef __clang__
# define CLANG_VERSION_CODE    ((__clang_major__ * 100 ) + __clang_minor__)
# define CLANG_PATCHLEVEL_CODE ((CLANG_VERSION_CODE * 100) + __clang_patchlevel__)
#else
# define CLANG_VERSION_CODE    0
# define CLANG_PATCHLEVEL_CODE 0
#endif

// Please note that comparing the clang version codes does only work using
//     #if (CLANG_VERSION_CODE > num)
// because they are defined as zero for gcc builds.

// check required gcc/clang version:

#if (!((GCC_PATCHLEVEL_CODE >= 60100) || (CLANG_PATCHLEVEL_CODE >= 60000)))
# error Wrong compiler version (need at least gcc 6.1.0 or clang 6.0.0)
#endif

#else
#error gccver.h included twice
#endif // GCCVER_H
