configure.ac 14 KB

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