configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. dnl
  2. dnl Configure.in file for the Midnight Commander
  3. dnl
  4. AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
  5. AC_PREREQ(2.60)
  6. m4_pattern_forbid(MC_)
  7. AC_CONFIG_MACRO_DIR([m4])
  8. AC_CONFIG_SRCDIR(src/main.c)
  9. AC_CONFIG_AUX_DIR(config)
  10. MC_VERSION
  11. AM_INIT_AUTOMAKE(mc, ${VERSION} )
  12. LIBMC_VERSION="0.0.1"
  13. LIBMC_RELEASE="1"
  14. AC_SUBST(LIBMC_VERSION)
  15. AC_SUBST(LIBMC_RELEASE)
  16. dnl Enable silent rules by default (if yes)
  17. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  18. AM_CONFIG_HEADER(config.h)
  19. AM_MAINTAINER_MODE
  20. AC_CANONICAL_HOST
  21. AC_USE_SYSTEM_EXTENSIONS
  22. AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS],["$ac_configure_args"],[MC configure arguments])
  23. AC_PROG_LIBTOOL
  24. PKG_PROG_PKG_CONFIG
  25. AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
  26. AC_ISC_POSIX
  27. AC_PROG_CC_STDC
  28. AM_PROG_CC_C_O
  29. dnl Doxygen
  30. DX_HTML_FEATURE(ON)
  31. DX_CHM_FEATURE(OFF)
  32. DX_CHI_FEATURE(OFF)
  33. DX_MAN_FEATURE(OFF)
  34. DX_RTF_FEATURE(OFF)
  35. DX_XML_FEATURE(OFF)
  36. DX_PDF_FEATURE(OFF)
  37. DX_PS_FEATURE(OFF)
  38. DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
  39. dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
  40. AC_CHECK_GLIB
  41. AC_ARG_ENABLE([mclib],
  42. [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
  43. [
  44. if test "x$enableval" = "xno" ; then
  45. enable_mclib=no
  46. else
  47. if test "x$enable_shared" = "xno" ; then
  48. AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
  49. enable_mclib=no
  50. else
  51. enable_mclib=yes
  52. fi
  53. fi
  54. ],
  55. [enable_mclib=no])
  56. AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
  57. AC_HEADER_MAJOR
  58. AC_C_CONST
  59. dnl Check this before type sizeof checks
  60. AC_SYS_LARGEFILE
  61. AC_PROG_LN_S
  62. AC_CHECK_TOOL(AR, ar, ar)
  63. dnl Only list browsers here that can be run in background (i.e. with `&')
  64. AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
  65. dnl
  66. dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
  67. dnl We use only part of the functionality of mmap, so on AIX,
  68. dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
  69. dnl
  70. AC_ARG_WITH(mmap,
  71. [ --with-mmap Use the mmap call [[yes if found]]])
  72. if test x$with_mmap != xno; then
  73. if test x$with_mmap = x; then
  74. AC_FUNC_MMAP
  75. else
  76. AC_DEFINE(HAVE_MMAP, 1)
  77. fi
  78. fi
  79. dnl
  80. dnl Internationalization
  81. dnl
  82. AM_GNU_GETTEXT(no-libtool, need-ngettext)
  83. AM_GNU_GETTEXT_VERSION(0.14.3)
  84. if test "x$USE_INCLUDED_LIBINTL" = xyes; then
  85. CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
  86. fi
  87. dnl Determine which help translations we want to install.
  88. ALL_DOC_LINGUAS="es hu it pl ru sr"
  89. DOC_LINGUAS=
  90. if test "x$USE_NLS" = xyes; then
  91. if test -z "$LINGUAS"; then
  92. langs="`grep -v '^#' $srcdir/po/LINGUAS`"
  93. else
  94. langs="$LINGUAS"
  95. fi
  96. else
  97. langs=
  98. fi
  99. for h_lang in $ALL_DOC_LINGUAS; do
  100. for lang in $langs; do
  101. if test "$lang" = "$h_lang"; then
  102. DOC_LINGUAS="$DOC_LINGUAS $lang"
  103. break
  104. fi
  105. done
  106. done
  107. AC_SUBST(DOC_LINGUAS)
  108. dnl
  109. dnl OS specific flags.
  110. dnl
  111. case $host_os in
  112. aux*)
  113. # A/UX
  114. LIBS="$LIBS -lposix"
  115. AC_DEFINE(_POSIX_SOURCE)
  116. ;;
  117. esac
  118. AC_PROG_INSTALL
  119. AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
  120. utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
  121. sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
  122. sys/socket.h sys/sysmacros.h sys/types.h sys/mkdev.h])
  123. AC_HEADER_TIME
  124. AC_HEADER_DIRENT
  125. AC_HEADER_ASSERT
  126. dnl Missing structure components
  127. AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
  128. AC_STRUCT_ST_BLOCKS
  129. dnl
  130. dnl Check availability of some functions
  131. dnl
  132. AC_CHECK_FUNCS([\
  133. atoll \
  134. isascii \
  135. statfs sysconf \
  136. tcgetattr tcsetattr \
  137. ftruncate \
  138. strverscmp \
  139. strncasecmp \
  140. realpath
  141. ])
  142. dnl
  143. dnl getpt is a GNU Extension (glibc 2.1.x)
  144. dnl
  145. AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
  146. AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
  147. dnl replacing lstat with statlstat on sco makes it more portable between
  148. dnl sco clones
  149. AC_CHECK_FUNCS(statlstat)
  150. dnl
  151. dnl If running under AIX, AC_AIX does not tell us that
  152. dnl
  153. AC_MSG_CHECKING([for AIX defines])
  154. AC_EGREP_CPP(yes,
  155. [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
  156. yes
  157. #endif
  158. ], [
  159. AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
  160. AC_MSG_RESULT(yes)
  161. ], [AC_MSG_RESULT(no)])
  162. dnl
  163. dnl Missing typedefs and replacements
  164. dnl
  165. AC_CHECK_SIZEOF(long)
  166. AC_TYPE_UINTMAX_T
  167. AC_CHECK_SIZEOF(uintmax_t)
  168. AC_TYPE_OFF_T
  169. AC_CHECK_SIZEOF(off_t)
  170. AC_TYPE_MODE_T
  171. AC_TYPE_PID_T
  172. AC_TYPE_UID_T
  173. AC_FUNC_STRCOLL
  174. AC_MC_GET_FS_INFO
  175. dnl
  176. dnl X11 support.
  177. dnl Used to read keyboard modifiers when running under X11.
  178. AC_PATH_XTRA
  179. dnl
  180. dnl Check if the gmodule functionality supported on this system.
  181. AC_G_MODULE_SUPPORTED
  182. dnl
  183. dnl Sequent wants getprocessstats
  184. dnl
  185. AC_CHECK_LIB(seq, get_process_stats, [
  186. LIBS="$LIBS -lseq"
  187. AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
  188. [Define if you have function `get_process_stats' and
  189. have to use that instead of gettimeofday])])
  190. AC_MC_VFS_CHECKS
  191. dnl
  192. dnl Check for gpm mouse support (Linux only)
  193. dnl
  194. mouse_lib="xterm only"
  195. AC_ARG_WITH(gpm-mouse,
  196. [ --with-gpm-mouse Compile with gpm mouse support (Linux only)
  197. [[yes if found]]])
  198. case $host_os in
  199. linux*)
  200. if test x$with_gpm_mouse != xno; then
  201. AC_CHECK_LIB(gpm, Gpm_Repeat,
  202. [AC_DEFINE(HAVE_LIBGPM, 1,
  203. [Define to enable gpm mouse support on Linux])
  204. mouse_lib="gpm and xterm"
  205. MCLIBS="$MCLIBS -lgpm"],
  206. if test "x$with_gpm_mouse" = "xyes"; then
  207. [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
  208. else
  209. [AC_MSG_WARN([libgpm is missing or older than 0.18])]
  210. fi
  211. )
  212. fi
  213. ;;
  214. esac
  215. MC_CHECK_SEARCH_TYPE
  216. dnl
  217. dnl Check nroff and the options it supports
  218. dnl
  219. AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
  220. dnl Default values
  221. MANDOC=-man
  222. MAN_FLAGS=
  223. if $HAVE_nroff; then
  224. AC_MSG_CHECKING([for manual formatting macros])
  225. AC_CACHE_VAL(mc_cv_mandoc, [
  226. nroff -mandoc < /dev/null > /dev/null 2>&1
  227. if test $? = 0; then
  228. mc_cv_mandoc=-mandoc
  229. else
  230. mc_cv_mandoc=-man
  231. fi
  232. ])
  233. MANDOC=$mc_cv_mandoc
  234. AC_MSG_RESULT([$MANDOC])
  235. AC_MSG_CHECKING([for option to disable ANSI color in manuals])
  236. AC_CACHE_VAL(mc_cv_man_nocolor, [
  237. nroff -c < /dev/null > /dev/null 2>&1
  238. if test $? = 0; then
  239. mc_cv_man_nocolor=-c
  240. else
  241. mc_cv_man_nocolor=
  242. fi
  243. ])
  244. MAN_FLAGS=$mc_cv_man_nocolor
  245. AC_MSG_RESULT([${MAN_NOCOLOR-none}])
  246. AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
  247. AC_CACHE_VAL(mc_cv_nroff_tascii, [
  248. mc_cv_nroff_tascii=
  249. nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
  250. if test $? = 0; then
  251. mc_cv_nroff_tascii=-Tlatin1
  252. else
  253. nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
  254. if test $? = 0; then
  255. mc_cv_nroff_tascii=-Tascii
  256. fi
  257. fi
  258. ])
  259. AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
  260. MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
  261. fi
  262. AC_SUBST(MANDOC)
  263. AC_SUBST(MAN_FLAGS)
  264. dnl
  265. dnl Check for -L option to file
  266. dnl
  267. AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
  268. if $HAVE_FILECMD; then
  269. AC_MSG_CHECKING([for -L option to file command])
  270. AC_CACHE_VAL(mc_cv_filel, [
  271. file -L . > /dev/null 2>&1
  272. if test $? = 0; then
  273. mc_cv_filel=yes
  274. else
  275. mc_cv_filel=no
  276. fi
  277. ])
  278. if test x$mc_cv_filel = xyes; then
  279. AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
  280. fi
  281. filel=$mc_cv_filel
  282. AC_MSG_RESULT([$filel])
  283. fi
  284. AC_MSG_CHECKING([for subshell support])
  285. AC_ARG_WITH(subshell,
  286. [ --with-subshell Compile in concurrent subshell [[yes]]
  287. --with-subshell=optional Don't run concurrent shell by default [[no]]],
  288. [result=no
  289. if test x$withval = xoptional
  290. then
  291. AC_DEFINE(SUBSHELL_OPTIONAL, 1,
  292. [Define to make subshell support optional])
  293. result="optional"
  294. fi
  295. if test x$withval = xyes
  296. then
  297. result="yes"
  298. fi],
  299. [dnl Default: enable the subshell support
  300. result="yes"
  301. ])
  302. if test "x$result" != xno; then
  303. AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
  304. [Define to enable subshell support])
  305. fi
  306. AC_MSG_RESULT([$result])
  307. subshell="$result"
  308. MC_WITH_SCREEN
  309. dnl
  310. dnl Internal editor support.
  311. dnl
  312. AC_ARG_WITH(edit,
  313. [ --with-edit Enable internal editor [[yes]]])
  314. if test x$with_edit != xno; then
  315. AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
  316. use_edit=yes
  317. edit_msg="yes"
  318. AC_MSG_NOTICE([using internal editor])
  319. else
  320. edit_msg="no"
  321. fi
  322. dnl
  323. dnl Diff viewer support.
  324. dnl
  325. AC_ARG_WITH(diff_viewer,
  326. [ --with-diff-viewer Compile with diff viewer [[yes]]])
  327. if test x$with_diff_viewer != xno; then
  328. AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
  329. use_diff=yes
  330. diff_msg="yes"
  331. AC_MSG_NOTICE([using diff viewer])
  332. else
  333. diff_msg="no"
  334. fi
  335. dnl Check if the OS is supported by the console saver.
  336. cons_saver=""
  337. case $host_os in
  338. linux*)
  339. cons_saver=yes
  340. esac
  341. dnl
  342. dnl Where config files should be placed
  343. dnl
  344. AC_ARG_WITH([homedir],
  345. AS_HELP_STRING([--with-homedir], [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
  346. [
  347. if test "x$withval" = "xXDG"; then
  348. with_homedir=XDG
  349. else
  350. with_homedir=$withval
  351. fi
  352. ],
  353. [with_homedir=XDG])
  354. if test x$with_homedir = xXDG; then
  355. AC_DEFINE(MC_HOMEDIR_XDG, 1,
  356. [Define to enable XDG standard support])
  357. else
  358. AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
  359. fi
  360. MC_BACKGROUND
  361. dnl
  362. dnl User visible support for charset conversion.
  363. dnl
  364. AC_ARG_ENABLE([charset],
  365. [ --enable-charset Support for charset selection and conversion [[yes]]])
  366. have_charset=
  367. charset_msg="no"
  368. if test "x$enable_charset" != "xno"; then
  369. AC_DEFINE(HAVE_CHARSET, 1,
  370. [Define to enable charset selection and conversion])
  371. have_charset=yes
  372. charset_msg="yes"
  373. fi
  374. if test "$GLIBC21" != yes; then
  375. AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
  376. fi
  377. MC_CHECK_CFLAGS
  378. CFLAGS_OPTS=""
  379. if test "x$CFLAGS" = "x"; then
  380. CFLAGS_OPTS=" -O2 "
  381. fi
  382. if test x$USE_MAINTAINER_MODE = xyes; then
  383. CFLAGS_OPTS="-g3 -O -ggdb"
  384. AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
  385. fi
  386. AC_ARG_ENABLE(
  387. [werror],
  388. AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors])
  389. )
  390. if test "x$enable_werror" = xyes; then
  391. MC_CHECK_ONE_CFLAG([-Werror])
  392. fi
  393. CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
  394. MC_UNIT_TESTS
  395. AC_SUBST(CFLAGS)
  396. AC_SUBST(CPPFLAGS)
  397. AC_SUBST(LDFLAGS)
  398. AC_SUBST(LIBS)
  399. dnl Libraries used only when building the mc binary
  400. AC_SUBST(MCLIBS)
  401. MAN_DATE="$(LC_ALL=C date "+%B %Y")"
  402. AC_SUBST(MAN_DATE)
  403. AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
  404. AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
  405. AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
  406. AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
  407. AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
  408. AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
  409. AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
  410. AC_CONFIG_FILES(
  411. [
  412. src/man2hlp/man2hlp
  413. ],
  414. [
  415. chmod +x src/man2hlp/man2hlp
  416. ])
  417. AC_CONFIG_FILES([
  418. Makefile
  419. contrib/Makefile
  420. contrib/dist/Makefile
  421. contrib/dist/debian/Makefile
  422. contrib/dist/gentoo/Makefile
  423. contrib/dist/redhat/Makefile
  424. contrib/dist/redhat/mc.spec
  425. contrib/dist/pkginfo
  426. contrib/dist/prototype
  427. misc/Makefile
  428. misc/skins/Makefile
  429. misc/macros.d/Makefile
  430. misc/mc.ext
  431. src/Makefile
  432. src/consaver/Makefile
  433. src/editor/Makefile
  434. src/man2hlp/Makefile
  435. src/viewer/Makefile
  436. src/diffviewer/Makefile
  437. src/filemanager/Makefile
  438. src/vfs/Makefile
  439. src/vfs/cpio/Makefile
  440. src/vfs/extfs/Makefile
  441. src/vfs/extfs/helpers/Makefile
  442. src/vfs/extfs/helpers/a+
  443. src/vfs/extfs/helpers/apt+
  444. src/vfs/extfs/helpers/audio
  445. src/vfs/extfs/helpers/deb
  446. src/vfs/extfs/helpers/deba
  447. src/vfs/extfs/helpers/debd
  448. src/vfs/extfs/helpers/dpkg+
  449. src/vfs/extfs/helpers/iso9660
  450. src/vfs/extfs/helpers/hp48+
  451. src/vfs/extfs/helpers/lslR
  452. src/vfs/extfs/helpers/mailfs
  453. src/vfs/extfs/helpers/patchfs
  454. src/vfs/extfs/helpers/rpms+
  455. src/vfs/extfs/helpers/s3+
  456. src/vfs/extfs/helpers/uace
  457. src/vfs/extfs/helpers/ualz
  458. src/vfs/extfs/helpers/uar
  459. src/vfs/extfs/helpers/uarc
  460. src/vfs/extfs/helpers/uarj
  461. src/vfs/extfs/helpers/uc1541
  462. src/vfs/extfs/helpers/ucab
  463. src/vfs/extfs/helpers/uha
  464. src/vfs/extfs/helpers/ulha
  465. src/vfs/extfs/helpers/urar
  466. src/vfs/extfs/helpers/uzip
  467. src/vfs/extfs/helpers/uzoo
  468. src/vfs/fish/Makefile
  469. src/vfs/fish/helpers/Makefile
  470. src/vfs/ftpfs/Makefile
  471. src/vfs/local/Makefile
  472. src/vfs/sfs/Makefile
  473. src/vfs/smbfs/Makefile
  474. src/vfs/tar/Makefile
  475. src/vfs/undelfs/Makefile
  476. lib/Makefile
  477. lib/event/Makefile
  478. lib/filehighlight/Makefile
  479. lib/mcconfig/Makefile
  480. lib/search/Makefile
  481. lib/skin/Makefile
  482. lib/strutil/Makefile
  483. lib/tty/Makefile
  484. lib/vfs/Makefile
  485. lib/widget/Makefile
  486. misc/syntax/Makefile
  487. doc/Makefile
  488. doc/hints/Makefile
  489. doc/man/Makefile
  490. doc/man/es/Makefile
  491. doc/man/hu/Makefile
  492. doc/man/it/Makefile
  493. doc/man/pl/Makefile
  494. doc/man/ru/Makefile
  495. doc/man/sr/Makefile
  496. doc/hlp/Makefile
  497. doc/hlp/es/Makefile
  498. doc/hlp/hu/Makefile
  499. doc/hlp/it/Makefile
  500. doc/hlp/pl/Makefile
  501. doc/hlp/ru/Makefile
  502. doc/hlp/sr/Makefile
  503. intl/Makefile
  504. po/Makefile.in
  505. ])
  506. if test x$enable_tests != xno; then
  507. AC_CONFIG_FILES([
  508. tests/Makefile
  509. tests/lib/Makefile
  510. tests/lib/mcconfig/Makefile
  511. tests/lib/search/Makefile
  512. tests/lib/vfs/Makefile
  513. tests/src/Makefile
  514. tests/src/filemanager/Makefile
  515. ])
  516. fi
  517. AC_OUTPUT
  518. echo "
  519. Configuration:
  520. Source code location: ${srcdir}
  521. Compiler: ${CC}
  522. Compiler flags: ${CFLAGS}
  523. File system: ${vfs_type}
  524. ${vfs_flags}
  525. Screen library: ${screen_msg}
  526. Mouse support: ${mouse_lib}
  527. X11 events support: ${textmode_x11_support}
  528. With subshell support: ${subshell}
  529. With background operations: ${enable_background}
  530. Internal editor: ${edit_msg}
  531. Diff viewer: ${diff_msg}
  532. Support for charset: ${charset_msg}
  533. Search type: ${SEARCH_TYPE}
  534. "