####GitHub page: https://github.com/johnh2o2/ggadt ####John Hoffman #####[email protected] #####3/27/2014
I've written GGADT with the goal of being as compatible as possible (within the scope of Fortran 95). To that end, I've utilized the GNU Autotools ("Autoconf" and "Automake") utilities. I've tested that GGADT compiles with gfortran v4.3 (as far back as I can go on my current Mac machine), and g95 (v0.93).
GGADT is public domain, open-source software, and you are free to amend, change, and improve the code in any way you see fit. If you have particular suggestions for future GGADT releases, feel free to e-mail me (John Hoffman, e-mail at the top of this file). The GitHub page (which should have the latest edition of GGADT) is provided above.
###TODO list
- Add ability for user to define a defaults file.
- Add options to control (1) units of the output parameters, (2) whether or not to output Q or sigma, (3) some fudge parameters for interpolation and integration accuracy, etcetera.
###Using GNU Autoconf and Automake utilities
Relevant files: **/Makefile.am, *.in, configure.ac, etc. Useful resources: http://autotoolset.sourceforge.net/tutorial.html#SEC40, http://www.gnu.org/software/autoconf/, http://www.gnu.org/software/automake/
GNU Autotools is a very old and widely used system to generate configuration scripts and makefiles. It tries to make the installation process as painless as possible for the USER (not necessarily the developer).
GNU Autotools combines a set of macros written in the m4 language with the sh scripting language. Developers need to provide a configure.ac script in the parent directory and a set of Makefile.am files in all relevant subdirectories, and Autotools will generate a configure script (which in turn will generate makefiles). By appending a .in to the end of a file (as I have done for several source files), configure.ac will replace macros (between two @ symbols in the .in file) conditionally, depending on results of the configure script.
- Q: "Why don't you just use preprocessor directives to do this? Isn't that much cleaner and easier to understand?"
- A: Yes, it definitely is cleaner, more understandable, and probably more powerful. But not all Fortran compilers use preprocessors. Gfortran, ifort and g95 all do, but by using Autotools macros, I'm hoping to be more compatible across many different Fortran compilers.
For instance, if you have a compiler that does not recognize the get_command_argument()function that is part of the Fortran 2003 standard, the Autoconf utility will comment out lines with that function call and uncomment lines with function calls to getarg(). When the configuration has completed and all macros have been replaced, a new file is generated containing appropriate substitutions, with the .in suffix removed.
The configure file is generated by feeding the "configure.ac" file to autoconf. Running the configure file on any system then generates Makefiles, and the user can then build the program simply by typing "make".
When editing source code, you should always edit the *.in file (if present), and NOT the the file that has the .in suffix removed. Otherwise, when the configure script is run again, all of your changes to the .f95 file will be overwritten when the configure script converts the .f95.in to the .f95 file.
If you would like to change the configuration procedure (perhaps you would like to check that the user has a particular library installed), you must edit the configure.ac file. To generate a new configure file, you must re-run the GNU Autotools procedure:
- aclocal -I./m4 (includes any m4 macros you've defined in the m4/ subdirectory)
- autoconf (runs autoconf on the configure.ac files)
- automake -a (runs automake on the Makefile.am files)
To completely remake the sourcecode (and implement changes to the configure.ac file), I use a bash script (reconf-custom.sh) which is in the parent directory.
To do this, you must a later version of Autotools than what you may already have (since I use some Fortran-related macros that were added relatively late in the game). I'm not sure exactly what the minimum version of Autotools is that you will need, but I use version 2.69.
###Adding modules and functionality
If you write your own [to be continued...]
###Source files and their purpose