Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
3.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_f90_library_setup.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_F90_LIBRARY_SETUP(LIBRARY, HEADER-REGEXP, MODULE-REGEXP, LIB-REGEXP, FUNCTION-BODY)
  8. #
  9. # DESCRIPTION
  10. #
  11. # Convenience macro to set up a fortran 90 library in a simplified way.
  12. # LIBRARY is the name of the library. HEADER-REGEXP is a regular
  13. # expression (used by find) matched by the header file to look for (may be
  14. # empty). MODULE-REGEXP is a regular expression (used by find) matched by
  15. # the filename of the module (may be empty). LIB-REGEXP is a regular
  16. # expression (used by find) matched by the filename of the library, this
  17. # is useful either if the library filename does not follow the traditional
  18. # libxxx.a or libxxx.so pattern, or if some specific information is
  19. # embedded into the name, like compiler used, debugging status ...).
  20. # FUNCTION-BODY is the body of a function (including the 'use' statements
  21. # and the call to a function defined by the library).
  22. #
  23. # This macro is a simple wrapper around AX_F90_MODULE and AX_F90_LIBRARY
  24. # that uses the parameters provided by the end user through a --with-xxx
  25. # option to set up the search path. Both a module and a library will be
  26. # tested, the same path will be used for both tests, so the path must be
  27. # set up with a common parent directory of both the library file and the
  28. # module file. The macro also automatically updates the FCFLAGS, LDFLAGS
  29. # and LIBS variables in addition to providing the F90_HEADER_xxx,
  30. # F90_MODULE_xxx, F90_LDFLAGS_xxx and F90_LIBS_xxx output variables.
  31. #
  32. # Example: suppose you have /home/nostradamus/esoteric/lib/libalchemy.a
  33. # and /home/nostradamus/esoteric/mod/alchemy.mod which provides a function
  34. # transmute_into_gold, you can use the following in you configure.ac:
  35. #
  36. # AX_F90_MODULE_EXTENSION
  37. # if test x$ax_cv_f90_modext = xunknown ; then
  38. # AC_MSG_ERROR([unable to find f90 modules extension])
  39. # fi
  40. # AX_F90_LIBRARY_SETUP(alchemy,[],alchemy.$ax_cv_f90_modext,libalchemy*,[
  41. # use alchemy
  42. # call transmute_into_gold('lead')
  43. # ])
  44. #
  45. # and the user could configure your package using a command like this:
  46. #
  47. # ./configure --with-alchemy=$HOME/esoteric
  48. #
  49. # LICENSE
  50. #
  51. # Copyright (c) 2009 Luc Maisonobe <luc@spaceroots.org>
  52. #
  53. # Copying and distribution of this file, with or without modification, are
  54. # permitted in any medium without royalty provided the copyright notice
  55. # and this notice are preserved. This file is offered as-is, without any
  56. # warranty.
  57. #serial 10
  58. AC_DEFUN([AX_F90_LIBRARY_SETUP],[
  59. AC_ARG_WITH([$1],[ --with-$1=path specify search path form $1 module and library],
  60. [if test x${withval} = xno ; then
  61. AC_MSG_WARN([$1 disabled at user option])
  62. fi],[withval=""])
  63. if test x$2 != x ; then
  64. AX_F90_HEADER([$1],[$2],[$5],$withval,[
  65. FCFLAGS="$FCFLAGS $AS_TR_SH(F90_HEADER_$1)"
  66. ],[])
  67. fi
  68. if test x$3 != x ; then
  69. AX_F90_MODULE([$1],[$3],[$5],$withval,[
  70. FCFLAGS="$FCFLAGS $AS_TR_SH(F90_MODULE_$1)"
  71. ],[])
  72. fi
  73. AX_F90_LIBRARY([$1],[$4],[$5],$withval,[
  74. LDFLAGS="$LDFLAGS $AS_TR_SH(F90_LDFLAGS_$1)"
  75. LIBS="$AS_TR_SH(F90_LIBS_$1) $LIBS"
  76. ],[])
  77. ])