/* Forced include file for building GMP.  This file is inserted at
   the beginning of all GMP files that are built, using the /FI
   compiler option.

   This file is used to create some #defines that are mostly used
   in gmp.h.

*/


/* Copyright 2010 Wolfram Research, Inc.

This file is part of the build scripts for building the GNU MP Library
for Mathematica on Windows (32-bit).

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your
option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.  If not, see http://www.gnu.org/licenses/.  */


/* Turn off the "unary minus operator applied to unsigned type" warning,
   which flags a bitwise technique that's occurs a lot in gmp.h. */
#pragma warning(disable: 4146)

/* Make most of the functions declared in gmp.h both static and inline.
   This only applies when inlining is possible (no /Ob0 option).  /Ob0
   occurs by default in DEBUG builds and is off in RELEASE builds.

   The WRICC compiler wrapper that we use to build GMP will define the
   _WRICC_INLINING macro if inlining is possible (no /Ob0). */

/* 
    Uncomment to build versions of GMP < 4.3
    After 4.3 we have a different way of handling this, by modifying gmp-h.in
 */
/*
#if defined(_WRICC_INLINING)
#define __GMP_EXTERN_INLINE	static __forceinline
#endif
*/

/* GMP uses popen() where MSVC wants _popen(). */
#define popen	_popen

/* Since stdlib.h has prototypes that use the __declspec(restrict) syntax,
   which is damaged by config.h's use of "#define restrict __restrict",
   include the troublesome file first, before anything else can interfere. */
#include <stdlib.h>


/* Configure for GMP 5 has a screwy, wrongheaded approach to detecting which
   functions the compiler has.  It writes the results of its work into
   config.h, with macros indicating which functions are present.  Here we
   define the ones which exist even though it doesn't realize that fact. */

/* Comment all this mess out when building GMP versions before 5.0.0. */

#ifdef HAVE_MEMSET
#undef HAVE_MEMSET
#endif
#define HAVE_MEMSET 1

#ifdef HAVE_POPEN
#undef HAVE_POPEN
#endif
#define HAVE_POPEN 1

#ifdef HAVE_STRTOL
#undef HAVE_STRTOL
#endif
#define HAVE_STRTOL 1

#ifdef HAVE_STRTOUL
#undef HAVE_STRTOUL
#endif
#define HAVE_STRTOUL 1

