[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_FC_MODULE_FLAG
From: |
Ralf Wildenhues |
Subject: |
Re: AC_FC_MODULE_FLAG |
Date: |
Thu, 07 Jul 2011 23:08:44 +0200 |
On Wed, Jul 06, 2011 at 03:59:13PM -0600, Jim Edwards wrote:
> Okay, here is another method that seems to work, I need to make the
> subdirectory read-only then
> try to compile another module in the main directory. With the -M flag it
> fails because it can't write
> the .mod file in the conftest.dir
That's better; but what about w32? IIUC Lahey also has a version for
that. Can you just try to look if some module-like file exists in the
directory after the fact? Something like
case conftest.dir/*_* in
*\*_\**) good... ;;
*) Lahey... ;;
esac
Thanks,
Ralf
> --- fortran.m4 (revision 327)
> +++ fortran.m4 (working copy)
> @@ -593,7 +593,7 @@
> # IBM: -Idir (-qmoddir=dir for writing)
> # Intel: -Idir -I dir (-mod dir for writing)
> # Absoft: -pdir
> -# Lahey: -mod dir
> +# Lahey: -Idir (-Mdir or -mod dir for writing)
> # Cray: -module dir, -p dir (-J dir for writing)
> # -e m is needed to enable writing .mod files at all
> # Compaq: -Idir
> @@ -615,17 +615,23 @@
> write(*,'(a)') 'gotcha!'
> end subroutine
> end module]],
> - [cd ..
> + # For Lahey -M will also write module and object files to that directory
> + # make it read-only so that lahey fails over to -I
> + [chmod -w .
> + cd ..
> ac_fc_module_flag_FCFLAGS_save=$FCFLAGS
> # Flag ordering is significant for gfortran and Sun.
> for ac_flag in -M -I '-I ' '-M ' -p '-mod ' '-module ' '-Am -I'; do
> # Add the flag twice to prevent matching an output flag.
> FCFLAGS="$ac_fc_module_flag_FCFLAGS_save ${ac_flag}conftest.dir
> ${ac_flag}conftest.dir"
> AC_COMPILE_IFELSE([[
> - program main
> + module conftest_main
> use conftest_module
> + contains
> + subroutine conftest
> call conftest_routine
> - end program]],
> + end subroutine
> + end module]],
> [ac_cv_fc_module_flag="$ac_flag"])
> if test "$ac_cv_fc_module_flag" != unknown; then
> break
> @@ -633,6 +639,7 @@
> done
> FCFLAGS=$ac_fc_module_flag_FCFLAGS_save
> ])
> +chmod +w conftest.dir
> rm -rf conftest.dir
> AC_LANG_POP([Fortran])
> ])