configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  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 This is from GNU fileutils, check aclocal.m4 for more information
  164. dnl
  165. AC_GET_FS_INFO
  166. dnl
  167. dnl Missing typedefs and replacements
  168. dnl
  169. AC_CHECK_SIZEOF(long)
  170. AC_CHECK_SIZEOF(long long)
  171. AC_TYPE_MODE_T
  172. AC_TYPE_OFF_T
  173. AC_CHECK_SIZEOF(off_t)
  174. AC_TYPE_PID_T
  175. AC_TYPE_UID_T
  176. AC_FUNC_ALLOCA
  177. AC_FUNC_STRCOLL
  178. dnl
  179. dnl X11 support.
  180. dnl Used to read keyboard modifiers when running under X11.
  181. AC_PATH_XTRA
  182. dnl
  183. dnl Check if the gmodule functionality supported on this system.
  184. AC_G_MODULE_SUPPORTED
  185. dnl
  186. dnl Sequent wants getprocessstats
  187. dnl
  188. AC_CHECK_LIB(seq, get_process_stats, [
  189. LIBS="$LIBS -lseq"
  190. AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
  191. [Define if you have function `get_process_stats' and
  192. have to use that instead of gettimeofday])])
  193. AC_MC_VFS_CHECKS
  194. dnl
  195. dnl Check for gpm mouse support (Linux only)
  196. dnl
  197. mouse_lib="xterm only"
  198. AC_ARG_WITH(gpm-mouse,
  199. [ --with-gpm-mouse Compile with gpm mouse support (Linux only)
  200. [[yes if found]]])
  201. case $host_os in
  202. linux*)
  203. if test x$with_gpm_mouse != xno; then
  204. AC_CHECK_LIB(gpm, Gpm_Repeat,
  205. [AC_DEFINE(HAVE_LIBGPM, 1,
  206. [Define to enable gpm mouse support on Linux])
  207. mouse_lib="gpm and xterm"
  208. MCLIBS="$MCLIBS -lgpm"],
  209. if test "x$with_gpm_mouse" = "xyes"; then
  210. [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
  211. else
  212. [AC_MSG_WARN([libgpm is missing or older than 0.18])]
  213. fi
  214. )
  215. fi
  216. ;;
  217. esac
  218. MC_CHECK_SEARCH_TYPE
  219. dnl
  220. dnl Check nroff and the options it supports
  221. dnl
  222. AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
  223. dnl Default values
  224. MANDOC=-man
  225. MAN_FLAGS=
  226. if $HAVE_nroff; then
  227. AC_MSG_CHECKING([for manual formatting macros])
  228. AC_CACHE_VAL(mc_cv_mandoc, [
  229. nroff -mandoc < /dev/null > /dev/null 2>&1
  230. if test $? = 0; then
  231. mc_cv_mandoc=-mandoc
  232. else
  233. mc_cv_mandoc=-man
  234. fi
  235. ])
  236. MANDOC=$mc_cv_mandoc
  237. AC_MSG_RESULT([$MANDOC])
  238. AC_MSG_CHECKING([for option to disable ANSI color in manuals])
  239. AC_CACHE_VAL(mc_cv_man_nocolor, [
  240. nroff -c < /dev/null > /dev/null 2>&1
  241. if test $? = 0; then
  242. mc_cv_man_nocolor=-c
  243. else
  244. mc_cv_man_nocolor=
  245. fi
  246. ])
  247. MAN_FLAGS=$mc_cv_man_nocolor
  248. AC_MSG_RESULT([${MAN_NOCOLOR-none}])
  249. AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
  250. AC_CACHE_VAL(mc_cv_nroff_tascii, [
  251. mc_cv_nroff_tascii=
  252. nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
  253. if test $? = 0; then
  254. mc_cv_nroff_tascii=-Tlatin1
  255. else
  256. nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
  257. if test $? = 0; then
  258. mc_cv_nroff_tascii=-Tascii
  259. fi
  260. fi
  261. ])
  262. AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
  263. MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
  264. fi
  265. AC_SUBST(MANDOC)
  266. AC_SUBST(MAN_FLAGS)
  267. dnl
  268. dnl Check for -L option to file
  269. dnl
  270. AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
  271. if $HAVE_FILECMD; then
  272. AC_MSG_CHECKING([for -L option to file command])
  273. AC_CACHE_VAL(mc_cv_filel, [
  274. file -L . > /dev/null 2>&1
  275. if test $? = 0; then
  276. mc_cv_filel=yes
  277. else
  278. mc_cv_filel=no
  279. fi
  280. ])
  281. if test x$mc_cv_filel = xyes; then
  282. AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
  283. fi
  284. filel=$mc_cv_filel
  285. AC_MSG_RESULT([$filel])
  286. fi
  287. AC_MSG_CHECKING([for subshell support])
  288. AC_ARG_WITH(subshell,
  289. [ --with-subshell Compile in concurrent subshell [[yes]]
  290. --with-subshell=optional Don't run concurrent shell by default [[no]]],
  291. [result=no
  292. if test x$withval = xoptional
  293. then
  294. AC_DEFINE(SUBSHELL_OPTIONAL, 1,
  295. [Define to make subshell support optional])
  296. result="optional"
  297. fi
  298. if test x$withval = xyes
  299. then
  300. result="yes"
  301. fi],
  302. [dnl Default: enable the subshell support
  303. result="yes"
  304. ])
  305. if test "x$result" != xno; then
  306. AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
  307. [Define to enable subshell support])
  308. fi
  309. AC_MSG_RESULT([$result])
  310. subshell="$result"
  311. MC_WITH_SCREEN
  312. dnl
  313. dnl Internal editor support.
  314. dnl
  315. AC_ARG_WITH(edit,
  316. [ --with-edit Enable internal editor [[yes]]])
  317. if test x$with_edit != xno; then
  318. AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
  319. use_edit=yes
  320. edit_msg="yes"
  321. AC_MSG_NOTICE([using internal editor])
  322. else
  323. edit_msg="no"
  324. fi
  325. dnl
  326. dnl Diff viewer support.
  327. dnl
  328. AC_ARG_WITH(diff_viewer,
  329. [ --with-diff-viewer Compile with diff viewer [[yes]]])
  330. if test x$with_diff_viewer != xno; then
  331. AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
  332. use_diff=yes
  333. diff_msg="yes"
  334. AC_MSG_NOTICE([using diff viewer])
  335. else
  336. diff_msg="no"
  337. fi
  338. dnl Check if the OS is supported by the console saver.
  339. cons_saver=""
  340. case $host_os in
  341. linux*)
  342. cons_saver=yes
  343. esac
  344. dnl Support for background operations
  345. AC_ARG_ENABLE([background],
  346. [ --enable-background Support for background file operations [[yes]]])
  347. if test "x$enable_background" != xno; then
  348. AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations])
  349. fi
  350. dnl
  351. dnl User visible support for charset conversion.
  352. dnl
  353. AC_ARG_ENABLE([charset],
  354. [ --enable-charset Support for charset selection and conversion [[yes]]])
  355. have_charset=
  356. charset_msg="no"
  357. if test "x$enable_charset" != "xno"; then
  358. AC_DEFINE(HAVE_CHARSET, 1,
  359. [Define to enable charset selection and conversion])
  360. have_charset=yes
  361. charset_msg="yes"
  362. fi
  363. if test "$GLIBC21" != yes; then
  364. AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
  365. fi
  366. MC_CHECK_CFLAGS
  367. CFLAGS_OPTS=""
  368. if test "x$CFLAGS" = "x"; then
  369. CFLAGS_OPTS=" -O2 "
  370. fi
  371. if test x$USE_MAINTAINER_MODE = xyes; then
  372. CFLAGS_OPTS="-g3 -O -ggdb"
  373. AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
  374. fi
  375. AC_ARG_ENABLE(
  376. [werror],
  377. AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors])
  378. )
  379. if test "x$enable_werror" = xyes; then
  380. MC_CHECK_ONE_CFLAG([-Werror])
  381. fi
  382. CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
  383. MC_UNIT_TESTS
  384. AC_SUBST(CFLAGS)
  385. AC_SUBST(CPPFLAGS)
  386. AC_SUBST(LDFLAGS)
  387. AC_SUBST(LIBS)
  388. dnl Libraries used only when building the mc binary
  389. AC_SUBST(MCLIBS)
  390. MAN_DATE="$(LC_ALL=C date "+%B %Y")"
  391. AC_SUBST(MAN_DATE)
  392. AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
  393. AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
  394. AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
  395. AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
  396. AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
  397. AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
  398. AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
  399. AC_CONFIG_FILES(
  400. [
  401. src/man2hlp/man2hlp
  402. ],
  403. [
  404. chmod +x src/man2hlp/man2hlp
  405. ])
  406. AC_CONFIG_FILES([
  407. Makefile
  408. contrib/Makefile
  409. contrib/dist/Makefile
  410. contrib/dist/debian/Makefile
  411. contrib/dist/gentoo/Makefile
  412. contrib/dist/redhat/Makefile
  413. contrib/dist/redhat/mc.spec
  414. contrib/dist/pkginfo
  415. contrib/dist/prototype
  416. misc/Makefile
  417. misc/skins/Makefile
  418. misc/macros.d/Makefile
  419. misc/mc.ext
  420. src/Makefile
  421. src/consaver/Makefile
  422. src/editor/Makefile
  423. src/man2hlp/Makefile
  424. src/viewer/Makefile
  425. src/diffviewer/Makefile
  426. src/filemanager/Makefile
  427. src/vfs/Makefile
  428. src/vfs/cpio/Makefile
  429. src/vfs/extfs/Makefile
  430. src/vfs/extfs/helpers/Makefile
  431. src/vfs/extfs/helpers/a+
  432. src/vfs/extfs/helpers/apt+
  433. src/vfs/extfs/helpers/audio
  434. src/vfs/extfs/helpers/deb
  435. src/vfs/extfs/helpers/deba
  436. src/vfs/extfs/helpers/debd
  437. src/vfs/extfs/helpers/dpkg+
  438. src/vfs/extfs/helpers/iso9660
  439. src/vfs/extfs/helpers/hp48+
  440. src/vfs/extfs/helpers/lslR
  441. src/vfs/extfs/helpers/mailfs
  442. src/vfs/extfs/helpers/patchfs
  443. src/vfs/extfs/helpers/rpms+
  444. src/vfs/extfs/helpers/s3+
  445. src/vfs/extfs/helpers/uace
  446. src/vfs/extfs/helpers/ualz
  447. src/vfs/extfs/helpers/uar
  448. src/vfs/extfs/helpers/uarc
  449. src/vfs/extfs/helpers/uarj
  450. src/vfs/extfs/helpers/uc1541
  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. lib/tests/Makefile
  497. lib/tests/mcconfig/Makefile
  498. lib/tests/vfs/Makefile
  499. ])
  500. fi
  501. AC_OUTPUT
  502. echo "
  503. Configuration:
  504. Source code location: ${srcdir}
  505. Compiler: ${CC}
  506. Compiler flags: ${CFLAGS}
  507. File system: ${vfs_type}
  508. ${vfs_flags}
  509. Screen library: ${screen_msg}
  510. Mouse support: ${mouse_lib}
  511. X11 events support: ${textmode_x11_support}
  512. With subshell support: ${subshell}
  513. Internal editor: ${edit_msg}
  514. Diff viewer: ${diff_msg}
  515. Support for charset: ${charset_msg}
  516. Search type: ${SEARCH_TYPE}
  517. "