Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

machdep.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002    Major portions of this software are copyrighted by the Medical College
00003    of Wisconsin, 1994-2000, and are released under the Gnu General Public
00004    License, Version 2.  See the file README.Copyright for details.
00005 ******************************************************************************/
00006 #ifndef _MCW_MACHDEP_
00007 #define _MCW_MACHDEP_
00008 
00009 #ifdef SPARKY
00010 #undef _POSIX_SOURCE
00011 #endif
00012 
00013 #include <sys/types.h>
00014 #include <sys/stat.h>
00015 #include <sys/mman.h>
00016 #include <fcntl.h>
00017 
00018 extern void machdep() ;
00019 
00020 /*----------------------------------------------------------------------------
00021   Flags that can be used to work around bugs on some systems
00022   (you could also use the -Dname command line switch in the Makefile
00023    definition of the CC commands to enable these options):
00024 
00025     USE_TRACING = if #define-d, then AFNI and its programs will compile
00026                    in a set of data/functions that allows debug tracing
00027                    of execution.
00028 
00029     DONT_USE_MCW_MALLOC = if this is set, then the malloc wrappers
00030                           defined in mcw_malloc.[ch] will not be
00031                           be used.  (These functions provide some
00032                           ability to track and debug the use of
00033                           malloc-ed memory space.)
00034 
00035     DONT_USE_METER  = if #define-d, won't show progress meter during
00036                        brick write operations (and other similar places)
00037 
00038     FIX_SCALE_VALUE_PROBLEM = if #defined-d, will work around a bug
00039                                in Solaris Motif where the threshold scale
00040                                value is not displayed
00041                                [Doesn't seem to be needed anymore]
00042 
00043     FIX_SCALE_SIZE_PROBLEM = if #define-d, will work around a bug in
00044                               some versions of Motif where the
00045                               threshold scale resizes itself whenever
00046                               the pbar is touched
00047 
00048     FIX_SCALE_SIZE_LATER   = if this is ALSO defined, then the
00049                              FIX_SCALE_SIZE_PROBLEM is applied after a
00050                              time delay
00051 
00052     SCANDIR_WANT_CONST = if #define-d, says that the "scandir" library
00053                           routine wants "const" arguments -- setting this
00054                           flag will avoid some stupid compiler warnings
00055 
00056     DONT_USE_SCANDIR   = if #define-d, the Unix routine scandir won't
00057                           be used.  This seems to help on Solaris, and
00058                           doesn't hurt on other systems, so it is now
00059                           the default.
00060 
00061     DONT_INSTALL_ICONS = if #define-d, won't try to install icons for the
00062                           various windows (Sun's OpenWindows complains when
00063                           I do this, and I don't know why, and I don't care)
00064 
00065     DONT_CHECK_FOR_MWM = if this is set, then the program won't bother
00066                           to check for the Motif Window Manager (MWM).
00067                           This can be useful on Linux systems using FVWM,
00068                           which won't be detected as MWM, but can be set up
00069                           to act like it with regards to decorations, etc.
00070 
00071     BOXUP_SCALE = if this is set, then the slider for the functional
00072                   threshold will have a "box" (Frame widget) drawn
00073                   around it.  Some people think this looks nicer, some don't.
00074 
00075     NO_FRIVOLITIES = if this is set, then the hidden "fun" parts of
00076                      AFNI are disabled.  What these are is a secret.
00077 
00078     DONT_USE_HINTS = if this is set, then the popup hints won't be
00079                      compiled into AFNI.
00080 
00081     NEED_XSETLOCALE = if this is set, then the routine _Xsetlocale
00082                       must be provided (needed for some Linux systems).
00083 
00084     NEED_NL_LANGINFO = if this is set, then the routine nl_langinfo()
00085                        must be provided (need on Mac OS X)
00086 
00087     DONT_UNROLL_FFTS = if this is set, then the unrolled FFT routines
00088                        (for lengths 32, 64, 128, 256) will NOT be used --
00089                        they are generally faster, but may have trouble
00090                        compiling on some systems [see file csfft.c].
00091                        The program fftest.c can be used to test the
00092                        speed of FFTs.
00093 
00094     SOLARIS_DIRENT_PATCH = if this is set, then a patch for the
00095                            difference between Sun's "dirent" functions
00096                            and everbody else's is used in the file
00097                            mcw_glob.c -- this seems to be necessary
00098                            on Solaris 2.6 systems in order to get the
00099                            AFNI file reading software to work.
00100                            (This patch was supplied by Christoph Losert
00101                            of the Institut fuer Radiologische Diagnostik,
00102                            Munchen, and has not been tested at MCW due to
00103                            the absence of any Sun workstations to play with.)
00104 
00105     SOLARIS_DIRENT_ZERO  = if this is defined, the patch described above
00106                            is modified slightly -- see mcw_glob.c for
00107                            the gory details.  The patch above seems to
00108                            be needed for Solaris 2.5.x and this modification
00109                            is also needed for Solaris 2.6.x.
00110                               [God, I hope this is the end of this ]
00111                               [Solaris nightmare -- I'm sick of it!]
00112 
00113     USE_FLOCK = There are two incompatible ways of 'locking' a file
00114     USE_LOCKF = on Unix: the flock() and lockf() functions.  Defining
00115                 one of these will enable the use of the corresponding
00116                 function.  If neither is defined, file locking will
00117                 not be used.
00118 
00119     DONT_USE_SHM = Set this to disable use of shared memory.
00120 
00121     DISCARD_EXCESS_EXPOSES = Set this if a ConfigureNotify event is
00122                              followed by an Expose event on your
00123                              systems - this will eliminate duplicate
00124                              image redraws in imseq.c.
00125 
00126     ENFORCE_ASPECT = Set this if you want image aspect ratio enforcement
00127                      compiled into your system.  Can also be set at runtime
00128                      using the AFNI_ENFORCE_ASPECT environment variable.
00129 
00130   Exactly one of the following flags must be set for AFNI plugins
00131   to work:
00132 
00133     DYNAMIC_LOADING_VIA_DL = if this is set, then loading of dynamic
00134                              libraries is accomplished using the "dl"
00135                              routines, such as "dlopen".  This is true
00136                              for all Unixes that I know of, except for
00137                              HP-UX.
00138 
00139     DYNAMIC_LOADING_VIA_SHL = if this is set, then loading of dynamic
00140                               libraries is accomplished using the "shl"
00141                               routines, such as "shl_load".  This is
00142                               only used on HP-UX, as far as I know.
00143 
00144     NO_DYNAMIC_LOADING = if this is set, then AFNI will load the plugins
00145                          statically - this means that you can't add plugins
00146                          without recompiling AFNI;  this option has only
00147                          been tested on CYGWIN, and requires a special Makefile.
00148 
00149     BAD_BUTTON3_POPUPS = if this is set, then Button-3 popup menus don't work
00150                          and the program tries something else (i.e., Solaris).
00151 
00152   Flags that MUST be set appropriately for each system:
00153 
00154     THD_MMAP_FLAG = value to set when using "mmap" to map a file to memory
00155                      (see man mmap to figure this one out)
00156 
00157     THD_MKDIR_MODE = flag to set creation mode for directories that might
00158                       be created during dataset output (you can probably
00159                       copy this from any other machine)
00160 
00161     NO_RINT = #define this if the system you are on doesn't have the
00162               "rint" (round-to-integer) math function -- I don't know
00163               of any system without this function, but you never can tell.
00164 
00165     DONT_USE_STRPTIME = #define this if your system doesn't have the
00166                         C function strptime()
00167 
00168     USE_RANDOM = #define this if you want/have to use the srandom/random
00169                  functions instead of the srand48/drand48 functions for
00170                  random number generation.
00171 
00172   Some systems need extra header files included.  Some system header
00173   files don't give a prototype for alphasort.  This is a place to fix
00174   these things up.
00175 -------------------------------------------------------------------------*/
00176 
00177 #define DONT_USE_SCANDIR
00178 #define DONT_UNROLL_FFTS  /* off by default */
00179 
00180 /*** HP-UX ***/
00181 
00182 #ifdef HP
00183 # include <dirent.h>
00184 # define THD_MMAP_FLAG  (MAP_FILE | MAP_VARIABLE | MAP_SHARED)
00185 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00186 # define SCANDIR_WANTS_CONST
00187 # define BOXUP_SCALE
00188 # define FIX_SCALE_SIZE_PROBLEM
00189 # define DYNAMIC_LOADING_VIA_SHL
00190 # undef  DONT_UNROLL_FFTS    /* FFTs are faster, but csfft.c compiles slowly */
00191 # define USE_LOCKF
00192 #endif
00193 
00194 /*** SGI IRIX ***/
00195 
00196 #if defined(SGI) || defined(OSF1) /*BUG: should have a separate OSF1 ifdef*/
00197 # include <dirent.h>
00198 # define THD_MMAP_FLAG  MAP_SHARED
00199 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00200 # define BOXUP_SCALE
00201 # define DYNAMIC_LOADING_VIA_DL
00202 # define FIX_SCALE_SIZE_PROBLEM
00203 # ifndef DONT_USE_SCANDIR
00204     extern int alphasort(struct dirent **, struct dirent **) ;
00205 # endif
00206 # undef  DONT_UNROLL_FFTS         /* helps some */
00207 # define USE_FLOCK
00208 #endif
00209 
00210 /*** SunOS or Solaris ***/
00211 
00212 #ifdef SPARKY
00213 # include <sys/dirent.h>
00214 # define THD_MMAP_FLAG  (MAP_SHARED | MAP_NORESERVE)
00215 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00216 # define DONT_INSTALL_ICONS
00217 # define NO_FRIVOLITIES
00218 # define FIX_SCALE_SIZE_PROBLEM
00219 # ifndef DONT_USE_SCANDIR
00220     extern int alphasort(struct dirent **, struct dirent **) ;
00221 # endif
00222 
00223 extern double strtod() ;
00224 extern long   strtol() ;
00225 
00226 /**
00227 #ifndef S_IFREG
00228 #  define S_IFREG _IFREG
00229 # endif
00230 # ifndef S_IFDIR
00231 #  define S_IFDIR _IFDIR
00232 # endif
00233 **/
00234 #endif
00235 
00236 #if defined(SOLARIS) || defined(SUN)
00237 # include <sys/types.h>
00238 # ifndef DONT_USE_SCANDIR
00239 #   include <sys/dir.h>
00240     extern int alphasort(struct dirent **, struct dirent **) ;
00241 # endif
00242 # define THD_MMAP_FLAG  (MAP_SHARED | MAP_NORESERVE)
00243 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00244 # define dirent direct
00245 # define FIX_SCALE_SIZE_PROBLEM
00246 # define FIX_SCALE_SIZE_LATER
00247 # define DONT_INSTALL_ICONS
00248 # define DYNAMIC_LOADING_VIA_DL
00249 # define USE_LOCKF
00250 # define DONT_USE_MATRIX_MAT  /* 04 Mar 2005 */
00251 #endif
00252 
00253 /*** IBM RS6000 courtesy Doug Morris of UIUC ***/
00254 
00255 #ifdef RS6000
00256 # include <dirent.h>
00257 # define THD_MMAP_FLAG  MAP_SHARED
00258 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00259 # define FIX_SCALE_SIZE_PROBLEM
00260 # ifndef DONT_USE_SCANDIR
00261     extern int alphasort(struct dirent **, struct dirent **) ;
00262 # endif
00263 #endif
00264 
00265 /*** Linux 1.2.x ***/
00266 
00267 #ifdef LINUX2
00268 # define NEED_XSETLOCALE
00269 # ifndef LINUX
00270 #   define LINUX
00271 # endif
00272 #endif
00273 
00274 #if defined(LINUX) || defined(FreeBSD) || defined(NetBSD) || defined(OpenBSD)
00275 # include <dirent.h>
00276 # define THD_MMAP_FLAG  MAP_SHARED
00277 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00278 # define SCANDIR_WANTS_CONST
00279 # define FIX_SCALE_SIZE_PROBLEM   /* Motif 2.0 bug? */
00280 /* # define MMAP_THRESHOLD -1 */       /* no mmap-ing */
00281 # define DONT_CHECK_FOR_MWM       /* assume Motif WM functionality is present */
00282 # define BOXUP_SCALE              /* looks nicer */
00283 # define DYNAMIC_LOADING_VIA_DL
00284 # undef  DONT_UNROLL_FFTS         /* helps a lot */
00285 # define USE_FLOCK
00286 #endif
00287 
00288 #ifdef CYGWIN
00289 # include <dirent.h>
00290 # define THD_MMAP_FLAG  MAP_SHARED
00291 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00292 # define SCANDIR_WANTS_CONST
00293 # define FIX_SCALE_SIZE_PROBLEM   /* Motif 2.0 bug? */
00294 # define MMAP_THRESHOLD -1        /* no mmap-ing */
00295 # define DONT_CHECK_FOR_MWM       /* assume Motif WM functionality is present */
00296 /**# define BOXUP_SCALE**/              /* looks nicer */
00297 # define NO_DYNAMIC_LOADING
00298 # undef  DONT_UNROLL_FFTS         /* helps a lot */
00299 # define DONT_USE_STRPTIME
00300 # define NO_FRIVOLITIES
00301 # define USING_LESSTIF            /* try to avoid some bugs */
00302 # define FIX_SCALE_SIZE_PROBLEM
00303 #endif
00304 
00305 /* SCO UDK under Unixware 7 -- contributed by Jason Bacon */
00306 #ifdef SCO
00307 # include <dirent.h>
00308 # define THD_MMAP_FLAG  MAP_SHARED
00309 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00310 # define SCANDIR_WANTS_CONST
00311 # define FIX_SCALE_SIZE_PROBLEM   /* Motif 2.0 bug? */
00312 /* # define MMAP_THRESHOLD -1 */       /* no mmap-ing */
00313 # define DONT_CHECK_FOR_MWM       /* assume Motif WM functionality is present */
00314 # define BOXUP_SCALE              /* looks nicer */
00315 # define DYNAMIC_LOADING_VIA_DL
00316 # undef  DONT_UNROLL_FFTS         /* helps a lot */
00317 #endif
00318 
00319 /* Mac OSX (Darwin) */
00320 #ifdef DARWIN
00321 # include <dirent.h>
00322 # define THD_MMAP_FLAG  MAP_SHARED
00323 # define THD_MKDIR_MODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
00324 # define SCANDIR_WANTS_CONST
00325 # define FIX_SCALE_SIZE_PROBLEM   /* Motif 2.0 bug? */
00326 # define MMAP_THRESHOLD -1        /* no mmap-ing */
00327 #if 0
00328 # define DONT_CHECK_FOR_MWM       /* assume Motif WM functionality is present */
00329 #endif
00330 # define BOXUP_SCALE              /* looks nicer */
00331 # define DYNAMIC_LOADING_VIA_DL
00332 # undef  DONT_UNROLL_FFTS
00333 # define USE_FLOCK
00334 # define USE_RANDOM
00335 # define DONT_USE_STRPTIME
00336 /** # define NEED_XSETLOCALE **/  /* removed on 16 May 2005, for Tiger */
00337 # define NEED_NL_LANGINFO
00338 # define ENFORCE_ASPECT           /* 29 Apr 2003 */
00339 #endif
00340 
00341 /************************************************************************
00342    Do NOT change anything below this line (unless your name is Cox)!
00343 *************************************************************************/
00344 
00345 # define DISCARD_EXCESS_EXPOSES   /* 15 Aug 2002 */
00346 
00347 #if defined(DYNAMIC_LOADING_VIA_DL) || defined(DYNAMIC_LOADING_VIA_SHL) || defined(NO_DYNAMIC_LOADING)
00348 #  define ALLOW_PLUGINS
00349 #else
00350 #  define DONT_ALLOW_PLUGINS
00351 #endif
00352 
00353 #ifdef NO_RINT
00354 extern double rint(double) ;  /* 12 Feb 2001 */
00355 #endif
00356 
00357 #ifdef USE_RANDOM             /* 04 Sep 2001 (cf. machdep.c) */
00358 extern void srand48(long int);
00359 extern double drand48(void);
00360 extern long int lrand48(void);
00361 #endif
00362 
00363 #ifdef NO_GAMMA               /* 16 May 2005 (cf. machdep.c) */
00364 extern double lgamma(double) ;
00365 #endif
00366 
00367 #endif /* _MCW_MACHDEP_ */
 

Powered by Plone

This site conforms to the following standards: