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 #include "Teuchos_config.h"
00080 
00081 #ifdef __cplusplus
00082 
00083 /******************************************************************************
00084  *   Choose header file flavor: either ANSI-style (no .h, e.g. <iostream>) or
00085  * old-style (with .h, e.g., <iostream.h>). 
00086  * KL 9/26/03
00087  *****************************************************************************/
00088 
00089 #if HAVE_CSTDIO
00090 #include <cstdio>
00091 #elif HAVE_STDIO_H
00092 #include <stdio.h>
00093 #else
00094 #error "Found neither cstdio nor stdio.h"
00095 #endif
00096 
00097 #if HAVE_CSTDARG
00098 #include <cstdarg>
00099 #elif HAVE_STDARG_H
00100 #include <stdarg.h>
00101 #else
00102 #error "Found neither cstdarg nor stdarg.h"
00103 #endif
00104 
00105 #if HAVE_CSTDLIB
00106 #include <cstdlib>
00107 #elif HAVE_STDLIB_H
00108 #include <stdlib.h>
00109 #else
00110 #error "Found neither cstdlib nor stdlib.h"
00111 #endif
00112 
00113 #if HAVE_STRING
00114 #include <string>
00115 #elif HAVE_STRING_H
00116 #include <string.h>
00117 #else
00118 #error "Found neither string nor string.h"
00119 #endif
00120 
00121 #if HAVE_IOSTREAM
00122 #include <iostream>
00123 #elif HAVE_IOSTREAM_H
00124 #include <iostream.h>
00125 #else
00126 #error "Found neither iostream nor iostream.h"
00127 #endif
00128 
00129 #if HAVE_IOSTREAM
00130 #include <fstream>
00131 #elif HAVE_IOSTREAM_H
00132 #include <fstream.h>
00133 #else
00134 #error "Found neither fstream nor fstream.h"
00135 #endif
00136 
00137 #if HAVE_STDEXCEPT
00138 #include <stdexcept>
00139 #elif HAVE_STDEXCEPT_H
00140 #include <stdexcept.h>
00141 #else
00142 #error "Found neither stdexcept nor stdexcept.h"
00143 #endif
00144 
00145 #ifdef HAVE_CASSERT
00146 #include <cassert>
00147 #else
00148 #include <assert.h>   
00149 #endif
00150 
00151 #ifdef HAVE_COMPLEX
00152 #include <complex>
00153 #elif defined(HAVE_COMPLEX_H)
00154 #include <complex.h>
00155 #endif
00156 
00157 #ifdef HAVE_VECTOR
00158 #include <vector>
00159 #include <deque> // RAB: 2003/11/10: If you have <vector> you should have <deque>
00160 #elif defined(HAVE_VECTOR_H)
00161 #include <vector.h>
00162 #endif
00163 
00164 #ifdef HAVE_ALGORITHM
00165 #include <algorithm>
00166 #elif defined(HAVE_ALGORITHM_H)
00167 #include <algorithm.h>
00168 #endif
00169 
00170 #ifdef HAVE_MAP
00171 #include <map>
00172 #elif defined(HAVE_MAP_H)
00173 #include <map.h>
00174 #endif
00175 
00176 #ifdef HAVE_LIST
00177 #include <list>
00178 #elif defined(HAVE_LIST_H)
00179 #include <list.h>
00180 #endif
00181 
00182 #ifdef HAVE_STRING
00183 #include <string>
00184 #elif defined(HAVE_STRING_H) 
00185 #include <string.h>
00186 #elif defined(HAVE_STRINGS_H)
00187 #include <strings.h>
00188 #endif
00189 
00190 #ifdef HAVE_TYPEINFO
00191 #include <typeinfo>
00192 #endif
00193 
00194 /******************************************************************************
00195  * Choose string stream type: preferably std::ostringstream, otherwise
00196  * ostringstream or (gasp!) ostrstream. 
00197  *
00198  * Ross is going to write ANSI-compatible stringstreams to replace ostrstream
00199  * on our non-compliant platforms.
00200  *
00201  * KL 09/26/03
00202  ******************************************************************************/
00203 
00204 #if HAVE_SSTREAM
00205 #include <sstream>
00206 typedef std::ostringstream TeuchosOStringStream;
00207 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str().c_str()
00208 #elif HAVE_SSTREAM_H
00209 #include <sstream.h>
00210 typedef ostringstream TeuchosOStringStream;
00211 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str().c_str()
00212 #elif HAVE_STRSTREAM
00213 #include <strstream>
00214 typedef std::ostrstream TeuchosOStringStream;
00215 /* STLPort is not configured on Janus to inject strstream into "std" namespace */ 
00216 #if JANUS_STLPORT
00217  namespace std { class ostrstream; }
00218 #endif
00219 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str()
00220 #elif HAVE_STRSTREAM_H
00221 #include <strstream.h>
00222 typedef ostrstream TeuchosOStringStream;
00223 #define TEUCHOS_OSTRINGSTREAM_GET_C_STR(OSS) (OSS).str()
00224 #else
00225 #error "Found neither sstream, sstream.h, strstream.h, nor strstream"
00226 #endif
00227 
00228 #if defined(TFLOP)
00229 #ifdef HAVE_STRING
00230 using std::string;
00231 #endif
00232 #ifdef HAVE_IOSTREAM
00233 using std::istream;
00234 using std::ostream;
00235 using std::cerr;
00236 using std::cout;
00237 using std::endl;
00238 #endif
00239 #ifdef HAVE_COMPLEX
00240 using std::complex;
00241 #endif
00242 #else /* NOT TFLOP */ 
00243 #ifndef JANUS_STLPORT
00244 #if HAVE_CMATH
00245 #include <cmath>
00246 #elif HAVE_MATH_H
00247 #include <math.h>
00248 #else
00249 #error "Found neither cmath nor math.h"
00250 #endif
00251 #else /* JANUS_STLPORT */
00252 #include <math.h>
00253 #endif /* JANUS_STLPORT */
00254 using namespace std;
00255 #endif /* defined(TFLOP) */
00256 
00257 // RAB: 20031002: Added this for all platforms in addition to TFLOPS?
00258 #ifdef HAVE_IOMANIP
00259 #include <iomanip>
00260 #else
00261 #include <iomanip.h>  
00262 #endif
00263 
00264 #else /* __cplusplus not defined */
00265 
00266 #include <assert.h>   
00267 #include <limits.h>
00268 #ifdef HAVE_MALLOC_H
00269 #include <malloc.h>
00270 #endif
00271 #include <math.h>
00272 #include <stdarg.h>
00273 #include <stdio.h>
00274 #include <stdlib.h>
00275 #include <string.h>
00276 #include <time.h>
00277 
00278 #endif /* __cplusplus */
00279 
00280 #else /* fallback for the amazingly unlikely event we have no HAVE_CONFIG_H! */
00281 
00282 #include <iostream>
00283 #include <fstream>
00284 #include <string>
00285 #include <vector>
00286 #include <map>
00287 #include <algorithm>
00288 #include <sstream>
00289 #include <stdexcept>
00290 #include <typeinfo>
00291 
00292 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
00293 
00294 #include <stdlib.h>
00295 #include <stdio.h>
00296 #include <assert.h>
00297 #include <math.h>
00298 using namespace std;
00299 
00300 #elif defined(TFLOP)
00301 
00302 #include <stdlib.h>
00303 #include <stdio.h>
00304 #include <assert.h>
00305 using std::string;
00306 #include <iomanip>
00307 using std::istream;
00308 using std::ostream;
00309 using std::cerr;
00310 using std::cout;
00311 using std::endl;
00312 #include <list>
00313 
00314 #else
00315 
00316 #include <cstdlib>
00317 #include <cstdio>
00318 #include <cassert>
00319 #include <cmath>
00320 using namespace std;
00321 
00322 #endif
00323 
00324 #endif /* end HAVE_CONFIG_H */
00325 
00326 /* Define bool in case we are running on an ancient, quirky, or merely
00327  * stupid compiler having no built-in bool.  WARNING: THIS IS EXTREMELY
00328  * DANGEROUS, BECAUSE OTHER CODES TO WHICH WE LINK MAY HACK THEIR BOOL
00329  * DEFINITIONS IN DIFFERENT WAYS, E.G. VIA A TYPEDEF. If that happens, 
00330  * a whole bunch of link errors will result. Avoid this hack if at all 
00331  * possible.
00332  */ 
00333 
00334 #ifdef TEUCHOS_SIMULATE_BOOL
00335 
00336 #ifdef bool
00337 #undef bool
00338 #endif
00339 #ifdef true
00340 #undef true
00341 #endif
00342 #ifdef false
00343 #undef false
00344 #endif
00345 
00346 #define bool int
00347 #define true 1
00348 #define false 0
00349 
00350 #endif
00351 
00352 #ifdef __cplusplus
00353 
00354 const double Teuchos_MinDouble = 1.0E-100;
00355 const double Teuchos_MaxDouble = 1.0E+100;
00356 const double Teuchos_Overflow = 1.79E308; // Used to test if equilibration should be done.
00357 const double Teuchos_Underflow = 2.23E-308;
00358 
00359 #endif /* __cplusplus */
00360 
00361 /* Delete any previous definition of TEUCHOS_NO_ERROR_REPORTS */
00362 
00363 #ifdef TEUCHOS_CHK_ERR
00364 #undef TEUCHOS_CHK_ERR
00365 #endif
00366 #ifdef TEUCHOS_CHK_PTR
00367 #undef TEUCHOS_CHK_PTR
00368 #endif
00369 #ifdef TEUCHOS_CHK_REF
00370 #undef TEUCHOS_CHK_REF
00371 #endif
00372 
00373 /* Make error report silent by defining TEUCHOS_NO_ERROR_REPORTS */
00374 
00375 #define TEUCHOS_CHK_ERR(a) { if (a != 0)  return(a);}
00376 #define TEUCHOS_CHK_PTR(a) { return(a);}
00377 #define TEUCHOS_CHK_REF(a) { return(a);}
00378 #ifdef __cplusplus
00379 const int Teuchos_DefaultTracebackMode = 1; /* Default value for traceback behavior */
00380 #endif
00381 
00382 /* Define some macros */
00383 #define TEUCHOS_MAX(x,y) (( (x) > (y) ) ? (x)  : (y) )     /* max function  */
00384 #define TEUCHOS_MIN(x,y) (( (x) < (y) ) ? (x)  : (y) )     /* min function  */
00385 #define TEUCHOS_SGN(x)   (( (x) < 0.0 ) ? -1.0 : 1.0 )     /* sign function */
00386 
00387 #endif /* _TEUCHOS_CONFIGDEFS_HPP_ */

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