# After parts of fortran.m4 from autoconf 2.59 # hacked up by Bill Northcott # Should not be required with next release of autoconf. # # _ACX_FC_LIBRARY_LDFLAGS # ---------------------- # # Determine the linker flags (e.g. "-L" and "-l") for the Fortran # intrinsic and run-time libraries that are required to successfully # link a Fortran program or shared library. The output variable # FLIBS/FCLIBS is set to these flags. # # This macro is intended to be used in those situations when it is # necessary to mix, e.g. C++ and Fortran, source code into a single # program or shared library. # # For example, if object files from a C++ and Fortran compiler must # be linked together, then the C++ compiler/linker must be used for # linking (since special C++-ish things need to happen at link time # like calling global constructors, instantiating templates, enabling # exception support, etc.). # # However, the Fortran intrinsic and run-time libraries must be # linked in as well, but the C++ compiler/linker doesn't know how to # add these Fortran libraries. Hence, the macro # "ACX_F77_LIBRARY_LDFLAGS" was created to determine these Fortran # libraries. # # This macro was packaged in its current form by Matthew D. Langston. # However, nearly all of this macro came from the "OCTAVE_FLIBS" macro # in "octave-2.0.13/aclocal.m4", and full credit should go to John # W. Eaton for writing this extremely useful macro. Thank you John. AC_DEFUN([_ACX_FC_LIBRARY_LDFLAGS], [_AC_FORTRAN_ASSERT()dnl _AC_PROG_FC_V AC_CACHE_CHECK([for Fortran libraries of $[]_AC_FC[]], ac_cv_[]_AC_LANG_ABBREV[]_libs, [if test "x$[]_AC_LANG_PREFIX[]LIBS" != "x"; then ac_cv_[]_AC_LANG_ABBREV[]_libs="$[]_AC_LANG_PREFIX[]LIBS" # Let the user override the test. else _AC_PROG_FC_V_OUTPUT ac_cv_[]_AC_LANG_ABBREV[]_libs= # Save positional arguments (if any) ac_save_positional="$[@]" set X $ac_[]_AC_LANG_ABBREV[]_v_output while test $[@%:@] != 1; do shift ac_arg=$[1] case $ac_arg in [[\\/]]*.a | ?:[[\\/]]*.a) _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg") ;; -bI:*) _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , [_AC_LINKER_OPTION([$ac_arg], ac_cv_[]_AC_LANG_ABBREV[]_libs)]) ;; # Ignore these flags. -lang* | -lcrt* | -lc | -lgcc | -libmil | -LANG:=*) ;; -lkernel32) test x"$CYGWIN" != xyes && ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg" ;; -[[LRuY]]) # These flags, when seen by themselves, take an argument. # We remove the space between option and argument and re-iterate # unless we find an empty arg or a new option (starting with -) case $[2] in "" | -*);; *) ac_arg="$ac_arg$[2]" shift; shift set X $ac_arg "$[@]" ;; esac ;; -YP,*) for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do _AC_LIST_MEMBER_IF($ac_j, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , [ac_arg="$ac_arg $ac_j" ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_j"]) done ;; -[[lLR]]*) _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_[]_AC_LANG_ABBREV[]_libs, , ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_arg") ;; # Ignore everything else. esac done # restore positional arguments set X $ac_save_positional; shift # We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, # then we insist that the "run path" must be an absolute path (i.e. it # must begin with a "/"). case `(uname -sr) 2>/dev/null` in "SunOS 5"*) ac_ld_run_path=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed -n 's,^.*LD_RUN_PATH *= *\(/[[^ ]]*\).*$,-R\1,p'` test "x$ac_ld_run_path" != x && _AC_LINKER_OPTION([$ac_ld_run_path], ac_cv_[]_AC_LANG_ABBREV[]_libs) ;; esac fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" ]) []_AC_LANG_PREFIX[]LIBS="$ac_cv_[]_AC_LANG_ABBREV[]_libs" AC_SUBST([]_AC_LANG_PREFIX[]LIBS) ])# _ACX_FC_LIBRARY_LDFLAGS # ACX_F77_LIBRARY_LDFLAGS # ---------------------- AC_DEFUN([ACX_F77_LIBRARY_LDFLAGS], [AC_REQUIRE([AC_PROG_F77])dnl AC_LANG_PUSH(Fortran 77)dnl _ACX_FC_LIBRARY_LDFLAGS AC_LANG_POP(Fortran 77)dnl ])# ACX_F77_LIBRARY_LDFLAGS # ACX_FC_LIBRARY_LDFLAGS # ---------------------- AC_DEFUN([ACX_FC_LIBRARY_LDFLAGS], [AC_REQUIRE([AC_PROG_FC])dnl AC_LANG_PUSH(Fortran)dnl _ACX_FC_LIBRARY_LDFLAGS AC_LANG_POP(Fortran)dnl ])# ACX_FC_LIBRARY_LDFLAGS # _ACX_F77_NAME_MANGLING # ---------------------- AC_DEFUN([_ACX_F77_NAME_MANGLING], [AC_REQUIRE([ACX_F77_LIBRARY_LDFLAGS])dnl AC_REQUIRE([AC_F77_DUMMY_MAIN])dnl AC_LANG_PUSH(Fortran 77)dnl __AC_FC_NAME_MANGLING AC_LANG_POP(Fortran 77)dnl ])# _ACX_F77_NAME_MANGLING # _ACX_FC_NAME_MANGLING # ---------------------- AC_DEFUN([_ACX_FC_NAME_MANGLING], [AC_REQUIRE([ACX_FC_LIBRARY_LDFLAGS])dnl AC_REQUIRE([AC_FC_DUMMY_MAIN])dnl AC_LANG_PUSH(Fortran)dnl __AC_FC_NAME_MANGLING AC_LANG_POP(Fortran)dnl ])# _ACX_FC_NAME_MANGLING # ACX_F77_WRAPPERS # --------------- AC_DEFUN([ACX_F77_WRAPPERS], [AC_REQUIRE([_ACX_F77_NAME_MANGLING])dnl AC_LANG_PUSH(Fortran 77)dnl _AC_FC_WRAPPERS AC_LANG_POP(Fortran 77)dnl ])# ACX_F77_WRAPPERS # ACX_FC_WRAPPERS # -------------- AC_DEFUN([ACX_FC_WRAPPERS], [AC_REQUIRE([_ACX_FC_NAME_MANGLING])dnl AC_LANG_PUSH(Fortran)dnl _AC_FC_WRAPPERS AC_LANG_POP(Fortran)dnl ])# ACX_FC_WRAPPERS