PAC_PROG_F77_NAME_MANGLE

Determine how the Fortran compiler mangles names

Synopsis

PAC_PROG_F77_NAME_MANGLE([action])

Output Effect

If no action is specified, one of the following names is defined

 If fortran names are mapped:
   lower -> lower                  F77_NAME_LOWER
   lower -> lower_                 F77_NAME_LOWER_USCORE
   lower -> UPPER                  F77_NAME_UPPER
   lower_lower -> lower__          F77_NAME_LOWER_2USCORE
   mixed -> mixed                  F77_NAME_MIXED
   mixed -> mixed_                 F77_NAME_MIXED_USCORE
If an action is specified, it is executed instead.

Notes

We assume that if lower -> lower (any underscore), upper -> upper with the same underscore behavior. Previous versions did this by compiling a Fortran program and running strings -a over it. Depending on strings is a bad idea, so instead we try compiling and linking with a C program, since that is why we are doing this anyway. A similar approach is used by FFTW, though without some of the cases we check (specifically, mixed name mangling)