configure.ac 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. dnl Copyright 2005 Red Hat, Inc.
  2. dnl
  3. dnl Permission to use, copy, modify, distribute, and sell this software and its
  4. dnl documentation for any purpose is hereby granted without fee, provided that
  5. dnl the above copyright notice appear in all copies and that both that
  6. dnl copyright notice and this permission notice appear in supporting
  7. dnl documentation, and that the name of Red Hat not be used in
  8. dnl advertising or publicity pertaining to distribution of the software without
  9. dnl specific, written prior permission. Red Hat makes no
  10. dnl representations about the suitability of this software for any purpose. It
  11. dnl is provided "as is" without express or implied warranty.
  12. dnl
  13. dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  14. dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  15. dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  16. dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  17. dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. dnl PERFORMANCE OF THIS SOFTWARE.
  20. dnl
  21. dnl Process this file with autoconf to create configure.
  22. # Initialize Autoconf
  23. AC_PREREQ([2.60])
  24. AC_INIT([xconsole],
  25. [1.0.6],
  26. [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
  27. [xconsole])
  28. AC_CONFIG_SRCDIR([Makefile.am])
  29. AC_CONFIG_HEADERS([config.h])
  30. # Initialize Automake
  31. AM_INIT_AUTOMAKE([foreign dist-bzip2])
  32. AM_MAINTAINER_MODE
  33. # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
  34. m4_ifndef([XORG_MACROS_VERSION],
  35. [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
  36. XORG_MACROS_VERSION(1.8)
  37. XORG_DEFAULT_OPTIONS
  38. # Checks for pkg-config packages
  39. PKG_CHECK_MODULES(XCONSOLE, xaw7 xmu xt >= 1.0 x11 xproto >= 7.0.17)
  40. PKG_CHECK_MODULES(APPDEFS, xt)
  41. xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt`
  42. AC_ARG_WITH(appdefaultdir,
  43. AS_HELP_STRING([--with-appdefaultdir=<pathname>],
  44. [specify directory for app-defaults files (default is autodetected)]),
  45. [appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"])
  46. AC_SUBST(appdefaultdir)
  47. AC_SEARCH_LIBS(openpty, [util])
  48. AC_CHECK_FUNC(openpty, [HAS_OPENPTY="yes"])
  49. if test "x$HAS_OPENPTY" = "xyes" ; then
  50. AC_DEFINE([HAS_OPENPTY], 1,
  51. [Define to 1 if you have the 'openpty' function.])
  52. AC_CHECK_HEADERS([util.h libutil.h pty.h], [break])
  53. fi
  54. # Privilege separation when running as root
  55. AC_ARG_ENABLE(privsep,
  56. AC_HELP_STRING([--enable-privsep],
  57. [enable privilege separation]),
  58. [USE_PRIVSEP="$enableval"],
  59. USE_PRIVSEP="no")
  60. # Privilege separation requires openpty()
  61. if test "x$HAS_OPENPTY" = "xno" ; then
  62. AC_MSG_ERROR([privilege separation code requires openpty()])
  63. USE_PRIVSEP="no"
  64. fi
  65. if test "x$USE_PRIVSEP" = "xyes" ; then
  66. AC_DEFINE([USE_PRIVSEP], 1, [Define to 1 to use privilege separation])
  67. AC_SEARCH_LIBS(setproctitle, [util])
  68. AC_CHECK_FUNC(setproctitle, [HAS_SETPROCTITLE="yes"])
  69. if test "x$HAS_SETPROCTILE" = "xyes" ; then
  70. AC_DEFINE([HAS_SETPROCTITLE], 1,
  71. [Define to 1 if you have the 'setproctitle function.])
  72. fi
  73. AC_CHECK_FUNCS(setresuid, [
  74. dnl Some platorms have setresuid that isn't implemented,
  75. dnl test for this
  76. AC_MSG_CHECKING(if setresuid seems to work)
  77. AC_RUN_IFELSE(
  78. [AC_LANG_SOURCE([[
  79. #include <stdlib.h>
  80. #include <errno.h>
  81. int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
  82. ]])],
  83. [AC_MSG_RESULT(yes)],
  84. [AC_DEFINE(BROKEN_SETRESUID, 1,
  85. [ENOSYS: Not implemented])
  86. AC_MSG_RESULT(not implemented)]
  87. )
  88. ])
  89. AC_CHECK_FUNCS(setresgid, [
  90. dnl Some platorms have setresgid that isn't implemented,
  91. dnl test for this
  92. AC_MSG_CHECKING(if setresgid seems to work)
  93. AC_RUN_IFELSE(
  94. [AC_LANG_SOURCE([[
  95. #include <stdlib.h>
  96. #include <errno.h>
  97. int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
  98. ]])],
  99. [AC_MSG_RESULT(yes)],
  100. [AC_DEFINE(BROKEN_SETRESGID, 1,
  101. [ENOSYS: Not implemented])
  102. AC_MSG_RESULT(not implemented)]
  103. )
  104. ])
  105. fi
  106. AM_CONDITIONAL(USE_PRIVSEP, test "x$USE_PRIVSEP" = "xyes")
  107. AC_ARG_WITH(privsep-user,
  108. AC_HELP_STRING([--with-privsep-user=user],
  109. [Specify privilege separation user]),
  110. privsep_user="$withval",
  111. privsep_user="_x11")
  112. if test "x$USE_PRIVSEP" = "xyes" ; then
  113. AC_DEFINE_UNQUOTED(XCONSOLE_USER, "$privsep_user",
  114. [Unprivileged userid])
  115. fi
  116. AC_SUBST(privsep_user)
  117. AC_CONFIG_FILES([
  118. Makefile
  119. man/Makefile])
  120. AC_OUTPUT