Teuchos_ConfigDefs.hpp

Go to the documentation of this file.
00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 //                    Teuchos: Common Tools Package
00006 //                 Copyright (2004) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //  
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00026 // 
00027 // ***********************************************************************
00028 // @HEADER
00029 */
00030 
00031 /*
00032   Kris
00033   07.08.03 -- Move into Teuchos package/namespace
00034 */
00035 
00036 #ifndef _TEUCHOS_CONFIGDEFS_HPP_
00037 #define _TEUCHOS_CONFIGDEFS_HPP_
00038 
00043 #ifdef HAVE_CONFIG_H
00044 
00045 /*
00046  * The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to
00047  * be undef'd here to avoid warnings when this file is included from another package.
00048  * KL 11/25/02
00049  */
00050 
00051 #ifdef PACKAGE
00052 #undef PACKAGE
00053 #endif
00054 
00055 #ifdef PACKAGE_NAME
00056 #undef PACKAGE_NAME
00057 #endif
00058 
00059 #ifdef PACKAGE_BUGREPORT
00060 #undef PACKAGE_BUGREPORT
00061 #endif
00062 
00063 #ifdef PACKAGE_STRING
00064 #undef PACKAGE_STRING
00065 #endif
00066 
00067 #ifdef PACKAGE_TARNAME
00068 #undef PACKAGE_TARNAME
00069 #endif
00070 
00071 #ifdef PACKAGE_VERSION
00072 #undef PACKAGE_VERSION
00073 #endif
00074 
00075 #ifdef VERSION
00076 #undef VERSION
00077 #endif
00078 
00079 #ifdef HAVE_NUMERIC_LIMITS
00080 #undef HAVE_NUMERIC_LIMITS
00081 #endif
00082 
00083 #include "Teuchos_config.h"
00084 
00085 #ifdef HAVE_TEUCHOS_DEBUG
00086 #  define TEUCHOS_DEBUG
00087 #endif
00088 
00089 #ifdef __cplusplus
00090 
00091 /******************************************************************************
00092  *   Choose header file flavor: either ANSI-style (no .h, e.g. <iostream>) or
00093  * old-style (with .h, e.g., <iostream.h>). 
00094  * KL 9/26/03
00095  *****************************************************************************/
00096 
00097 #if HAVE_CSTDIO
00098 #include <cstdio>
00099 #elif HAVE_STDIO_H
00100 #include <stdio.h>
00101 #else
00102 #error "Found neither cstdio nor stdio.h"
00103 #endif
00104 
00105 #if HAVE_CSTDARG
00106 #include <cstdarg>
00107 #elif HAVE_STDARG_H
00108 #include <stdarg.h>
00109 #else
00110 #error "Found neither cstdarg nor stdarg.h"
00111 #endif
00112 
00113 #if HAVE_CSTDLIB
00114 #include <cstdlib>
00115 #elif HAVE_STDLIB_H
00116 #include <stdlib.h>
00117 #else
00118 #error "Found neither cstdlib nor stdlib.h"
00119 #endif
00120 
00121 #if HAVE_STRING
00122 #include <string>
00123 #elif HAVE_STRING_H
00124 #include <string.h>
00125 #else
00126 #error "Found neither string nor string.h"
00127 #endif
00128 
00129 #if HAVE_IOSTREAM
00130 #include <iostream>
00131 #elif HAVE_IOSTREAM_H
00132 #include <iostream.h>
00133 #else
00134 #error "Found neither iostream nor iostream.h"
00135 #endif
00136 
00137 #if HAVE_IOSTREAM
00138 #include <fstream>
00139 #elif HAVE_IOSTREAM_H
00140 #include <fstream.h>
00141 #else
00142 #error "Found neither fstream nor fstream.h"
00143 #endif
00144 
00145 #if HAVE_STDEXCEPT
00146 #include <stdexcept>
00147 #elif HAVE_STDEXCEPT_H
00148 #include <stdexcept.h>
00149 #else
00150 #error "Found neither stdexcept nor stdexcept.h"
00151 #endif
00152 
00153 #ifdef HAVE_CASSERT
00154 #include <cassert>
00155 #else
00156 #include <assert.h>   
00157 #endif
00158 
00159 #ifdef HAVE_COMPLEX
00160 #include <complex>
00161 #elif defined(HAVE_COMPLEX_H)
00162 #include <complex.h>
00163 #endif
00164 
00165 #ifdef HAVE_VECTOR
00166 #include <vector>
00167 #include <deque> // RAB: 2003/11/10: If you have <vector> you should have <deque>
00168 #elif defined(HAVE_VECTOR_H)
00169 #include <vector.h>
00170 #endif
00171 
00172 #ifdef HAVE_ALGORITHM
00173 #include <algorithm>
00174 #elif defined(HAVE_ALGO_H)
00175 #include <algo.h>
00176 #elif defined(HAVE_ALGORITHM_H)
00177 #include <algorithm.h>
00178 #endif
00179 
00180 #ifdef HAVE_MAP
00181 #include <map>
00182 #elif defined(HAVE_MAP_H)
00183 #include <map.h>
00184 #endif
00185 
00186 #ifdef HAVE_LIST
00187 #include <list>
00188 #elif defined(HAVE_LIST_H)
00189 #include <list.h>
00190 #endif
00191 
00192 #ifdef HAVE_SET
00193 #include <set>
00194 #elif defined(HAVE_SET_H)
00195 #include <set.h>
00196 #endif
00197 
00198 #ifdef HAVE_STRING
00199 #include <string>
00200 #elif defined(HAVE_STRING_H) 
00201 #include <string.h>
00202 #elif defined(HAVE_STRINGS_H)
00203 #include <strings.h>
00204 #endif
00205 
00206 #ifdef HAVE_TYPEINFO
00207 #include <typeinfo>
00208 #endif
00209 
00210 #ifdef HAVE_NUMERIC_LIMITS
00211 #include <limits>
00212 #endif
00213 
00214 /******************************************************************************
00215  * Choose string stream type: preferably std::ostringstream, otherwise
00216  * ostringstream or (gasp!) ostrstream. 
00217  *
00218  * Ross is going to write ANSI-compatible stringstreams to replace ostrstream
00219  * on our non-compliant platforms.
00220  *
00221  * KL 09/26/03
00222  ******************************************************************************/
00223 
00224 #if HAVE_SSTREAM
00225 #include <sstream>
00226 typedef std::ostringstream TeuchosOStringStream;
00227 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str().c_str()
00228 #elif HAVE_SSTREAM_H
00229 #include <sstream.h>
00230 typedef ostringstream TeuchosOStringStream;
00231 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str().c_str()
00232 #elif HAVE_STRSTREAM
00233 #include <strstream>
00234 typedef std::ostrstream TeuchosOStringStream;
00235 /* STLPort is not configured on Janus to inject strstream into "std" namespace */ 
00236 #if JANUS_STLPORT
00237  namespace std { class ostrstream; }
00238 #endif
00239 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str()
00240 #elif HAVE_STRSTREAM_H
00241 #include <strstream.h>
00242 typedef ostrstream TeuchosOStringStream;
00243 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str()
00244 #else
00245 #error "Found neither sstream, sstream.h, strstream.h, nor strstream"
00246 #endif
00247 
00248 #if defined(TFLOP)
00249 #ifdef HAVE_STRING
00250 using std::string;
00251 #endif
00252 #ifdef HAVE_IOSTREAM
00253 using std::istream;
00254 using std::ostream;
00255 using std::cerr;
00256 using std::cout;
00257 using std::endl;
00258 #endif
00259 #ifdef HAVE_COMPLEX
00260 using std::complex;
00261 #endif
00262 #else /* NOT TFLOP */ 
00263 #ifndef JANUS_STLPORT
00264 #if HAVE_CMATH
00265 #include <cmath>
00266 #elif HAVE_MATH_H
00267 #include <math.h>
00268 #else
00269 #error "Found neither cmath nor math.h"
00270 #endif
00271 #else /* JANUS_STLPORT */
00272 #include <math.h>
00273 #endif /* JANUS_STLPORT */
00274 using namespace std;
00275 #endif /* defined(TFLOP) */
00276 
00277 // RAB: 20031002: Added this for all platforms in addition to TFLOPS?
00278 #ifdef HAVE_IOMANIP
00279 #include <iomanip>
00280 #else
00281 #include <iomanip.h>  
00282 #endif
00283 
00284 #else /* __cplusplus not defined */
00285 
00286 #include <assert.h>   
00287 #include <limits.h>
00288 #ifdef HAVE_MALLOC_H
00289 #include <malloc.h>
00290 #endif
00291 #include <math.h>
00292 #include <stdarg.h>
00293 #include <stdio.h>
00294 #include <stdlib.h>
00295 #include <string.h>
00296 #include <time.h>
00297 
00298 #endif /* __cplusplus */
00299 
00300 #else /* fallback for the amazingly unlikely event we have no HAVE_CONFIG_H! */
00301 
00302 #include <iostream>
00303 #include <iomanip>
00304 #include <fstream>
00305 #include <string>
00306 #include <vector>
00307 #include <map>
00308 #include <algorithm>
00309 #include <sstream>
00310 #include <stdexcept>
00311 #include <typeinfo>
00312 
00313 #include <sstream>
00314 typedef std::ostringstream TeuchosOStringStream;
00315 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str().c_str()
00316 
00317 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
00318 
00319 #include <stdlib.h>
00320 #include <stdio.h>
00321 #include <assert.h>
00322 #include <math.h>
00323 using namespace std;
00324 
00325 #elif defined(TFLOP)
00326 
00327 #include <stdlib.h>
00328 #include <stdio.h>
00329 #include <assert.h>
00330 using std::string;
00331 #include <iomanip>
00332 using std::istream;
00333 using std::ostream;
00334 using std::cerr;
00335 using std::cout;
00336 using std::endl;
00337 #include <list>
00338 
00339 #else
00340 
00341 #include <cstdlib>
00342 #include <cstdio>
00343 #include <cassert>
00344 #include <cmath>
00345 using namespace std;
00346 
00347 #endif
00348 
00349 #endif /* end HAVE_CONFIG_H */
00350 
00351 /* Define bool in case we are running on an ancient, quirky, or merely
00352  * stupid compiler having no built-in bool.  WARNING: THIS IS EXTREMELY
00353  * DANGEROUS, BECAUSE OTHER CODES TO WHICH WE LINK MAY HACK THEIR BOOL
00354  * DEFINITIONS IN DIFFERENT WAYS, E.G. VIA A TYPEDEF. If that happens, 
00355  * a whole bunch of link errors will result. Avoid this hack if at all 
00356  * possible.
00357  */ 
00358 
00359 #ifdef TEUCHOS_SIMULATE_BOOL
00360 
00361 #ifdef bool
00362 #undef bool
00363 #endif
00364 #ifdef true
00365 #undef true
00366 #endif
00367 #ifdef false
00368 #undef false
00369 #endif
00370 
00371 #define bool int
00372 #define true 1
00373 #define false 0
00374 
00375 #endif
00376 
00377 #ifdef __cplusplus
00378 
00379 const double Teuchos_MinDouble = 1.0E-100;
00380 const double Teuchos_MaxDouble = 1.0E+100;
00381 const double Teuchos_Overflow = 1.79E308; // Used to test if equilibration should be done.
00382 const double Teuchos_Underflow = 2.23E-308;
00383 
00384 #endif /* __cplusplus */
00385 
00386 /* Delete any previous definition of TEUCHOS_NO_ERROR_REPORTS */
00387 
00388 #ifdef TEUCHOS_CHK_ERR
00389 #undef TEUCHOS_CHK_ERR
00390 #endif
00391 #ifdef TEUCHOS_CHK_PTR
00392 #undef TEUCHOS_CHK_PTR
00393 #endif
00394 #ifdef TEUCHOS_CHK_REF
00395 #undef TEUCHOS_CHK_REF
00396 #endif
00397 
00398 /* The integral type that is used for the largest vector space */
00399 typedef int Teuchos_Index; /* ToDo: Determine this in configure for the machine */
00400 
00401 /* Make error report silent by defining TEUCHOS_NO_ERROR_REPORTS */
00402 
00403 #define TEUCHOS_CHK_ERR(a) { if (a != 0)  return(a);}
00404 #define TEUCHOS_CHK_PTR(a) { return(a);}
00405 #define TEUCHOS_CHK_REF(a) { return(a);}
00406 #ifdef __cplusplus
00407 const int Teuchos_DefaultTracebackMode = 1; /* Default value for traceback behavior */
00408 #endif
00409 
00410 /* Define some macros */
00411 #define TEUCHOS_MAX(x,y) (( (x) > (y) ) ? (x)  : (y) )     /* max function  */
00412 #define TEUCHOS_MIN(x,y) (( (x) < (y) ) ? (x)  : (y) )     /* min function  */
00413 #define TEUCHOS_SGN(x)   (( (x) < 0.0 ) ? -1.0 : 1.0 )     /* sign function */
00414 
00415 #endif /* _TEUCHOS_CONFIGDEFS_HPP_ */

Generated on Thu Sep 18 12:30:29 2008 for Teuchos - Trilinos Tools Package by doxygen 1.3.9.1