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.
 
 
 
 
 
 

443 lines
14 KiB

  1. # Process this file with autoconf to produce a configure script
  2. AC_PREREQ(2.65)
  3. AC_INIT([xrdp], [0.9.15], [xrdp-devel@googlegroups.com])
  4. AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
  5. AM_INIT_AUTOMAKE([1.7.2 foreign])
  6. AC_CONFIG_MACRO_DIR([m4])
  7. AC_PROG_CC
  8. AC_C_CONST
  9. AC_PROG_LIBTOOL
  10. PKG_PROG_PKG_CONFIG
  11. if test "x$PKG_CONFIG" = "x"; then
  12. AC_MSG_ERROR([please install pkg-config])
  13. fi
  14. AC_CONFIG_SUBDIRS([libpainter librfxcodec])
  15. # Use silent rules by default if supported by Automake
  16. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  17. case $host_os in
  18. *linux*)
  19. linux=yes
  20. ;;
  21. *kfreebsd*)
  22. linux=yes # only used in instfiles/ so that’s ok for us for now
  23. ;;
  24. *freebsd*)
  25. freebsd=yes
  26. ;;
  27. *netbsd*)
  28. netbsd=yes
  29. ;;
  30. *openbsd*)
  31. openbsd=yes
  32. ;;
  33. *darwin*)
  34. macos=yes
  35. ;;
  36. esac
  37. AM_CONDITIONAL(LINUX, [test "x$linux" = xyes])
  38. AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
  39. AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
  40. AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes])
  41. AM_CONDITIONAL(MACOS, [test "x$macos" = xyes])
  42. AC_ARG_WITH([socketdir],
  43. [AS_HELP_STRING([--with-socketdir=DIR],
  44. [Use directory for UNIX sockets (default: /tmp/.xrdp)])],
  45. [], [with_socketdir="/tmp/.xrdp"])
  46. AC_SUBST([socketdir], [$with_socketdir])
  47. AC_ARG_WITH([systemdsystemunitdir],
  48. AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files, no to disable]),
  49. [], [
  50. if test "x$linux" = xyes; then
  51. with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
  52. fi
  53. ])
  54. if test "x$with_systemdsystemunitdir" != xno; then
  55. AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
  56. fi
  57. AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
  58. AC_ARG_ENABLE(pam, AS_HELP_STRING([--enable-pam],
  59. [Build PAM support (default: yes)]),
  60. [], [enable_pam=yes])
  61. AM_CONDITIONAL(SESMAN_NOPAM, [test x$enable_pam != xyes])
  62. AC_ARG_ENABLE(vsock, AS_HELP_STRING([--enable-vsock],
  63. [Build AF_VSOCK support (default: no)]),
  64. [], [enable_vsock=no])
  65. AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6],
  66. [Build IPv6 support (default: no, experimental)]),
  67. [], [enable_ipv6=no])
  68. AC_ARG_ENABLE(ipv6only, AS_HELP_STRING([--enable-ipv6only],
  69. [Build IPv6-only (default: no)]),
  70. [], [enable_ipv6only=no])
  71. AC_ARG_ENABLE(kerberos, AS_HELP_STRING([--enable-kerberos],
  72. [Build kerberos support (prefer --enable-pam if available) (default: no)]),
  73. [], [enable_kerberos=no])
  74. AC_ARG_ENABLE(bsd, AS_HELP_STRING([--enable-bsd],
  75. [Build BSD auth support (default: no)]),
  76. [bsd=true], [bsd=false])
  77. AM_CONDITIONAL(SESMAN_BSD, [test x$bsd = xtrue])
  78. AM_CONDITIONAL(SESMAN_KERBEROS, [test x$enable_kerberos = xyes])
  79. AC_ARG_ENABLE(pamuserpass, AS_HELP_STRING([--enable-pamuserpass],
  80. [Build PAM userpass support (default: no)]),
  81. [], [enable_pamuserpass=no])
  82. AM_CONDITIONAL(SESMAN_PAMUSERPASS, [test x$enable_pamuserpass = xyes])
  83. AC_ARG_ENABLE(pam-config, AS_HELP_STRING([--enable-pam-config=CONF],
  84. [Select PAM config to install: arch, debian, redhat, suse, freebsd, macos, unix
  85. (default: autodetect)]))
  86. AC_ARG_ENABLE(xrdpdebug, AS_HELP_STRING([--enable-xrdpdebug],
  87. [Build debug (default: no)]),
  88. [], [enable_xrdpdebug=no])
  89. AM_CONDITIONAL(XRDP_DEBUG, [test x$enable_xrdpdebug = xyes])
  90. AC_ARG_ENABLE(neutrinordp, AS_HELP_STRING([--enable-neutrinordp],
  91. [Build neutrinordp module (default: no)]),
  92. [], [enable_neutrinordp=no])
  93. AM_CONDITIONAL(XRDP_NEUTRINORDP, [test x$enable_neutrinordp = xyes])
  94. AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--enable-jpeg],
  95. [Build jpeg module (default: no)]),
  96. [], [enable_jpeg=no])
  97. AM_CONDITIONAL(XRDP_JPEG, [test x$enable_jpeg = xyes])
  98. AC_ARG_ENABLE(tjpeg, AS_HELP_STRING([--enable-tjpeg],
  99. [Build turbo jpeg module (default: no)]),
  100. [], [enable_tjpeg=no])
  101. AM_CONDITIONAL(XRDP_TJPEG, [test x$enable_tjpeg = xyes])
  102. AC_ARG_ENABLE(fuse, AS_HELP_STRING([--enable-fuse],
  103. [Build fuse(clipboard file / drive redir) (default: no)]),
  104. [], [enable_fuse=no])
  105. AM_CONDITIONAL(XRDP_FUSE, [test x$enable_fuse = xyes])
  106. AC_ARG_ENABLE(xrdpvr, AS_HELP_STRING([--enable-xrdpvr],
  107. [Build xrdpvr module (default: no)]),
  108. [], [enable_xrdpvr=no])
  109. AM_CONDITIONAL(XRDP_XRDPVR, [test x$enable_xrdpvr = xyes])
  110. AC_ARG_ENABLE(fdkaac, AS_HELP_STRING([--enable-fdkaac],
  111. [Build aac(audio codec) (default: no)]),
  112. [], [enable_fdkaac=no])
  113. AM_CONDITIONAL(XRDP_FDK_AAC, [test x$enable_fdkaac = xyes])
  114. AC_ARG_ENABLE(opus, AS_HELP_STRING([--enable-opus],
  115. [Build opus(audio codec) (default: no)]),
  116. [], [enable_opus=no])
  117. AM_CONDITIONAL(XRDP_OPUS, [test x$enable_opus = xyes])
  118. AC_ARG_ENABLE(mp3lame, AS_HELP_STRING([--enable-mp3lame],
  119. [Build lame mp3(audio codec) (default: no)]),
  120. [], [enable_mp3lame=no])
  121. AM_CONDITIONAL(XRDP_MP3LAME, [test x$enable_mp3lame = xyes])
  122. AC_ARG_ENABLE(pixman, AS_HELP_STRING([--enable-pixman],
  123. [Use pixman library (default: no)]),
  124. [], [enable_pixman=no])
  125. AM_CONDITIONAL(XRDP_PIXMAN, [test x$enable_pixman = xyes])
  126. AC_ARG_ENABLE(painter, AS_HELP_STRING([--disable-painter],
  127. [Do not use included painter library (default: no)]),
  128. [], [enable_painter=yes])
  129. AM_CONDITIONAL(XRDP_PAINTER, [test x$enable_painter = xyes])
  130. AC_ARG_ENABLE(rfxcodec, AS_HELP_STRING([--disable-rfxcodec],
  131. [Do not use included librfxcodec library (default: no)]),
  132. [], [enable_rfxcodec=yes])
  133. AM_CONDITIONAL(XRDP_RFXCODEC, [test x$enable_rfxcodec = xyes])
  134. AC_ARG_ENABLE(rdpsndaudin, AS_HELP_STRING([--enable-rdpsndaudin],
  135. [Use rdpsnd audio in (default: no)]),
  136. [], [enable_rdpsndaudin=no])
  137. AM_CONDITIONAL(XRDP_RDPSNDAUDIN, [test x$enable_rdpsndaudin = xyes])
  138. # configure compiler options and CFLAGS
  139. AX_GCC_FUNC_ATTRIBUTE([format])
  140. AX_TYPE_SOCKLEN_T
  141. AX_CFLAGS_WARN_ALL
  142. AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
  143. AM_COND_IF([LINUX],
  144. [AX_APPEND_COMPILE_FLAGS([-Werror])]) # bsd has warnings that have not been fixed yet
  145. AM_COND_IF([XRDP_DEBUG],
  146. [AX_APPEND_COMPILE_FLAGS([-g -O0])],
  147. [AX_APPEND_COMPILE_FLAGS([-O2])])
  148. # Don't fail without working nasm if rfxcodec is not enabled
  149. if test "x$enable_rfxcodec" != xyes; then
  150. with_simd=no
  151. export with_simd
  152. fi
  153. # Check if -ldl is needed to use dlopen()
  154. DLOPEN_LIBS=
  155. AC_CHECK_FUNC(dlopen, [],
  156. [AC_CHECK_LIB(dl, dlopen, [DLOPEN_LIBS=-ldl])])
  157. AC_SUBST(DLOPEN_LIBS)
  158. # checking for openssl
  159. PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8], [],
  160. [AC_MSG_ERROR([please install libssl-dev or openssl-devel])])
  161. # look for openssl binary
  162. OPENSSL_BIN=`$PKG_CONFIG --variable=exec_prefix openssl`/bin
  163. AC_PATH_PROGS([OPENSSL], [openssl], [:], [$OPENSSL_BIN:$PATH])
  164. # checking for PAM variation
  165. # Linux-PAM is used in Linux systems
  166. # OpenPAM is used by FreeBSD, NetBSD, DragonFly BSD and OS X
  167. # OpenBSD uses BSD Authentication rather than both PAMs
  168. AC_CHECK_HEADER([security/_pam_types.h],
  169. [AC_DEFINE([HAVE__PAM_TYPES_H], 1, [Using Linux-PAM], [])])
  170. AC_CHECK_HEADER([security/pam_constants.h],
  171. [AC_DEFINE([HAVE_PAM_CONSTANTS_H], 1, [Using OpenPAM], [])])
  172. # Check only one auth mechanism is specified, and give it a name
  173. auth_cnt=0
  174. auth_mech="Builtin"
  175. if test x$enable_pam = xyes
  176. then
  177. auth_cnt=`expr $auth_cnt + 1`
  178. auth_mech="PAM"
  179. fi
  180. if test x$bsd = xtrue
  181. then
  182. auth_cnt=`expr $auth_cnt + 1`
  183. auth_mech="BSD"
  184. fi
  185. if test x$enable_kerberos = xyes
  186. then
  187. auth_cnt=`expr $auth_cnt + 1`
  188. auth_mech="Kerberos"
  189. fi
  190. if test x$enable_pamuserpass = xyes
  191. then
  192. auth_cnt=`expr $auth_cnt + 1`
  193. auth_mech="PAM userpass"
  194. fi
  195. if test $auth_cnt -gt 1
  196. then
  197. AC_MSG_ERROR([--enable-pam, --enable-bsd, --enable-pamuserpass and --enable-kerberos are mutually exclusive])
  198. fi
  199. # checking if pam should be autodetected.
  200. if test "x$enable_pam" = "xyes"
  201. then
  202. if test -z "$enable_bsd"
  203. then
  204. AC_CHECK_HEADER([security/pam_appl.h], [],
  205. [AC_MSG_ERROR([please install libpam0g-dev or pam-devel])])
  206. fi
  207. if test "x$enable_pam_config" = "x"; then
  208. PAM_RULES="auto"
  209. else
  210. pam_config_file="$srcdir/instfiles/pam.d/xrdp-sesman.$enable_pam_config"
  211. if test -f "$pam_config_file"; then
  212. PAM_RULES="$enable_pam_config"
  213. else
  214. AC_MSG_ERROR([PAM file "$pam_config_file" is not available])
  215. fi
  216. fi
  217. fi
  218. AC_SUBST(PAM_RULES)
  219. if test "x$enable_vsock" = "xyes"
  220. then
  221. enable_vsock=yes
  222. AC_CHECK_HEADERS([linux/socket.h linux/vm_sockets.h],
  223. [AC_DEFINE([XRDP_ENABLE_VSOCK], 1, [Enable AF_VSOCK])],
  224. [],
  225. [#include <sys/socket.h>])
  226. fi
  227. if test "x$enable_ipv6only" = "xyes"
  228. then
  229. enable_ipv6=yes
  230. AC_DEFINE([XRDP_ENABLE_IPV6ONLY],1,[Enable IPv6 only])
  231. fi
  232. if test "x$enable_ipv6" = "xyes"
  233. then
  234. AC_DEFINE([XRDP_ENABLE_IPV6],1,[Enable IPv6])
  235. fi
  236. if test "x$enable_pam" != "xyes"
  237. then
  238. AC_DEFINE([USE_NOPAM],1,[Disable PAM])
  239. fi
  240. AS_IF( [test "x$enable_neutrinordp" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
  241. # checking for libjpeg
  242. if test "x$enable_jpeg" = "xyes"
  243. then
  244. AC_CHECK_HEADER([jpeglib.h], [],
  245. [AC_MSG_ERROR([please install libjpeg-dev or libjpeg-devel])])
  246. fi
  247. # checking for fuse
  248. if test "x$enable_fuse" = "xyes"
  249. then
  250. PKG_CHECK_MODULES([FUSE], [fuse >= 2.6], [],
  251. [AC_MSG_ERROR([please install libfuse-dev or fuse-devel])])
  252. fi
  253. # checking for fdk aac
  254. if test "x$enable_fdkaac" = "xyes"
  255. then
  256. PKG_CHECK_MODULES([FDKAAC], [fdk-aac >= 0.1.0], [],
  257. [AC_MSG_ERROR([please install libfdk-aac-dev or fdk-aac-devel])])
  258. fi
  259. # checking for opus
  260. if test "x$enable_opus" = "xyes"
  261. then
  262. AC_CHECK_HEADER([opus/opus.h], [],
  263. [AC_MSG_ERROR([please install libopus-dev or opus-devel])])
  264. fi
  265. # checking for lame mp3
  266. if test "x$enable_mp3lame" = "xyes"
  267. then
  268. AC_CHECK_HEADER([lame/lame.h], [],
  269. [AC_MSG_ERROR([please install libmp3lame-dev or lamemp3-devel])])
  270. fi
  271. AS_IF( [test "x$enable_pixman" = "xyes"] , [PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.1.0)] )
  272. # checking for TurboJPEG
  273. if test "x$enable_tjpeg" = "xyes"
  274. then
  275. if test ! -z "$TURBOJPEG_PATH"
  276. then
  277. # env var TURBOJPEG_PATH has been defined, use that
  278. AC_CHECK_HEADER([$TURBOJPEG_PATH/include/turbojpeg.h], [],
  279. [AC_MSG_ERROR([could not find TurboJPEG in dir specified by env variable TURBOJPEG_PATH ($TURBOJPEG_PATH)])])
  280. AC_SUBST(TurboJpegIncDir, ["-I$TURBOJPEG_PATH/include"])
  281. AC_SUBST(TurboJpegLibDir, ["-L$TURBOJPEG_PATH/lib -Wl,-rpath -Wl,$TURBOJPEG_PATH/lib"])
  282. elif test -e /opt/libjpeg-turbo/lib64
  283. then
  284. # TurboJPEG has been installed to /opt on a 64 bit m/c
  285. AC_SUBST(TurboJpegIncDir, ["-I/opt/libjpeg-turbo/include"])
  286. AC_SUBST(TurboJpegLibDir, ["-L/opt/libjpeg-turbo/lib64 -Wl,-rpath -Wl,/opt/libjpeg-turbo/lib64"])
  287. elif test -e /opt/libjpeg-turbo/lib32
  288. then
  289. # TurboJPEG has been installed to /opt on a 32 bit m/c
  290. AC_SUBST(TurboJpegIncDir, ["-I/opt/libjpeg-turbo/include"])
  291. AC_SUBST(TurboJpegLibDir, ["-L/opt/libjpeg-turbo/lib32 -Wl,-rpath -Wl,/opt/libjpeg-turbo/lib32"])
  292. else
  293. # check in default location
  294. AC_CHECK_HEADER([/usr/include/turbojpeg.h], [],
  295. [AC_MSG_ERROR([please install TurboJPEG ])])
  296. AC_SUBST(TurboJpegIncDir, [""])
  297. AC_SUBST(TurboJpegLibDir, [""])
  298. fi
  299. fi
  300. AC_PATH_XTRA
  301. if test "x$no_x" == "xyes"; then
  302. AC_MSG_ERROR([please install libx11-dev or libX11-devel])
  303. fi
  304. save_CFLAGS="$CFLAGS"
  305. CFLAGS="$CFLAGS $X_CFLAGS"
  306. # checking for Xfixes
  307. AC_CHECK_HEADER([X11/extensions/Xfixes.h], [],
  308. [AC_MSG_ERROR([please install libxfixes-dev or libXfixes-devel])],
  309. [#include <X11/Xlib.h>])
  310. # checking for Xrandr
  311. AC_CHECK_HEADER([X11/extensions/Xrandr.h], [],
  312. [AC_MSG_ERROR([please install libxrandr-dev or libXrandr-devel])],
  313. [#include <X11/Xlib.h>])
  314. CFLAGS="$save_CFLAGS"
  315. AC_SUBST([moduledir], '${libdir}/xrdp')
  316. AC_ARG_ENABLE([strict-locations],
  317. [AS_HELP_STRING([--enable-strict-locations],
  318. [Use standard Autoconf install directories unless overridden
  319. (default: use /etc and /var)])],
  320. [], [enable_strict_locations=no])
  321. if test "x$enable_strict_locations" != "xyes"; then
  322. sysconfdir="/etc";
  323. localstatedir="/var";
  324. fi
  325. PKG_INSTALLDIR
  326. AC_CHECK_HEADERS([sys/prctl.h])
  327. AC_CONFIG_FILES([
  328. common/Makefile
  329. docs/Makefile
  330. docs/man/Makefile
  331. genkeymap/Makefile
  332. instfiles/default/Makefile
  333. instfiles/init.d/Makefile
  334. instfiles/Makefile
  335. instfiles/pam.d/Makefile
  336. instfiles/pulse/Makefile
  337. instfiles/rc.d/Makefile
  338. keygen/Makefile
  339. libxrdp/Makefile
  340. Makefile
  341. mc/Makefile
  342. neutrinordp/Makefile
  343. pkgconfig/Makefile
  344. pkgconfig/xrdp.pc
  345. pkgconfig/xrdp-uninstalled.pc
  346. sesman/chansrv/Makefile
  347. sesman/libscp/Makefile
  348. sesman/Makefile
  349. sesman/tools/Makefile
  350. vnc/Makefile
  351. xrdpapi/Makefile
  352. xrdp/Makefile
  353. xrdpvr/Makefile
  354. xup/Makefile
  355. ])
  356. AC_OUTPUT
  357. echo ""
  358. echo "xrdp will be compiled with:"
  359. echo ""
  360. echo " mp3lame $enable_mp3lame"
  361. echo " opus $enable_opus"
  362. echo " fdkaac $enable_fdkaac"
  363. echo " jpeg $enable_jpeg"
  364. echo " turbo jpeg $enable_tjpeg"
  365. echo " rfxcodec $enable_rfxcodec"
  366. echo " painter $enable_painter"
  367. echo " pixman $enable_pixman"
  368. echo " fuse $enable_fuse"
  369. echo " ipv6 $enable_ipv6"
  370. echo " ipv6only $enable_ipv6only"
  371. echo " vsock $enable_vsock"
  372. echo " auth mechanism $auth_mech"
  373. echo " debug $enable_xrdpdebug"
  374. echo " rdpsndaudin $enable_rdpsndaudin"
  375. echo ""
  376. echo " strict_locations $enable_strict_locations"
  377. echo " prefix $prefix"
  378. echo " exec_prefix $exec_prefix"
  379. echo " libdir $libdir"
  380. echo " bindir $bindir"
  381. echo " sysconfdir $sysconfdir"
  382. echo ""
  383. echo " CFLAGS = $CFLAGS"
  384. echo " LDFLAGS = $LDFLAGS"
  385. # xrdp_configure_options.h will be written to the build directory, not the source directory
  386. echo '#define XRDP_CONFIGURE_OPTIONS \' > ./xrdp_configure_options.h
  387. ./config.status --config | xargs -n 1 | sed -e 's/^/" /' -e 's/$/\\n" \\/' >> ./xrdp_configure_options.h
  388. echo '""' >> ./xrdp_configure_options.h