configure.ac 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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([xinit], [1.3.4],
  25. [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xinit])
  26. AC_CONFIG_SRCDIR([Makefile.am])
  27. AC_CONFIG_HEADERS([config.h])
  28. # Initialize Automake
  29. AM_INIT_AUTOMAKE([foreign dist-bzip2])
  30. AM_MAINTAINER_MODE
  31. # Require X.Org macros 1.19 or later for TRADITIONALCPPFLAGS
  32. m4_ifndef([XORG_MACROS_VERSION],
  33. [m4_fatal([must install xorg-macros 1.19 or later before running autoconf/autogen])])
  34. XORG_MACROS_VERSION(1.19)
  35. XORG_DEFAULT_OPTIONS
  36. XORG_PROG_RAWCPP
  37. AC_CANONICAL_HOST
  38. # Build options
  39. DEFAULT_XRDB=xrdb
  40. DEFAULT_XMODMAP=xmodmap
  41. DEFAULT_TWM=twm
  42. DEFAULT_XCLOCK=xclock
  43. DEFAULT_XTERM=xterm
  44. # You always want to specify the full path to the X server
  45. DEFAULT_XSERVER=${bindir}/X
  46. DEFAULT_XAUTH=xauth
  47. DEFAULT_XINIT=xinit
  48. DEFAULT_XINITDIR=${sysconfdir}/X11/xinit
  49. DEFAULT_WM=fvwm
  50. DEFAULT_XCONSOLE=xconsole
  51. AC_ARG_WITH(xrdb,
  52. AS_HELP_STRING([--with-xrdb=XRDB], [Path to xrdb]),
  53. [XRDB="$withval"],
  54. [XRDB="$DEFAULT_XRDB"])
  55. AC_ARG_WITH(xmodmap,
  56. AS_HELP_STRING([--with-xmodmap=XMODMAP], [Path to xmodmap]),
  57. [XMODMAP="$withval"],
  58. [XMODMAP="$DEFAULT_XMODMAP"])
  59. AC_ARG_WITH(twm,
  60. AS_HELP_STRING([--with-twm=TWM], [Path to twm]),
  61. [TWM="$withval"],
  62. [TWM="$DEFAULT_TWM"])
  63. AC_ARG_WITH(xclock,
  64. AS_HELP_STRING([--with-xclock=XCLOCK], [Path to xclock]),
  65. [XCLOCK="$withval"],
  66. [XCLOCK="$DEFAULT_XCLOCK"])
  67. AC_ARG_WITH(xterm,
  68. AS_HELP_STRING([--with-xterm=XTERM], [Path to xterm]),
  69. [XTERM="$withval"],
  70. [XTERM="$DEFAULT_XTERM"])
  71. AC_ARG_WITH(xserver,
  72. AS_HELP_STRING([--with-xserver=XSERVER], [Path to default X server]),
  73. [XSERVER="$withval"],
  74. [XSERVER="$DEFAULT_XSERVER"])
  75. AC_ARG_WITH(xauth,
  76. AS_HELP_STRING([--with-xauth=XAUTH], [Path to xauth]),
  77. [XAUTH="$withval"],
  78. [XAUTH="$DEFAULT_XAUTH"])
  79. AC_ARG_WITH(xinit,
  80. AS_HELP_STRING([--with-xinit=XINIT], [Path to xinit]),
  81. [XINIT="$withval"],
  82. [XINIT="$DEFAULT_XINIT"])
  83. AC_ARG_WITH(xinitdir,
  84. AS_HELP_STRING([--with-xinitdir=XINITDIR], [Path to xinitdir]),
  85. [XINITDIR="$withval"],
  86. [XINITDIR="$DEFAULT_XINITDIR"])
  87. AC_ARG_WITH(wm,
  88. AS_HELP_STRING([--with-wm=WM], [Path to default window manager]),
  89. [WM="$withval"],
  90. [WM="$DEFAULT_WM"])
  91. AC_ARG_WITH(xconsole,
  92. AS_HELP_STRING([--with-xconsole=XCONSOLE], [Path to xconsole]),
  93. [XCONSOLE="$withval"],
  94. [XCONSOLE="$DEFAULT_XCONSOLE"])
  95. AC_ARG_WITH(launchd, AS_HELP_STRING([--with-launchd], [Build with support for Apple's launchd (default: auto)]), [LAUNCHD=$withval], [LAUNCHD=auto])
  96. AC_ARG_WITH(launchagents-dir, AS_HELP_STRING([--with-launchagents-dir=PATH], [Path to launchd's LaunchAgents directory (default: /Library/LaunchAgents)]),
  97. [ launchagentsdir="${withval}" ],
  98. [ launchagentsdir="/Library/LaunchAgents" ])
  99. AC_ARG_WITH(launchagent-xserver, AS_HELP_STRING([--with-launchagent-xserver=PATH], [Path to the X server which the LaunchAgent should start (if not provided, let startx decide)"]),
  100. [ launchagentxserver="${withval}" ],
  101. [ launchagentxserver="no" ])
  102. AC_ARG_WITH(launchdaemons-dir, AS_HELP_STRING([--with-launchdaemons-dir=PATH], [Path to launchd's LaunchDaemonss directory (default: /Library/LaunchDaemons)]),
  103. [ launchdaemonsdir="${withval}" ],
  104. [ launchdaemonsdir="/Library/LaunchDaemons" ])
  105. AC_ARG_WITH(launchd-id-prefix, AS_HELP_STRING([--with-launchd-id-prefix=PATH], [Deprecated: Use --with-bundle-id-prefix.]),
  106. [ bundleidprefix="${withval}" ],
  107. [ bundleidprefix="org.x" ])
  108. AC_ARG_WITH(bundle-id-prefix, AS_HELP_STRING([--with-bundle-id-prefix=PATH], [Prefix to use for bundle identifiers (default: org.x)]),
  109. [ bundleidprefix="${withval}" ])
  110. if test "x$LAUNCHD" = "xauto"; then
  111. unset LAUNCHD
  112. AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
  113. fi
  114. TIGER_LAUNCHD=no
  115. if test "x$LAUNCHD" = "xyes" ; then
  116. AC_DEFINE(HAVE_LAUNCHD, 1, [launchd support available])
  117. case $host_os in
  118. darwin8*)
  119. TIGER_LAUNCHD=yes
  120. ;;
  121. esac
  122. AC_CHECK_FUNC(dispatch_async,
  123. AC_DEFINE([HAVE_LIBDISPATCH], 1, [Define to 1 if you have the libdispatch (GCD) available]),
  124. [])
  125. fi
  126. AC_DEFINE_UNQUOTED(BUNDLE_ID_PREFIX, "$bundleidprefix", [Prefix to use for launchd identifiers])
  127. AC_SUBST([launchagentsdir])
  128. AC_SUBST([launchdaemonsdir])
  129. AC_SUBST([bundleidprefix])
  130. AC_SUBST([launchagentxserver])
  131. AM_CONDITIONAL(LAUNCHD, [test "x$LAUNCHD" = "xyes"])
  132. AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
  133. AM_CONDITIONAL(LAUNCHAGENT_XSERVER, [test "x$launchagentxserver" != "xno"])
  134. # Checks for pkg-config packages
  135. PKG_CHECK_MODULES(XINIT, x11 xproto >= 7.0.17)
  136. case $host_os in
  137. *bsd*)
  138. XINIT_CFLAGS="$XINIT_CFLAGS -DCSRG_BASED"
  139. ;;
  140. esac
  141. AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
  142. [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
  143. # If mcookie not found, try openssl, else per-system fallbacks
  144. if test "x$MCOOKIE" = x ; then
  145. AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
  146. [$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
  147. if test "x$OPENSSL" != x ; then
  148. MCOOKIE="$OPENSSL rand -hex 16"
  149. else
  150. case $host_os in
  151. *solaris*)
  152. MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
  153. ;;
  154. esac
  155. fi
  156. fi
  157. if test "x$MCOOKIE" != x ; then
  158. STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
  159. AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
  160. fi
  161. AC_SUBST(STARTX_COOKIE_FLAGS)
  162. # Additional substitutions in startx, xinitrc & man pages
  163. SHELL_CMD="/bin/sh"
  164. XSERVERNAME="Xorg"
  165. XCONFIGFILE="xorg.conf"
  166. XCONFIGFILEMAN='${XCONFIGFILE} (${FILE_MAN_SUFFIX})'
  167. case $host_os in
  168. cygwin*)
  169. XSERVERNAME="XWin"
  170. XCONFIGFILE="XWinrc"
  171. ;;
  172. darwin*)
  173. XSERVERNAME="Xquartz"
  174. XCONFIGFILE="defaults"
  175. XCONFIGFILEMAN='defaults (1)'
  176. ;;
  177. *solaris*)
  178. SHELL_CMD="/bin/ksh"
  179. ;;
  180. *sco*)
  181. SHELL_CMD="/bin/ksh"
  182. SCOMAN=1
  183. ;;
  184. esac
  185. AC_SUBST(SHELL_CMD)
  186. AC_SUBST(SCOMAN)
  187. AC_SUBST(XSERVERNAME)
  188. AC_SUBST(XCONFIGFILE)
  189. AC_SUBST(XCONFIGFILEMAN)
  190. AC_SUBST(XRDB)
  191. AC_SUBST(XMODMAP)
  192. AC_SUBST(TWM)
  193. AC_SUBST(XCLOCK)
  194. AC_SUBST(XTERM)
  195. AC_SUBST(XSERVER)
  196. AC_SUBST(XAUTH)
  197. AC_SUBST(XINIT)
  198. AC_SUBST(XINITDIR)
  199. AC_SUBST(WM)
  200. AC_SUBST(XCONSOLE)
  201. AC_CONFIG_FILES([Makefile
  202. man/Makefile
  203. launchd/Makefile
  204. launchd/privileged_startx/Makefile
  205. launchd/user_startx/Makefile])
  206. AC_OUTPUT