configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  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 konqueror opera netscape])
  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/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
  122. security/pam_misc.h sys/socket.h sys/sysmacros.h sys/types.h \
  123. sys/mkdev.h wchar.h wctype.h])
  124. AC_HEADER_TIME
  125. AC_HEADER_DIRENT
  126. AC_HEADER_STDC
  127. dnl Missing structure components
  128. AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
  129. AC_STRUCT_ST_BLOCKS
  130. dnl
  131. dnl Check availability of some functions
  132. dnl
  133. AC_CHECK_FUNCS([\
  134. atoll \
  135. cfgetospeed \
  136. initgroups isascii \
  137. setreuid statfs sysconf \
  138. tcgetattr tcsetattr truncate \
  139. strverscmp \
  140. strncasecmp \
  141. realpath
  142. ])
  143. dnl
  144. dnl getpt is a GNU Extension (glibc 2.1.x)
  145. dnl
  146. AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
  147. AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
  148. dnl replacing lstat with statlstat on sco makes it more portable between
  149. dnl sco clones
  150. AC_CHECK_FUNCS(statlstat)
  151. dnl
  152. dnl If running under AIX, AC_AIX does not tell us that
  153. dnl
  154. AC_MSG_CHECKING([for AIX defines])
  155. AC_EGREP_CPP(yes,
  156. [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
  157. yes
  158. #endif
  159. ], [
  160. AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
  161. AC_MSG_RESULT(yes)
  162. ], [AC_MSG_RESULT(no)])
  163. dnl
  164. dnl Missing typedefs and replacements
  165. dnl
  166. AC_CHECK_SIZEOF(long)
  167. AC_TYPE_UINTMAX_T
  168. AC_CHECK_SIZEOF(uintmax_t)
  169. AC_TYPE_OFF_T
  170. AC_CHECK_SIZEOF(off_t)
  171. AC_TYPE_MODE_T
  172. AC_TYPE_PID_T
  173. AC_TYPE_UID_T
  174. AC_FUNC_ALLOCA
  175. AC_FUNC_STRCOLL
  176. AC_MC_GET_FS_INFO
  177. dnl
  178. dnl X11 support.
  179. dnl Used to read keyboard modifiers when running under X11.
  180. AC_PATH_XTRA
  181. dnl
  182. dnl Check if the gmodule functionality supported on this system.
  183. AC_G_MODULE_SUPPORTED
  184. dnl
  185. dnl Sequent wants getprocessstats
  186. dnl
  187. AC_CHECK_LIB(seq, get_process_stats, [
  188. LIBS="$LIBS -lseq"
  189. AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
  190. [Define if you have function `get_process_stats' and
  191. have to use that instead of gettimeofday])])
  192. AC_MC_VFS_CHECKS
  193. dnl
  194. dnl Check for gpm mouse support (Linux only)
  195. dnl
  196. mouse_lib="xterm only"
  197. AC_ARG_WITH(gpm-mouse,
  198. [ --with-gpm-mouse Compile with gpm mouse support (Linux only)
  199. [[yes if found]]])
  200. case $host_os in
  201. linux*)
  202. if test x$with_gpm_mouse != xno; then
  203. AC_CHECK_LIB(gpm, Gpm_Repeat,
  204. [AC_DEFINE(HAVE_LIBGPM, 1,
  205. [Define to enable gpm mouse support on Linux])
  206. mouse_lib="gpm and xterm"
  207. MCLIBS="$MCLIBS -lgpm"],
  208. if test "x$with_gpm_mouse" = "xyes"; then
  209. [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
  210. else
  211. [AC_MSG_WARN([libgpm is missing or older than 0.18])]
  212. fi
  213. )
  214. fi
  215. ;;
  216. esac
  217. MC_CHECK_SEARCH_TYPE
  218. dnl
  219. dnl Check nroff and the options it supports
  220. dnl
  221. AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
  222. dnl Default values
  223. MANDOC=-man
  224. MAN_FLAGS=
  225. if $HAVE_nroff; then
  226. AC_MSG_CHECKING([for manual formatting macros])
  227. AC_CACHE_VAL(mc_cv_mandoc, [
  228. nroff -mandoc < /dev/null > /dev/null 2>&1
  229. if test $? = 0; then
  230. mc_cv_mandoc=-mandoc
  231. else
  232. mc_cv_mandoc=-man
  233. fi
  234. ])
  235. MANDOC=$mc_cv_mandoc
  236. AC_MSG_RESULT([$MANDOC])
  237. AC_MSG_CHECKING([for option to disable ANSI color in manuals])
  238. AC_CACHE_VAL(mc_cv_man_nocolor, [
  239. nroff -c < /dev/null > /dev/null 2>&1
  240. if test $? = 0; then
  241. mc_cv_man_nocolor=-c
  242. else
  243. mc_cv_man_nocolor=
  244. fi
  245. ])
  246. MAN_FLAGS=$mc_cv_man_nocolor
  247. AC_MSG_RESULT([${MAN_NOCOLOR-none}])
  248. AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
  249. AC_CACHE_VAL(mc_cv_nroff_tascii, [
  250. mc_cv_nroff_tascii=
  251. nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
  252. if test $? = 0; then
  253. mc_cv_nroff_tascii=-Tlatin1
  254. else
  255. nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
  256. if test $? = 0; then
  257. mc_cv_nroff_tascii=-Tascii
  258. fi
  259. fi
  260. ])
  261. AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
  262. MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
  263. fi
  264. AC_SUBST(MANDOC)
  265. AC_SUBST(MAN_FLAGS)
  266. dnl
  267. dnl Check for -L option to file
  268. dnl
  269. AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
  270. if $HAVE_FILECMD; then
  271. AC_MSG_CHECKING([for -L option to file command])
  272. AC_CACHE_VAL(mc_cv_filel, [
  273. file -L . > /dev/null 2>&1
  274. if test $? = 0; then
  275. mc_cv_filel=yes
  276. else
  277. mc_cv_filel=no
  278. fi
  279. ])
  280. if test x$mc_cv_filel = xyes; then
  281. AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
  282. fi
  283. filel=$mc_cv_filel
  284. AC_MSG_RESULT([$filel])
  285. fi
  286. AC_MSG_CHECKING([for subshell support])
  287. AC_ARG_WITH(subshell,
  288. [ --with-subshell Compile in concurrent subshell [[yes]]
  289. --with-subshell=optional Don't run concurrent shell by default [[no]]],
  290. [result=no
  291. if test x$withval = xoptional
  292. then
  293. AC_DEFINE(SUBSHELL_OPTIONAL, 1,
  294. [Define to make subshell support optional])
  295. result="optional"
  296. fi
  297. if test x$withval = xyes
  298. then
  299. result="yes"
  300. fi],
  301. [dnl Default: enable the subshell support
  302. result="yes"
  303. ])
  304. if test "x$result" != xno; then
  305. AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
  306. [Define to enable subshell support])
  307. fi
  308. AC_MSG_RESULT([$result])
  309. subshell="$result"
  310. MC_WITH_SCREEN
  311. dnl
  312. dnl Internal editor support.
  313. dnl
  314. AC_ARG_WITH(edit,
  315. [ --with-edit Enable internal editor [[yes]]])
  316. if test x$with_edit != xno; then
  317. AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
  318. use_edit=yes
  319. edit_msg="yes"
  320. AC_MSG_NOTICE([using internal editor])
  321. else
  322. edit_msg="no"
  323. fi
  324. dnl
  325. dnl Diff viewer support.
  326. dnl
  327. AC_ARG_WITH(diff_viewer,
  328. [ --with-diff-viewer Compile with diff viewer [[yes]]])
  329. if test x$with_diff_viewer != xno; then
  330. AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
  331. use_diff=yes
  332. diff_msg="yes"
  333. AC_MSG_NOTICE([using diff viewer])
  334. else
  335. diff_msg="no"
  336. fi
  337. dnl Check if the OS is supported by the console saver.
  338. cons_saver=""
  339. case $host_os in
  340. linux*)
  341. cons_saver=yes
  342. esac
  343. dnl Support for background operations
  344. AC_ARG_ENABLE([background],
  345. [ --enable-background Support for background file operations [[yes]]])
  346. if test "x$enable_background" != xno; then
  347. AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations])
  348. fi
  349. dnl
  350. dnl User visible support for charset conversion.
  351. dnl
  352. AC_ARG_ENABLE([charset],
  353. [ --enable-charset Support for charset selection and conversion [[yes]]])
  354. have_charset=
  355. charset_msg="no"
  356. if test "x$enable_charset" != "xno"; then
  357. AC_DEFINE(HAVE_CHARSET, 1,
  358. [Define to enable charset selection and conversion])
  359. have_charset=yes
  360. charset_msg="yes"
  361. fi
  362. if test "$GLIBC21" != yes; then
  363. AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
  364. fi
  365. MC_CHECK_CFLAGS
  366. CFLAGS_OPTS=""
  367. if test "x$CFLAGS" = "x"; then
  368. CFLAGS_OPTS=" -O2 "
  369. fi
  370. if test x$USE_MAINTAINER_MODE = xyes; then
  371. CFLAGS_OPTS="-g3 -O -ggdb"
  372. AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
  373. fi
  374. AC_ARG_ENABLE(
  375. [werror],
  376. AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors])
  377. )
  378. if test "x$enable_werror" = xyes; then
  379. MC_CHECK_ONE_CFLAG([-Werror])
  380. fi
  381. CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
  382. MC_UNIT_TESTS
  383. AC_SUBST(CFLAGS)
  384. AC_SUBST(CPPFLAGS)
  385. AC_SUBST(LDFLAGS)
  386. AC_SUBST(LIBS)
  387. dnl Libraries used only when building the mc binary
  388. AC_SUBST(MCLIBS)
  389. MAN_DATE="$(LC_ALL=C date "+%B %Y")"
  390. AC_SUBST(MAN_DATE)
  391. AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
  392. AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
  393. AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
  394. AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
  395. AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
  396. AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
  397. AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
  398. AC_CONFIG_FILES(
  399. [
  400. src/man2hlp/man2hlp
  401. ],
  402. [
  403. chmod +x src/man2hlp/man2hlp
  404. ])
  405. AC_CONFIG_FILES([
  406. Makefile
  407. contrib/Makefile
  408. contrib/dist/Makefile
  409. contrib/dist/debian/Makefile
  410. contrib/dist/gentoo/Makefile
  411. contrib/dist/redhat/Makefile
  412. contrib/dist/redhat/mc.spec
  413. contrib/dist/pkginfo
  414. contrib/dist/prototype
  415. misc/Makefile
  416. misc/skins/Makefile
  417. misc/macros.d/Makefile
  418. misc/mc.ext
  419. src/Makefile
  420. src/consaver/Makefile
  421. src/editor/Makefile
  422. src/man2hlp/Makefile
  423. src/viewer/Makefile
  424. src/diffviewer/Makefile
  425. src/filemanager/Makefile
  426. src/vfs/Makefile
  427. src/vfs/cpio/Makefile
  428. src/vfs/extfs/Makefile
  429. src/vfs/extfs/helpers/Makefile
  430. src/vfs/extfs/helpers/a+
  431. src/vfs/extfs/helpers/apt+
  432. src/vfs/extfs/helpers/audio
  433. src/vfs/extfs/helpers/deb
  434. src/vfs/extfs/helpers/deba
  435. src/vfs/extfs/helpers/debd
  436. src/vfs/extfs/helpers/dpkg+
  437. src/vfs/extfs/helpers/iso9660
  438. src/vfs/extfs/helpers/hp48+
  439. src/vfs/extfs/helpers/lslR
  440. src/vfs/extfs/helpers/mailfs
  441. src/vfs/extfs/helpers/patchfs
  442. src/vfs/extfs/helpers/rpms+
  443. src/vfs/extfs/helpers/s3+
  444. src/vfs/extfs/helpers/uace
  445. src/vfs/extfs/helpers/ualz
  446. src/vfs/extfs/helpers/uar
  447. src/vfs/extfs/helpers/uarc
  448. src/vfs/extfs/helpers/uarj
  449. src/vfs/extfs/helpers/uc1541
  450. src/vfs/extfs/helpers/ucab
  451. src/vfs/extfs/helpers/uha
  452. src/vfs/extfs/helpers/ulha
  453. src/vfs/extfs/helpers/urar
  454. src/vfs/extfs/helpers/uzip
  455. src/vfs/extfs/helpers/uzoo
  456. src/vfs/fish/Makefile
  457. src/vfs/fish/helpers/Makefile
  458. src/vfs/ftpfs/Makefile
  459. src/vfs/local/Makefile
  460. src/vfs/sfs/Makefile
  461. src/vfs/smbfs/Makefile
  462. src/vfs/tar/Makefile
  463. src/vfs/undelfs/Makefile
  464. lib/Makefile
  465. lib/event/Makefile
  466. lib/filehighlight/Makefile
  467. lib/mcconfig/Makefile
  468. lib/search/Makefile
  469. lib/skin/Makefile
  470. lib/strutil/Makefile
  471. lib/tty/Makefile
  472. lib/vfs/Makefile
  473. lib/widget/Makefile
  474. misc/syntax/Makefile
  475. doc/Makefile
  476. doc/hints/Makefile
  477. doc/man/mc.1 doc/man/mcedit.1 doc/man/mcview.1 doc/man/Makefile
  478. doc/man/es/mc.1 doc/man/es/Makefile
  479. doc/man/hu/mc.1 doc/man/hu/Makefile
  480. doc/man/it/mc.1 doc/man/it/Makefile
  481. doc/man/pl/mc.1 doc/man/pl/Makefile
  482. doc/man/ru/mc.1 doc/man/ru/Makefile
  483. doc/man/sr/mc.1 doc/man/sr/Makefile
  484. doc/hlp/Makefile
  485. doc/hlp/es/Makefile
  486. doc/hlp/hu/Makefile
  487. doc/hlp/it/Makefile
  488. doc/hlp/pl/Makefile
  489. doc/hlp/ru/Makefile
  490. doc/hlp/sr/Makefile
  491. intl/Makefile
  492. po/Makefile.in
  493. ])
  494. if test x$enable_tests != xno; then
  495. AC_CONFIG_FILES([
  496. tests/Makefile
  497. tests/lib/Makefile
  498. tests/lib/mcconfig/Makefile
  499. tests/lib/search/Makefile
  500. tests/lib/vfs/Makefile
  501. ])
  502. fi
  503. AC_OUTPUT
  504. echo "
  505. Configuration:
  506. Source code location: ${srcdir}
  507. Compiler: ${CC}
  508. Compiler flags: ${CFLAGS}
  509. File system: ${vfs_type}
  510. ${vfs_flags}
  511. Screen library: ${screen_msg}
  512. Mouse support: ${mouse_lib}
  513. X11 events support: ${textmode_x11_support}
  514. With subshell support: ${subshell}
  515. Internal editor: ${edit_msg}
  516. Diff viewer: ${diff_msg}
  517. Support for charset: ${charset_msg}
  518. Search type: ${SEARCH_TYPE}
  519. "