configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  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. AC_SYS_LARGEFILE
  60. AC_PROG_LN_S
  61. AC_CHECK_TOOL(AR, ar, ar)
  62. dnl Only list browsers here that can be run in background (i.e. with `&')
  63. AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
  64. dnl
  65. dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
  66. dnl We use only part of the functionality of mmap, so on AIX,
  67. dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
  68. dnl
  69. AC_ARG_WITH(mmap,
  70. [ --with-mmap Use the mmap call [[yes if found]]])
  71. if test x$with_mmap != xno; then
  72. if test x$with_mmap = x; then
  73. AC_FUNC_MMAP
  74. else
  75. AC_DEFINE(HAVE_MMAP, 1)
  76. fi
  77. fi
  78. dnl
  79. dnl Internationalization
  80. dnl
  81. AM_GNU_GETTEXT(no-libtool, need-ngettext)
  82. AM_GNU_GETTEXT_VERSION(0.14.3)
  83. if test "x$USE_INCLUDED_LIBINTL" = xyes; then
  84. CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
  85. fi
  86. dnl Determine which help translations we want to install.
  87. ALL_DOC_LINGUAS="es hu it pl ru sr"
  88. DOC_LINGUAS=
  89. if test "x$USE_NLS" = xyes; then
  90. if test -z "$LINGUAS"; then
  91. langs="`grep -v '^#' $srcdir/po/LINGUAS`"
  92. else
  93. langs="$LINGUAS"
  94. fi
  95. else
  96. langs=
  97. fi
  98. for h_lang in $ALL_DOC_LINGUAS; do
  99. for lang in $langs; do
  100. if test "$lang" = "$h_lang"; then
  101. DOC_LINGUAS="$DOC_LINGUAS $lang"
  102. break
  103. fi
  104. done
  105. done
  106. AC_SUBST(DOC_LINGUAS)
  107. dnl
  108. dnl OS specific flags.
  109. dnl
  110. case $host_os in
  111. aux*)
  112. # A/UX
  113. LIBS="$LIBS -lposix"
  114. AC_DEFINE(_POSIX_SOURCE)
  115. ;;
  116. esac
  117. AC_PROG_INSTALL
  118. AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
  119. utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
  120. sys/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
  121. security/pam_misc.h sys/socket.h sys/sysmacros.h sys/types.h \
  122. sys/mkdev.h wchar.h wctype.h])
  123. AC_HEADER_TIME
  124. AC_HEADER_DIRENT
  125. AC_HEADER_STDC
  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. cfgetospeed \
  135. initgroups isascii \
  136. setreuid statfs sysconf \
  137. tcgetattr tcsetattr truncate \
  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_ALLOCA
  174. AC_FUNC_STRCOLL
  175. dnl
  176. dnl This is from GNU fileutils, check aclocal.m4 for more information
  177. dnl uintmat_t is required for FS info
  178. dnl
  179. AC_GET_FS_INFO
  180. dnl
  181. dnl X11 support.
  182. dnl Used to read keyboard modifiers when running under X11.
  183. AC_PATH_XTRA
  184. dnl
  185. dnl Check if the gmodule functionality supported on this system.
  186. AC_G_MODULE_SUPPORTED
  187. dnl
  188. dnl Sequent wants getprocessstats
  189. dnl
  190. AC_CHECK_LIB(seq, get_process_stats, [
  191. LIBS="$LIBS -lseq"
  192. AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
  193. [Define if you have function `get_process_stats' and
  194. have to use that instead of gettimeofday])])
  195. AC_MC_VFS_CHECKS
  196. dnl
  197. dnl Check for gpm mouse support (Linux only)
  198. dnl
  199. mouse_lib="xterm only"
  200. AC_ARG_WITH(gpm-mouse,
  201. [ --with-gpm-mouse Compile with gpm mouse support (Linux only)
  202. [[yes if found]]])
  203. case $host_os in
  204. linux*)
  205. if test x$with_gpm_mouse != xno; then
  206. AC_CHECK_LIB(gpm, Gpm_Repeat,
  207. [AC_DEFINE(HAVE_LIBGPM, 1,
  208. [Define to enable gpm mouse support on Linux])
  209. mouse_lib="gpm and xterm"
  210. MCLIBS="$MCLIBS -lgpm"],
  211. if test "x$with_gpm_mouse" = "xyes"; then
  212. [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
  213. else
  214. [AC_MSG_WARN([libgpm is missing or older than 0.18])]
  215. fi
  216. )
  217. fi
  218. ;;
  219. esac
  220. MC_CHECK_SEARCH_TYPE
  221. dnl
  222. dnl Check nroff and the options it supports
  223. dnl
  224. AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
  225. dnl Default values
  226. MANDOC=-man
  227. MAN_FLAGS=
  228. if $HAVE_nroff; then
  229. AC_MSG_CHECKING([for manual formatting macros])
  230. AC_CACHE_VAL(mc_cv_mandoc, [
  231. nroff -mandoc < /dev/null > /dev/null 2>&1
  232. if test $? = 0; then
  233. mc_cv_mandoc=-mandoc
  234. else
  235. mc_cv_mandoc=-man
  236. fi
  237. ])
  238. MANDOC=$mc_cv_mandoc
  239. AC_MSG_RESULT([$MANDOC])
  240. AC_MSG_CHECKING([for option to disable ANSI color in manuals])
  241. AC_CACHE_VAL(mc_cv_man_nocolor, [
  242. nroff -c < /dev/null > /dev/null 2>&1
  243. if test $? = 0; then
  244. mc_cv_man_nocolor=-c
  245. else
  246. mc_cv_man_nocolor=
  247. fi
  248. ])
  249. MAN_FLAGS=$mc_cv_man_nocolor
  250. AC_MSG_RESULT([${MAN_NOCOLOR-none}])
  251. AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
  252. AC_CACHE_VAL(mc_cv_nroff_tascii, [
  253. mc_cv_nroff_tascii=
  254. nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
  255. if test $? = 0; then
  256. mc_cv_nroff_tascii=-Tlatin1
  257. else
  258. nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
  259. if test $? = 0; then
  260. mc_cv_nroff_tascii=-Tascii
  261. fi
  262. fi
  263. ])
  264. AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
  265. MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
  266. fi
  267. AC_SUBST(MANDOC)
  268. AC_SUBST(MAN_FLAGS)
  269. dnl
  270. dnl Check for -L option to file
  271. dnl
  272. AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
  273. if $HAVE_FILECMD; then
  274. AC_MSG_CHECKING([for -L option to file command])
  275. AC_CACHE_VAL(mc_cv_filel, [
  276. file -L . > /dev/null 2>&1
  277. if test $? = 0; then
  278. mc_cv_filel=yes
  279. else
  280. mc_cv_filel=no
  281. fi
  282. ])
  283. if test x$mc_cv_filel = xyes; then
  284. AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
  285. fi
  286. filel=$mc_cv_filel
  287. AC_MSG_RESULT([$filel])
  288. fi
  289. AC_MSG_CHECKING([for subshell support])
  290. AC_ARG_WITH(subshell,
  291. [ --with-subshell Compile in concurrent subshell [[yes]]
  292. --with-subshell=optional Don't run concurrent shell by default [[no]]],
  293. [result=no
  294. if test x$withval = xoptional
  295. then
  296. AC_DEFINE(SUBSHELL_OPTIONAL, 1,
  297. [Define to make subshell support optional])
  298. result="optional"
  299. fi
  300. if test x$withval = xyes
  301. then
  302. result="yes"
  303. fi],
  304. [dnl Default: enable the subshell support
  305. result="yes"
  306. ])
  307. if test "x$result" != xno; then
  308. AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
  309. [Define to enable subshell support])
  310. fi
  311. AC_MSG_RESULT([$result])
  312. subshell="$result"
  313. MC_WITH_SCREEN
  314. dnl
  315. dnl Internal editor support.
  316. dnl
  317. AC_ARG_WITH(edit,
  318. [ --with-edit Enable internal editor [[yes]]])
  319. if test x$with_edit != xno; then
  320. AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
  321. use_edit=yes
  322. edit_msg="yes"
  323. AC_MSG_NOTICE([using internal editor])
  324. else
  325. edit_msg="no"
  326. fi
  327. dnl
  328. dnl Diff viewer support.
  329. dnl
  330. AC_ARG_WITH(diff_viewer,
  331. [ --with-diff-viewer Compile with diff viewer [[yes]]])
  332. if test x$with_diff_viewer != xno; then
  333. AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
  334. use_diff=yes
  335. diff_msg="yes"
  336. AC_MSG_NOTICE([using diff viewer])
  337. else
  338. diff_msg="no"
  339. fi
  340. dnl Check if the OS is supported by the console saver.
  341. cons_saver=""
  342. case $host_os in
  343. linux*)
  344. cons_saver=yes
  345. esac
  346. dnl Support for background operations
  347. AC_ARG_ENABLE([background],
  348. [ --enable-background Support for background file operations [[yes]]])
  349. if test "x$enable_background" != xno; then
  350. AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations])
  351. fi
  352. dnl
  353. dnl User visible support for charset conversion.
  354. dnl
  355. AC_ARG_ENABLE([charset],
  356. [ --enable-charset Support for charset selection and conversion [[yes]]])
  357. have_charset=
  358. charset_msg="no"
  359. if test "x$enable_charset" != "xno"; then
  360. AC_DEFINE(HAVE_CHARSET, 1,
  361. [Define to enable charset selection and conversion])
  362. have_charset=yes
  363. charset_msg="yes"
  364. fi
  365. if test "$GLIBC21" != yes; then
  366. AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
  367. fi
  368. MC_CHECK_CFLAGS
  369. CFLAGS_OPTS=""
  370. if test "x$CFLAGS" = "x"; then
  371. CFLAGS_OPTS=" -O2 "
  372. fi
  373. if test x$USE_MAINTAINER_MODE = xyes; then
  374. CFLAGS_OPTS="-g3 -O -ggdb"
  375. AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
  376. fi
  377. AC_ARG_ENABLE(
  378. [werror],
  379. AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors])
  380. )
  381. if test "x$enable_werror" = xyes; then
  382. MC_CHECK_ONE_CFLAG([-Werror])
  383. fi
  384. CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
  385. MC_UNIT_TESTS
  386. AC_SUBST(CFLAGS)
  387. AC_SUBST(CPPFLAGS)
  388. AC_SUBST(LDFLAGS)
  389. AC_SUBST(LIBS)
  390. dnl Libraries used only when building the mc binary
  391. AC_SUBST(MCLIBS)
  392. MAN_DATE="$(LC_ALL=C date "+%B %Y")"
  393. AC_SUBST(MAN_DATE)
  394. AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
  395. AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
  396. AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
  397. AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
  398. AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
  399. AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
  400. AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
  401. AC_CONFIG_FILES(
  402. [
  403. src/man2hlp/man2hlp
  404. ],
  405. [
  406. chmod +x src/man2hlp/man2hlp
  407. ])
  408. AC_CONFIG_FILES([
  409. Makefile
  410. contrib/Makefile
  411. contrib/dist/Makefile
  412. contrib/dist/debian/Makefile
  413. contrib/dist/gentoo/Makefile
  414. contrib/dist/redhat/Makefile
  415. contrib/dist/redhat/mc.spec
  416. contrib/dist/pkginfo
  417. contrib/dist/prototype
  418. misc/Makefile
  419. misc/skins/Makefile
  420. misc/macros.d/Makefile
  421. misc/mc.ext
  422. src/Makefile
  423. src/consaver/Makefile
  424. src/editor/Makefile
  425. src/man2hlp/Makefile
  426. src/viewer/Makefile
  427. src/diffviewer/Makefile
  428. src/filemanager/Makefile
  429. src/vfs/Makefile
  430. src/vfs/cpio/Makefile
  431. src/vfs/extfs/Makefile
  432. src/vfs/extfs/helpers/Makefile
  433. src/vfs/extfs/helpers/a+
  434. src/vfs/extfs/helpers/apt+
  435. src/vfs/extfs/helpers/audio
  436. src/vfs/extfs/helpers/deb
  437. src/vfs/extfs/helpers/deba
  438. src/vfs/extfs/helpers/debd
  439. src/vfs/extfs/helpers/dpkg+
  440. src/vfs/extfs/helpers/iso9660
  441. src/vfs/extfs/helpers/hp48+
  442. src/vfs/extfs/helpers/lslR
  443. src/vfs/extfs/helpers/mailfs
  444. src/vfs/extfs/helpers/patchfs
  445. src/vfs/extfs/helpers/rpms+
  446. src/vfs/extfs/helpers/s3+
  447. src/vfs/extfs/helpers/uace
  448. src/vfs/extfs/helpers/ualz
  449. src/vfs/extfs/helpers/uar
  450. src/vfs/extfs/helpers/uarc
  451. src/vfs/extfs/helpers/uarj
  452. src/vfs/extfs/helpers/uc1541
  453. src/vfs/extfs/helpers/ucab
  454. src/vfs/extfs/helpers/uha
  455. src/vfs/extfs/helpers/ulha
  456. src/vfs/extfs/helpers/urar
  457. src/vfs/extfs/helpers/uzip
  458. src/vfs/extfs/helpers/uzoo
  459. src/vfs/fish/Makefile
  460. src/vfs/fish/helpers/Makefile
  461. src/vfs/ftpfs/Makefile
  462. src/vfs/local/Makefile
  463. src/vfs/sfs/Makefile
  464. src/vfs/smbfs/Makefile
  465. src/vfs/tar/Makefile
  466. src/vfs/undelfs/Makefile
  467. lib/Makefile
  468. lib/event/Makefile
  469. lib/filehighlight/Makefile
  470. lib/mcconfig/Makefile
  471. lib/search/Makefile
  472. lib/skin/Makefile
  473. lib/strutil/Makefile
  474. lib/tty/Makefile
  475. lib/vfs/Makefile
  476. lib/widget/Makefile
  477. misc/syntax/Makefile
  478. doc/Makefile
  479. doc/hints/Makefile
  480. doc/man/mc.1 doc/man/mcedit.1 doc/man/mcview.1 doc/man/Makefile
  481. doc/man/es/mc.1 doc/man/es/Makefile
  482. doc/man/hu/mc.1 doc/man/hu/Makefile
  483. doc/man/it/mc.1 doc/man/it/Makefile
  484. doc/man/pl/mc.1 doc/man/pl/Makefile
  485. doc/man/ru/mc.1 doc/man/ru/Makefile
  486. doc/man/sr/mc.1 doc/man/sr/Makefile
  487. doc/hlp/Makefile
  488. doc/hlp/es/Makefile
  489. doc/hlp/hu/Makefile
  490. doc/hlp/it/Makefile
  491. doc/hlp/pl/Makefile
  492. doc/hlp/ru/Makefile
  493. doc/hlp/sr/Makefile
  494. intl/Makefile
  495. po/Makefile.in
  496. ])
  497. if test x$enable_tests != xno; then
  498. AC_CONFIG_FILES([
  499. tests/Makefile
  500. tests/lib/Makefile
  501. tests/lib/mcconfig/Makefile
  502. tests/lib/search/Makefile
  503. tests/lib/vfs/Makefile
  504. ])
  505. fi
  506. AC_OUTPUT
  507. echo "
  508. Configuration:
  509. Source code location: ${srcdir}
  510. Compiler: ${CC}
  511. Compiler flags: ${CFLAGS}
  512. File system: ${vfs_type}
  513. ${vfs_flags}
  514. Screen library: ${screen_msg}
  515. Mouse support: ${mouse_lib}
  516. X11 events support: ${textmode_x11_support}
  517. With subshell support: ${subshell}
  518. Internal editor: ${edit_msg}
  519. Diff viewer: ${diff_msg}
  520. Support for charset: ${charset_msg}
  521. Search type: ${SEARCH_TYPE}
  522. "