configure.ac 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. dnl configuration script for Guile-SSH
  2. dnl Process this file with autoconf to produce configure.
  3. dnl
  4. define(GUILE_SSH_CONFIGURE_COPYRIGHT, [[
  5. Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018 Artyom V. Poptsov <poptsov.artyom@gmail.com>
  6. This file is part of Guile-SSH.
  7. Guile-SSH is free software: you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License as
  9. published by the Free Software Foundation, either version 3 of the
  10. License, or (at your option) any later version.
  11. Guile-SSH is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with Guile-SSH. If not, see <http://www.gnu.org/licenses/>.
  17. ]])
  18. AC_INIT([Guile-SSH], [0.12.0], [poptsov.artyom@gmail.com],
  19. [guile-ssh],
  20. [https://github.com/artyom-poptsov/guile-ssh])
  21. AC_COPYRIGHT(GUILE_SSH_CONFIGURE_COPYRIGHT)
  22. AC_CONFIG_AUX_DIR([build-aux])
  23. AC_CONFIG_MACRO_DIR([m4])
  24. AC_CONFIG_HEADER([libguile-ssh/config.h])
  25. AM_INIT_AUTOMAKE([color-tests])
  26. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY],1)])
  27. AC_PROG_CC
  28. if test "x$GCC" = "xyes"; then
  29. # Use compiler warnings.
  30. WARN_CFLAGS="-Wall"
  31. else
  32. WARN_CFLAGS=""
  33. fi
  34. AC_SUBST([WARN_CFLAGS])
  35. AC_ARG_WITH([guilesitedir],
  36. [AS_HELP_STRING([--with-guilesitedir],
  37. [use the specified installation path for Guile modules])],
  38. [case "x$withval" in
  39. xyes|xno) guilesitedir="";;
  40. *) guilesitedir="$withval";;
  41. esac],
  42. [guilesitedir=""])
  43. # -------------------------------------------------------------------------------
  44. # Check for needed libraries
  45. # -------------------------------------------------------------------------------
  46. PKG_CHECK_MODULES([LIBSSH], [libssh >= 0.6.4])
  47. PKG_CHECK_MODULES([LIBSSH_0_7_3], [libssh >= 0.7.3],
  48. [AC_DEFINE(HAVE_LIBSSH_0_7_3, 1, [Use libssh 0.7.3])],
  49. [AC_WARN([
  50. Using a potentially vulnerable version of libssh
  51. <https://www.libssh.org/2016/02/23/libssh-0-7-3-security-and-bugfix-release/>])])
  52. dnl Checking for libssh 0.8.x
  53. PKG_CHECK_MODULES([LIBSSH_0_8], [libssh >= 0.8.0],
  54. [AC_DEFINE(HAVE_LIBSSH_0_8, 1, [Use libssh 0.8])],
  55. [AC_DEFINE(HAVE_LIBSSH_0_8, 0, [Use libssh < 0.8])])
  56. AM_CONDITIONAL(HAVE_LIBSSH_0_8, $HAVE_LIBSSH_0_8)
  57. PKG_CHECK_MODULES([LIBSSH_0_9], [libssh >= 0.9.0],
  58. [AC_DEFINE(HAVE_LIBSSH_0_9, 1, [Use libssh 0.9])],
  59. [AC_DEFINE(HAVE_LIBSSH_0_9, 0, [Use libssh < 0.9])])
  60. AM_CONDITIONAL(HAVE_LIBSSH_0_9, $HAVE_LIBSSH_0_9)
  61. # -------------------------------------------------------------------------------
  62. dnl These macros must be provided by guile.m4.
  63. m4_pattern_forbid([^GUILE_PKG$])
  64. m4_pattern_forbid([^GUILE_PROGS$])
  65. dnl Use this macro so that 'GUILE_EFFECTIVE_VERSION' is defined here.
  66. dnl Try Guile 2.2, then Guile 2.0.
  67. GUILE_PKG([2.2 2.0])
  68. GUILE_PROGS
  69. GUILE_FLAGS
  70. GUILE_SITE_DIR
  71. dnl (srfi srfi-64) appeared in Guile 2.0.10. Make sure we have it.
  72. GUILE_MODULE_AVAILABLE([have_srfi64], [(srfi srfi-64)])
  73. if test "x$have_srfi64" != "xyes"; then
  74. AC_MSG_ERROR([(srfi srfi-64) is missing; please install a more recent Guile.])
  75. fi
  76. LT_INIT()
  77. if test "x$guilesitedir" = "x"; then
  78. guilesitedir="$datadir/guile/site/$GUILE_EFFECTIVE_VERSION"
  79. fi
  80. AC_SUBST([guilesitedir])
  81. LIBGUILE_SSH_INTERFACE="11:0:0"
  82. AC_SUBST(LIBGUILE_SSH_INTERFACE)
  83. GUILE_EFFECTIVE_VERSION=`$GUILE -c '(display (effective-version))'`
  84. AC_SUBST(GUILE_EFFECTIVE_VERSION)
  85. AC_CONFIG_FILES([Makefile libguile-ssh/Makefile examples/Makefile build-aux/Makefile])
  86. AC_CONFIG_FILES([m4/Makefile doc/Makefile tests/Makefile am/Makefile])
  87. AC_CONFIG_FILES([modules/Makefile modules/ssh/Makefile modules/ssh/dist/Makefile])
  88. # Generate a Makefile, based on the results.
  89. AC_OUTPUT
  90. if test "$guilesitedir" != "$GUILE_SITE"; then
  91. # Guile has a different prefix than this module
  92. AC_MSG_WARN([]
  93. [The Guile modules will be installed in ${guilesitedir}.]
  94. [You should probably re-run `configure' with]
  95. [`--with-guilesitedir=$GUILE_SITE']
  96. [Otherwise, you will have to adjust the `GUILE_LOAD_PATH' environment]
  97. [variable.])
  98. fi