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.

120 lines
3.3KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_lib_metis.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_LIB_METIS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro searches for the METIS library in the user specified
  12. # location. The user may specify the location either by defining the
  13. # environment variable METIS or by using the --with-metis option to
  14. # configure. If the environment variable is defined it has precedent over
  15. # everything else. If no location was specified then it searches in
  16. # /usr/lib and /usr/local/lib for the library and in /usr/include and
  17. # /usr/local/include for the header files. Upon successful completion the
  18. # variables METIS_LIB and METIS_INCLUDE are set.
  19. #
  20. # ACTION-IF-FOUND is a list of shell commands to run if a METIS library is
  21. # found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is
  22. # not found. If ACTION-IF-FOUND is not specified, the default action will
  23. # define HAVE_METIS. If ACTION-IF-NOT-FOUND is not specified then an error
  24. # will be generated halting configure.
  25. #
  26. # LICENSE
  27. #
  28. # Copyright (c) 2008 Ben Bergen <ben@cs.fau.de>
  29. #
  30. # Copying and distribution of this file, with or without modification, are
  31. # permitted in any medium without royalty provided the copyright notice
  32. # and this notice are preserved. This file is offered as-is, without any
  33. # warranty.
  34. #serial 10
  35. AU_ALIAS([IMMDX_LIB_METIS], [AX_LIB_METIS])
  36. AC_DEFUN([AX_LIB_METIS], [
  37. AC_MSG_CHECKING(for METIS library)
  38. AC_REQUIRE([AC_PROG_CC])
  39. #
  40. # User hints...
  41. #
  42. AC_ARG_VAR([METIS], [METIS library location])
  43. AC_ARG_WITH([metis],
  44. [AS_HELP_STRING([--with-metis],
  45. [user defined path to METIS library])],
  46. [
  47. if test -n "$METIS" ; then
  48. AC_MSG_RESULT(yes)
  49. with_metis=$METIS
  50. elif test "$withval" != no ; then
  51. AC_MSG_RESULT(yes)
  52. with_metis=$withval
  53. else
  54. AC_MSG_RESULT(no)
  55. fi
  56. ],
  57. [
  58. if test -n "$METIS" ; then
  59. with_metis=$METIS
  60. AC_MSG_RESULT(yes)
  61. else
  62. with_metis=/usr
  63. if test ! -f "$with_metis/include/metis.h" ; then
  64. with_metis=/usr/local
  65. if test ! -f "$with_metis/include/metis.h" ; then
  66. with_metis=""
  67. AC_MSG_RESULT(failed)
  68. else
  69. AC_MSG_RESULT(yes)
  70. fi
  71. else
  72. AC_MSG_RESULT(yes)
  73. fi
  74. fi
  75. ])
  76. #
  77. # locate METIS library
  78. #
  79. if test -n "$with_metis" ; then
  80. old_CFLAGS=$CFLAGS
  81. old_LDFLAGS=$LDFLAGS
  82. CFLAGS="-I$with_metis/include"
  83. LDFLAGS="-L$with_metis/lib"
  84. AC_LANG_SAVE
  85. AC_LANG_C
  86. AC_CHECK_LIB(metis, METIS_PartMeshDual,
  87. [metis_lib=yes], [metis_lib=yes], [-lm])
  88. AC_CHECK_HEADER(metis.h, [metis_h=yes],
  89. [metis_h=no], [/* check */])
  90. AC_LANG_RESTORE
  91. CFLAGS=$old_CFLAGS
  92. LDFLAGS=$old_LDFLAGS
  93. AC_MSG_CHECKING(METIS in $with_metis)
  94. if test "$metis_lib" = "yes" -a "$metis_h" = "yes" ; then
  95. AC_SUBST(METIS_INCLUDE, [-I$with_metis/include])
  96. AC_SUBST(METIS_LIB, [-L$with_metis/lib])
  97. AC_MSG_RESULT(ok)
  98. else
  99. AC_MSG_RESULT(failed)
  100. fi
  101. fi
  102. #
  103. #
  104. #
  105. if test x = x"$METIS_LIB" ; then
  106. ifelse([$2],,[AC_MSG_ERROR(Failed to find valid METIS library)],[$2])
  107. :
  108. else
  109. ifelse([$1],,[AC_DEFINE(HAVE_METIS,1,[Define if you have METIS library])],[$1])
  110. :
  111. fi
  112. ])dnl AX_LIB_METIS