1C> \brief The Fortran interface routine to get the NWCHEM source
2C> directory
3C>
4C> In order to compile the source code location into the code we have
5C> to choose between two evils:
6C> - Either we struggle with the random Fortran line length limits
7C>   (because they were such a disaster in Fortran77 compiler developers
8C>   have kindly carried these over into Fortran90 and further :-(.
9C> - Or we have to generate the code is C and use to ISO_C_BINDING
10C>   module to integrate this into Fortran.
11C> Either approach is a bit of a mess, so we encapsulate all the messing
12C> around in this routine. This routine then provides a straightforward
13C> interface that can simply be called from the Fortran code without
14C> having to pull any stunts.
15C>
16      subroutine util_nwchem_srcdir(pathname)
17#define MAXLENGTH 256
18#ifdef NWCHEM_LONG_PATHS
19      USE ISO_C_BINDING
20#endif
21      implicit none
22#ifdef NWCHEM_LONG_PATHS
23#include "utilc_nwchem_srcdir.fh"
24      character (KIND=C_CHAR,LEN=1) :: compiled_name(256)
25      integer (C_INT) :: length
26      character(len=*), intent(inout) :: pathname
27      integer j
28#else
29      character*MAXLENGTH compiled_name
30      integer length
31      character*(*) pathname !< [Output] The compiled in pathname
32#endif
33#ifdef NWCHEM_LONG_PATHS
34      length = MAXLENGTH
35      call utilc_nwchem_srcdir(compiled_name,length)
36      do j=1,length
37         pathname(j:j) = compiled_name(j)
38      enddo
39#else
40      compiled_name =
41     &NWCHEM_SRCDIR
42      pathname = compiled_name
43#endif
44      end
45c $Id$
46