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.

85 lines
4.7KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_prog_httpd.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_HTTPD
  8. #
  9. # DESCRIPTION
  10. #
  11. # Check for Apache's 'httpd', let script continue if exists & works, pops
  12. # up error message if not.
  13. #
  14. # Testing of functionality is by checking its compile settings
  15. #
  16. # Besides checking existence, this macro also set these environment
  17. # variables upon completion:
  18. #
  19. # HTTPD = which httpd
  20. # HTTPD_ROOT = Apache's root directory, specified when compiled / run with -d option
  21. # HTTPD_SERVER_ROOT = Directory for Apache's essential files, e.g. access logs / error logs / modules / scripts.
  22. # HTTPD_SERVER_CONFIG_FILE = Full-path of the 'httpd.conf' file
  23. # HTTPD_USER = Which user that httpd runs as
  24. # HTTPD_GROUP = Which group that httpd runs as
  25. # HTTPD_DOC_HOME = Document directory, taken as the first DocumentRoot path found in httpd.conf
  26. # HTTPD_SCRIPT_HOME = CGI script directory, taken as the first ScriptAlias path found in httpd.conf
  27. #
  28. # LICENSE
  29. #
  30. # Copyright (c) 2008 Gleen Salmon <gleensalmon@yahoo.com>
  31. #
  32. # This program is free software; you can redistribute it and/or modify it
  33. # under the terms of the GNU General Public License as published by the
  34. # Free Software Foundation; either version 2 of the License, or (at your
  35. # option) any later version.
  36. #
  37. # This program is distributed in the hope that it will be useful, but
  38. # WITHOUT ANY WARRANTY; without even the implied warranty of
  39. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  40. # Public License for more details.
  41. #
  42. # You should have received a copy of the GNU General Public License along
  43. # with this program. If not, see <https://www.gnu.org/licenses/>.
  44. #
  45. # As a special exception, the respective Autoconf Macro's copyright owner
  46. # gives unlimited permission to copy, distribute and modify the configure
  47. # scripts that are the output of Autoconf when processing the Macro. You
  48. # need not follow the terms of the GNU General Public License when using
  49. # or distributing such scripts, even though portions of the text of the
  50. # Macro appear in them. The GNU General Public License (GPL) does govern
  51. # all other use of the material that constitutes the Autoconf Macro.
  52. #
  53. # This special exception to the GPL applies to versions of the Autoconf
  54. # Macro released by the Autoconf Archive. When you make and distribute a
  55. # modified version of the Autoconf Macro, you may extend this special
  56. # exception to the GPL to apply to your modified version as well.
  57. #serial 6
  58. AU_ALIAS([AC_PROG_HTTPD], [AX_PROG_HTTPD])
  59. AC_DEFUN([AX_PROG_HTTPD],[
  60. AC_REQUIRE([AC_EXEEXT])dnl
  61. AC_PATH_PROG(HTTPD, httpd$EXEEXT, nocommand)
  62. if test "$HTTPD" = nocommand; then
  63. AC_MSG_ERROR([httpd not found in $PATH])
  64. fi
  65. HTTPD_ROOT=`httpd -V | grep HTTPD_ROOT | sed 's/^.*HTTPD_ROOT[[[:blank:]]]*=[[[:blank:]]]*"\(.*\)"$/\1/'`
  66. HTTPD_SERVER_CONFIG_FILE=`httpd -V | grep SERVER_CONFIG_FILE | sed 's/^.*SERVER_CONFIG_FILE[[[:blank:]]]*=[[[:blank:]]]*"\(.*\)"$/\1/'`
  67. if echo $HTTPD_SERVER_CONFIG_FILE | grep ^[[^/]] > /dev/null; then
  68. HTTPD_SERVER_CONFIG_FILE=$HTTPD_ROOT/$HTTPD_SERVER_CONFIG_FILE
  69. fi
  70. SERVER_ROOT_PATTERN='^[[[:blank:]]]*ServerRoot[[[:blank:]]][[[:blank:]]]*"\([[^"]]*\)"$'
  71. HTTPD_USER_PATTERN='^User[[[:blank:]]][[[:blank:]]]*\([[^[:blank:]]][[^[:blank:]]]*\)$'
  72. HTTPD_GROUP_PATTERN='^Group[[[:blank:]]][[[:blank:]]]*\([[^[:blank:]]][[^[:blank:]]]*\)$'
  73. DOCUMENT_ROOT_PATTERN='^[[[:blank:]]]*DocumentRoot[[[:blank:]]][[[:blank:]]]*"\([[^"]]*\)"$'
  74. SCRIPT_ALIAS_PATTERN='^[[[:blank:]]]*ScriptAlias[[[:blank:]]][[[:blank:]]]*[[^[:blank:]]][[^[:blank:]]]*[[[:blank:]]][[[:blank:]]]*"\([[^"]]*\)"$'
  75. AC_CHECK_FILE($HTTPD_SERVER_CONFIG_FILE,
  76. [HTTPD_SERVER_ROOT=`grep $SERVER_ROOT_PATTERN $HTTPD_SERVER_CONFIG_FILE | head -n 1 | sed "s/$SERVER_ROOT_PATTERN/\1/" | sed s/[[/]]$//`;
  77. HTTPD_USER=`grep $HTTPD_USER_PATTERN $HTTPD_SERVER_CONFIG_FILE | sed "s/$HTTPD_USER_PATTERN/\1/"`;
  78. HTTPD_GROUP=`grep $HTTPD_GROUP_PATTERN $HTTPD_SERVER_CONFIG_FILE | sed "s/$HTTPD_GROUP_PATTERN/\1/"`;
  79. HTTPD_DOC_HOME=`grep $DOCUMENT_ROOT_PATTERN $HTTPD_SERVER_CONFIG_FILE | head -n 1 | sed "s/$DOCUMENT_ROOT_PATTERN/\1/" | sed s/[[/]]$//`;
  80. HTTPD_SCRIPT_HOME=`grep $SCRIPT_ALIAS_PATTERN $HTTPD_SERVER_CONFIG_FILE | head -n 1 | sed "s/$SCRIPT_ALIAS_PATTERN/\1/" | sed s/[[/]]$//`],
  81. AC_MSG_ERROR([httpd server-config-file (detected as $HTTPD_SERVER_CONFIG_FILE by httpd -V) cannot be found]))dnl
  82. ])