configure.ac 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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_CHECK_TYPE(nlink_t, unsigned int)
  177. AC_CHECK_TYPES([socklen_t],,,
  178. [
  179. #include <sys/types.h>
  180. #include <sys/socket.h>
  181. ])
  182. dnl This is needed for regex.c only
  183. AC_CHECK_TYPE(uintptr_t,
  184. [AC_DEFINE(HAVE_UINTPTR_T, 1,
  185. [Define if you have the `uintptr_t' type.])
  186. ])
  187. AC_FUNC_ALLOCA
  188. AC_FUNC_STRCOLL
  189. dnl
  190. dnl X11 support.
  191. dnl Used to read keyboard modifiers when running under X11.
  192. AC_PATH_XTRA
  193. dnl
  194. dnl Check if the gmodule functionality supported on this system.
  195. AC_G_MODULE_SUPPORTED
  196. dnl
  197. dnl Sequent wants getprocessstats
  198. dnl
  199. AC_CHECK_LIB(seq, get_process_stats, [
  200. LIBS="$LIBS -lseq"
  201. AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
  202. [Define if you have function `get_process_stats' and
  203. have to use that instead of gettimeofday])])
  204. AC_MC_VFS_CHECKS
  205. dnl
  206. dnl Check for gpm mouse support (Linux only)
  207. dnl
  208. mouse_lib="xterm only"
  209. AC_ARG_WITH(gpm-mouse,
  210. [ --with-gpm-mouse Compile with gpm mouse support (Linux only)
  211. [[yes if found]]])
  212. case $host_os in
  213. linux*)
  214. if test x$with_gpm_mouse != xno; then
  215. AC_CHECK_LIB(gpm, Gpm_Repeat,
  216. [AC_DEFINE(HAVE_LIBGPM, 1,
  217. [Define to enable gpm mouse support on Linux])
  218. mouse_lib="gpm and xterm"
  219. MCLIBS="$MCLIBS -lgpm"],
  220. if test "x$with_gpm_mouse" = "xyes"; then
  221. [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
  222. else
  223. [AC_MSG_WARN([libgpm is missing or older than 0.18])]
  224. fi
  225. )
  226. fi
  227. ;;
  228. esac
  229. MC_CHECK_SEARCH_TYPE
  230. dnl
  231. dnl Check nroff and the options it supports
  232. dnl
  233. AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
  234. dnl Default values
  235. MANDOC=-man
  236. MAN_FLAGS=
  237. if $HAVE_nroff; then
  238. AC_MSG_CHECKING([for manual formatting macros])
  239. AC_CACHE_VAL(mc_cv_mandoc, [
  240. nroff -mandoc < /dev/null > /dev/null 2>&1
  241. if test $? = 0; then
  242. mc_cv_mandoc=-mandoc
  243. else
  244. mc_cv_mandoc=-man
  245. fi
  246. ])
  247. MANDOC=$mc_cv_mandoc
  248. AC_MSG_RESULT([$MANDOC])
  249. AC_MSG_CHECKING([for option to disable ANSI color in manuals])
  250. AC_CACHE_VAL(mc_cv_man_nocolor, [
  251. nroff -c < /dev/null > /dev/null 2>&1
  252. if test $? = 0; then
  253. mc_cv_man_nocolor=-c
  254. else
  255. mc_cv_man_nocolor=
  256. fi
  257. ])
  258. MAN_FLAGS=$mc_cv_man_nocolor
  259. AC_MSG_RESULT([${MAN_NOCOLOR-none}])
  260. AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
  261. AC_CACHE_VAL(mc_cv_nroff_tascii, [
  262. mc_cv_nroff_tascii=
  263. nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
  264. if test $? = 0; then
  265. mc_cv_nroff_tascii=-Tlatin1
  266. else
  267. nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
  268. if test $? = 0; then
  269. mc_cv_nroff_tascii=-Tascii
  270. fi
  271. fi
  272. ])
  273. AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
  274. MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
  275. fi
  276. AC_SUBST(MANDOC)
  277. AC_SUBST(MAN_FLAGS)
  278. dnl
  279. dnl Check for -L option to file
  280. dnl
  281. AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
  282. if $HAVE_FILECMD; then
  283. AC_MSG_CHECKING([for -L option to file command])
  284. AC_CACHE_VAL(mc_cv_filel, [
  285. file -L . > /dev/null 2>&1
  286. if test $? = 0; then
  287. mc_cv_filel=yes
  288. else
  289. mc_cv_filel=no
  290. fi
  291. ])
  292. if test x$mc_cv_filel = xyes; then
  293. AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
  294. fi
  295. filel=$mc_cv_filel
  296. AC_MSG_RESULT([$filel])
  297. fi
  298. AC_MSG_CHECKING([for subshell support])
  299. AC_ARG_WITH(subshell,
  300. [ --with-subshell Compile in concurrent subshell [[yes]]
  301. --with-subshell=optional Don't run concurrent shell by default [[no]]],
  302. [result=no
  303. if test x$withval = xoptional
  304. then
  305. AC_DEFINE(SUBSHELL_OPTIONAL, 1,
  306. [Define to make subshell support optional])
  307. result="optional"
  308. fi
  309. if test x$withval = xyes
  310. then
  311. result="yes"
  312. fi],
  313. [dnl Default: enable the subshell support
  314. result="yes"
  315. ])
  316. if test "x$result" != xno; then
  317. AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
  318. [Define to enable subshell support])
  319. fi
  320. AC_MSG_RESULT([$result])
  321. subshell="$result"
  322. MC_WITH_SCREEN
  323. dnl
  324. dnl Internal editor support.
  325. dnl
  326. AC_ARG_WITH(edit,
  327. [ --with-edit Enable internal editor [[yes]]])
  328. if test x$with_edit != xno; then
  329. AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
  330. use_edit=yes
  331. edit_msg="yes"
  332. AC_MSG_NOTICE([using internal editor])
  333. else
  334. edit_msg="no"
  335. fi
  336. dnl
  337. dnl Diff viewer support.
  338. dnl
  339. AC_ARG_WITH(diff_viewer,
  340. [ --with-diff-viewer Compile with diff viewer [[yes]]])
  341. if test x$with_diff_viewer != xno; then
  342. AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
  343. use_diff=yes
  344. diff_msg="yes"
  345. AC_MSG_NOTICE([using diff viewer])
  346. else
  347. diff_msg="no"
  348. fi
  349. dnl Check if the OS is supported by the console saver.
  350. cons_saver=""
  351. case $host_os in
  352. linux*)
  353. cons_saver=yes
  354. esac
  355. dnl Support for background operations
  356. AC_ARG_ENABLE([background],
  357. [ --enable-background Support for background file operations [[yes]]])
  358. if test "x$enable_background" != xno; then
  359. AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations])
  360. fi
  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. AC_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/uha
  463. src/vfs/extfs/helpers/ulha
  464. src/vfs/extfs/helpers/urar
  465. src/vfs/extfs/helpers/uzip
  466. src/vfs/extfs/helpers/uzoo
  467. src/vfs/fish/Makefile
  468. src/vfs/fish/helpers/Makefile
  469. src/vfs/ftpfs/Makefile
  470. src/vfs/local/Makefile
  471. src/vfs/sfs/Makefile
  472. src/vfs/smbfs/Makefile
  473. src/vfs/tar/Makefile
  474. src/vfs/undelfs/Makefile
  475. lib/Makefile
  476. lib/event/Makefile
  477. lib/filehighlight/Makefile
  478. lib/mcconfig/Makefile
  479. lib/search/Makefile
  480. lib/skin/Makefile
  481. lib/strutil/Makefile
  482. lib/tty/Makefile
  483. lib/vfs/Makefile
  484. lib/widget/Makefile
  485. misc/syntax/Makefile
  486. doc/Makefile
  487. doc/hints/Makefile
  488. doc/man/mc.1 doc/man/mcedit.1 doc/man/mcview.1 doc/man/Makefile
  489. doc/man/es/mc.1 doc/man/es/Makefile
  490. doc/man/hu/mc.1 doc/man/hu/Makefile
  491. doc/man/it/mc.1 doc/man/it/Makefile
  492. doc/man/pl/mc.1 doc/man/pl/Makefile
  493. doc/man/ru/mc.1 doc/man/ru/Makefile
  494. doc/man/sr/mc.1 doc/man/sr/Makefile
  495. doc/hlp/Makefile
  496. doc/hlp/es/Makefile
  497. doc/hlp/hu/Makefile
  498. doc/hlp/it/Makefile
  499. doc/hlp/pl/Makefile
  500. doc/hlp/ru/Makefile
  501. doc/hlp/sr/Makefile
  502. intl/Makefile
  503. po/Makefile.in
  504. ])
  505. if test x$enable_tests != xno; then
  506. AC_CONFIG_FILES([
  507. lib/tests/Makefile
  508. ])
  509. fi
  510. AC_OUTPUT
  511. echo "
  512. Configuration:
  513. Source code location: ${srcdir}
  514. Compiler: ${CC}
  515. Compiler flags: ${CFLAGS}
  516. File system: ${vfs_type}
  517. ${vfs_flags}
  518. Screen library: ${screen_msg}
  519. Mouse support: ${mouse_lib}
  520. X11 events support: ${textmode_x11_support}
  521. With subshell support: ${subshell}
  522. Internal editor: ${edit_msg}
  523. Diff viewer: ${diff_msg}
  524. Support for charset: ${charset_msg}
  525. Search type: ${SEARCH_TYPE}
  526. "