Fix of mouse and ca capabilities check.
[midnight-commander.git] / configure.ac
blob4f2eab93357ec77526a961ea8de679bbaeba3293
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
5 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
6 AC_PREREQ(2.60)
7 m4_pattern_forbid(MC_)
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_SRCDIR(src/main.c)
10 AC_CONFIG_AUX_DIR(config)
11 MC_VERSION
12 AM_INIT_AUTOMAKE(mc, ${VERSION} )
14 dnl Enable silent rules by default (if yes)
15 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
17 AM_CONFIG_HEADER(config.h)
18 AM_MAINTAINER_MODE
19 AC_CANONICAL_HOST
21 AC_USE_SYSTEM_EXTENSIONS
23 AC_PROG_LIBTOOL
24 PKG_PROG_PKG_CONFIG
25 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
27 AC_ISC_POSIX
29 AC_PROG_CC_STDC
30 AM_PROG_CC_C_O
32 dnl Doxygen
34 DX_HTML_FEATURE(ON)
35 DX_CHM_FEATURE(OFF)
36 DX_CHI_FEATURE(OFF)
37 DX_MAN_FEATURE(OFF)
38 DX_RTF_FEATURE(OFF)
39 DX_XML_FEATURE(OFF)
40 DX_PDF_FEATURE(OFF)
41 DX_PS_FEATURE(OFF)
42 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
44 dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
46 dnl
47 dnl First try glib 2.x.
48 dnl Keep this check close to the beginning, so that the users
49 dnl without any glib won't have their time wasted by other checks.
50 dnl
52 AC_ARG_WITH([glib_static],
53             [  --with-glib-static       Link glib statically [[no]]])
55 glib_found=no
57 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8], [glib_found=yes], [:])
58 if test x"$glib_found" = xno; then
59     AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.8)])
63 AC_HEADER_MAJOR
64 AC_C_CONST
65 AC_SYS_LARGEFILE
67 AC_PROG_LN_S
68 AC_CHECK_TOOL(AR, ar, ar)
70 dnl Only list browsers here that can be run in background (i.e. with `&')
71 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
73 dnl
74 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
75 dnl We use only part of the functionality of mmap, so on AIX,
76 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
77 dnl
78 AC_ARG_WITH(mmap,
79         [  --with-mmap              Use the mmap call [[yes if found]]])
80 if test x$with_mmap != xno; then
81     if test x$with_mmap = x; then
82         AC_FUNC_MMAP
83     else
84         AC_DEFINE(HAVE_MMAP, 1)
85     fi
88 dnl
89 dnl Internationalization
90 dnl
91 AM_GNU_GETTEXT(no-libtool, need-ngettext)
92 AM_GNU_GETTEXT_VERSION(0.14.3)
94 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
95     CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
98 dnl Determine which help translations we want to install.
99 ALL_DOC_LINGUAS="es hu it pl ru sr"
101 DOC_LINGUAS=
102 if test "x$USE_NLS" = xyes; then
103     if test -z "$LINGUAS"; then
104         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
105     else
106         langs="$LINGUAS"
107     fi
108 else
109     langs=
112 for h_lang in $ALL_DOC_LINGUAS; do
113     for lang in $langs; do
114         if test "$lang" = "$h_lang"; then
115             DOC_LINGUAS="$DOC_LINGUAS $lang"
116             break
117         fi
118     done
119 done
120 AC_SUBST(DOC_LINGUAS)
123 dnl OS specific flags.
125 case $host_os in
126 aux*)
127     # A/UX
128     LIBS="$LIBS -lposix"
129     AC_DEFINE(_POSIX_SOURCE)
130     ;;
131 esac
133 AC_PROG_INSTALL
134 AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
135         utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
136         sys/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
137         security/pam_misc.h sys/socket.h sys/sysmacros.h sys/types.h \
138         sys/mkdev.h wchar.h wctype.h])
140 AC_HEADER_TIME
141 AC_HEADER_DIRENT
142 AC_HEADER_STDC
144 dnl Missing structure components
145 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
146 AC_STRUCT_ST_BLOCKS
149 dnl Check availability of some functions
152 AC_CHECK_FUNCS([\
153         atoll \
154         cfgetospeed \
155         initgroups isascii \
156         setreuid statfs sysconf \
157         tcgetattr tcsetattr truncate \
158         strverscmp \
159         strncasecmp \
160         realpath
164 dnl getpt is a GNU Extension (glibc 2.1.x)
166 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
167 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
169 dnl replacing lstat with statlstat on sco makes it more portable between
170 dnl sco clones
171 AC_CHECK_FUNCS(statlstat)
174 dnl If running under AIX, AC_AIX does not tell us that
176 AC_MSG_CHECKING([for AIX defines])
177 AC_EGREP_CPP(yes,
178 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
180 #endif
181 ], [
182 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
183 AC_MSG_RESULT(yes)
184 ], [AC_MSG_RESULT(no)])
187 dnl Missing typedefs and replacements
190 AC_CHECK_SIZEOF(long)
191 AC_TYPE_UINTMAX_T
192 AC_CHECK_SIZEOF(uintmax_t)
193 AC_TYPE_OFF_T
194 AC_CHECK_SIZEOF(off_t)
195 AC_TYPE_MODE_T
196 AC_TYPE_PID_T
197 AC_TYPE_UID_T
198 AC_CHECK_TYPE(nlink_t, unsigned int)
199 AC_CHECK_TYPES([socklen_t],,,
201 #include <sys/types.h>
202 #include <sys/socket.h>
205 dnl This is needed for regex.c only
206 AC_CHECK_TYPE(uintptr_t,
207               [AC_DEFINE(HAVE_UINTPTR_T, 1,
208                          [Define if you have the `uintptr_t' type.])
211 AC_FUNC_ALLOCA
212 AC_FUNC_STRCOLL
215 dnl This is from GNU fileutils, check aclocal.m4 for more information
216 dnl uintmat_t is required for FS info
218 AC_GET_FS_INFO
221 dnl X11 support.
222 dnl Used to read keyboard modifiers when running under X11.
223 AC_PATH_XTRA
225 dnl Check if the gmodule functionality supported on this system.
226 AC_G_MODULE_SUPPORTED
229 dnl Try to find static libraries for glib and gmodule.
231 if test x$with_glib_static = xyes; then
232     new_GLIB_LIBS=
233     for i in $GLIB_LIBS; do
234         case x$i in
235         x-lglib*)
236             lib=glib ;;
237         x-lgmodule*)
238             lib=gmodule ;;
239         *)
240             lib=
241             add="$i" ;;
242         esac
244         if test -n "$lib"; then
245             lib1=`echo $i | sed 's/^-l//'`
246             if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then
247                 add="$GLIB_LIBDIR/lib${lib1}.a"
248             else
249                 if test -f "$GLIB_LIBDIR/lib${lib}.a"; then
250                     add="$GLIB_LIBDIR/lib${lib}.a"
251                 else
252                     AC_MSG_ERROR([Cannot find static $lib])
253                 fi
254             fi
255         fi
256         new_GLIB_LIBS="$new_GLIB_LIBS $add"
257     done
258     GLIB_LIBS="$new_GLIB_LIBS"
262 dnl Sequent wants getprocessstats
264 AC_CHECK_LIB(seq, get_process_stats, [
265         LIBS="$LIBS -lseq"
266         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
267                   [Define if you have function `get_process_stats' and
268 have to use that instead of gettimeofday])])
270 AC_MC_VFS_CHECKS
273 dnl Check for gpm mouse support (Linux only)
275 mouse_lib="xterm only"
276 AC_ARG_WITH(gpm-mouse,
277         [  --with-gpm-mouse         Compile with gpm mouse support (Linux only)
278                            [[yes if found]]])
280 case $host_os in
281 linux*)
282     if test x$with_gpm_mouse != xno; then
283         AC_CHECK_LIB(gpm, Gpm_Repeat,
284             [AC_DEFINE(HAVE_LIBGPM, 1,
285                        [Define to enable gpm mouse support on Linux])
286             mouse_lib="gpm and xterm"
287             MCLIBS="$MCLIBS -lgpm"],
288             if test "x$with_gpm_mouse" = "xyes"; then
289                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
290             else
291                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
292             fi
293         )
294     fi
295     ;;
296 esac
298 MC_CHECK_SEARCH_TYPE
301 dnl Check nroff and the options it supports
303 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
305 dnl Default values
306 MANDOC=-man
307 MAN_FLAGS=
309 if $HAVE_nroff; then
310     AC_MSG_CHECKING([for manual formatting macros])
311     AC_CACHE_VAL(mc_cv_mandoc, [
312     nroff -mandoc < /dev/null > /dev/null 2>&1
313     if test $? = 0; then
314         mc_cv_mandoc=-mandoc
315     else
316         mc_cv_mandoc=-man
317     fi
318     ])
319     MANDOC=$mc_cv_mandoc
320     AC_MSG_RESULT([$MANDOC])
322     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
323     AC_CACHE_VAL(mc_cv_man_nocolor, [
324     nroff -c < /dev/null > /dev/null 2>&1
325     if test $? = 0; then
326         mc_cv_man_nocolor=-c
327     else
328         mc_cv_man_nocolor=
329     fi
330     ])
331     MAN_FLAGS=$mc_cv_man_nocolor
332     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
334     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
335     AC_CACHE_VAL(mc_cv_nroff_tascii, [
336     mc_cv_nroff_tascii=
337     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
338     if test $? = 0; then
339         mc_cv_nroff_tascii=-Tlatin1
340     else
341         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
342         if test $? = 0; then
343             mc_cv_nroff_tascii=-Tascii
344         fi
345     fi
346     ])
347     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
348     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
351 AC_SUBST(MANDOC)
352 AC_SUBST(MAN_FLAGS)
356 dnl Check for -L option to file
358 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
359 if $HAVE_FILECMD; then
360     AC_MSG_CHECKING([for -L option to file command])
361     AC_CACHE_VAL(mc_cv_filel, [
362     file -L . > /dev/null 2>&1
363     if test $? = 0; then
364         mc_cv_filel=yes
365     else
366         mc_cv_filel=no
367     fi
368     ])
369     if test x$mc_cv_filel = xyes; then
370         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
371     fi
372     filel=$mc_cv_filel
373     AC_MSG_RESULT([$filel])
377 AC_MSG_CHECKING([for subshell support])
378 AC_ARG_WITH(subshell,
379         [  --with-subshell          Compile in concurrent subshell [[yes]]
380   --with-subshell=optional Don't run concurrent shell by default [[no]]],
381         [result=no
382         if test x$withval = xoptional
383         then
384                 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
385                           [Define to make subshell support optional])
386                 result="optional"
387         fi
388         if test x$withval = xyes
389         then
390                 result="yes"
391         fi],
392         [dnl Default: enable the subshell support
393         result="yes"
395 if test "x$result" != xno; then
396         AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
397                   [Define to enable subshell support])
399 AC_MSG_RESULT([$result])
400 subshell="$result"
403 MC_WITH_SCREEN
407 dnl Internal editor support.
409 AC_ARG_WITH(edit,
410         [  --with-edit              Enable internal editor [[yes]]])
412 if test x$with_edit != xno; then
413         AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
414         use_edit=yes
415         edit_msg="yes"
416         AC_MSG_NOTICE([using internal editor])
417 else
418         edit_msg="no"
422 dnl Diff viewer support.
424 AC_ARG_WITH(diff_viewer,
425         [  --with-diff-viewer       Compile with diff viewer [[yes]]])
427 if test x$with_diff_viewer != xno; then
428         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
429         use_diff=yes
430         diff_msg="yes"
431         AC_MSG_NOTICE([using diff viewer])
432 else
433         diff_msg="no"
437 dnl Check if the OS is supported by the console saver.
438 cons_saver=""
439 case $host_os in
440 linux*)
441     cons_saver=yes
442 esac
445 dnl Support for background operations
446 AC_ARG_ENABLE([background],
447               [  --enable-background     Support for background file operations [[yes]]])
448 if test "x$enable_background" != xno; then
449     AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations])
454 dnl User visible support for charset conversion.
456 AC_ARG_ENABLE([charset],
457               [  --enable-charset        Support for charset selection and conversion [[yes]]])
458 have_charset=
459 charset_msg="no"
460 if test "x$enable_charset" != "xno"; then
461     AC_DEFINE(HAVE_CHARSET, 1,
462               [Define to enable charset selection and conversion])
463     have_charset=yes
464     charset_msg="yes"
467 if test "$GLIBC21" != yes; then
468     AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
471 MC_CHECK_CFLAGS
473 CFLAGS_OPTS=""
475 if test "x$CFLAGS" = "x"; then
476     CFLAGS_OPTS=" -O2 "
479 if test x$USE_MAINTAINER_MODE = xyes; then
480     CFLAGS_OPTS="-g3 -O -ggdb"
481     AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
484 AC_ARG_ENABLE(
485     [werror],
486     AC_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors] )
489 if test "x$enable_werror" = xyes; then
490     MC_CHECK_ONE_CFLAG([-Werror])
492 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
494 AC_SUBST(CFLAGS)
495 AC_SUBST(CPPFLAGS)
496 AC_SUBST(LDFLAGS)
497 AC_SUBST(LIBS)
499 dnl Libraries used only when building the mc binary
500 AC_SUBST(MCLIBS)
502 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
503 AC_SUBST(MAN_DATE)
505 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
506 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
507 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
508 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
509 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
510 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
511 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
513 AC_CONFIG_FILES(
515 src/man2hlp/man2hlp
518 chmod +x src/man2hlp/man2hlp
521 AC_CONFIG_FILES([
522 Makefile
524 contrib/Makefile
525 contrib/dist/Makefile
526 contrib/dist/debian/Makefile
527 contrib/dist/gentoo/Makefile
528 contrib/dist/redhat/Makefile
529 contrib/dist/redhat/mc.spec
530 contrib/dist/pkginfo
531 contrib/dist/prototype
533 misc/Makefile
534 misc/skins/Makefile
535 misc/mc.ext
537 src/Makefile
538 src/consaver/Makefile
539 src/editor/Makefile
540 src/man2hlp/Makefile
541 src/viewer/Makefile
542 src/diffviewer/Makefile
543 src/filemanager/Makefile
545 lib/Makefile
546 lib/filehighlight/Makefile
547 lib/mcconfig/Makefile
548 lib/search/Makefile
549 lib/skin/Makefile
550 lib/strutil/Makefile
551 lib/tty/Makefile
552 lib/vfs/Makefile
553 lib/vfs/mc-vfs/Makefile
554 lib/vfs/mc-vfs/extfs/Makefile
555 lib/vfs/mc-vfs/extfs/a+
556 lib/vfs/mc-vfs/extfs/apt+
557 lib/vfs/mc-vfs/extfs/audio
558 lib/vfs/mc-vfs/extfs/deb
559 lib/vfs/mc-vfs/extfs/deba
560 lib/vfs/mc-vfs/extfs/debd
561 lib/vfs/mc-vfs/extfs/dpkg+
562 lib/vfs/mc-vfs/extfs/iso9660
563 lib/vfs/mc-vfs/extfs/hp48+
564 lib/vfs/mc-vfs/extfs/lslR
565 lib/vfs/mc-vfs/extfs/mailfs
566 lib/vfs/mc-vfs/extfs/patchfs
567 lib/vfs/mc-vfs/extfs/rpms+
568 lib/vfs/mc-vfs/extfs/s3+
569 lib/vfs/mc-vfs/extfs/uace
570 lib/vfs/mc-vfs/extfs/ualz
571 lib/vfs/mc-vfs/extfs/uar
572 lib/vfs/mc-vfs/extfs/uarc
573 lib/vfs/mc-vfs/extfs/uarj
574 lib/vfs/mc-vfs/extfs/uc1541
575 lib/vfs/mc-vfs/extfs//ucab
576 lib/vfs/mc-vfs/extfs/uha
577 lib/vfs/mc-vfs/extfs/ulha
578 lib/vfs/mc-vfs/extfs/urar
579 lib/vfs/mc-vfs/extfs/uzip
580 lib/vfs/mc-vfs/extfs/uzoo
581 lib/vfs/mc-vfs/fish/Makefile
582 lib/widget/Makefile
584 misc/syntax/Makefile
586 doc/Makefile
587 doc/hints/Makefile
588 doc/man/mc.1 doc/man/mcedit.1 doc/man/mcview.1 doc/man/Makefile
589 doc/man/es/mc.1 doc/man/es/Makefile
590 doc/man/hu/mc.1 doc/man/hu/Makefile
591 doc/man/it/mc.1 doc/man/it/Makefile
592 doc/man/pl/mc.1 doc/man/pl/Makefile
593 doc/man/ru/mc.1 doc/man/ru/Makefile
594 doc/man/sr/mc.1 doc/man/sr/Makefile
596 doc/hlp/Makefile
597 doc/hlp/es/Makefile
598 doc/hlp/hu/Makefile
599 doc/hlp/it/Makefile
600 doc/hlp/pl/Makefile
601 doc/hlp/ru/Makefile
602 doc/hlp/sr/Makefile
604 intl/Makefile
605 po/Makefile.in
608 AC_OUTPUT
610 echo "
611 Configuration:
613   Source code location:       ${srcdir}
614   Compiler:                   ${CC}
615   Compiler flags:             ${CFLAGS}
616   File system:                ${vfs_type}
617                               ${vfs_flags}
618   Screen library:             ${screen_msg}
619   Mouse support:              ${mouse_lib}
620   X11 events support:         ${textmode_x11_support}
621   With subshell support:      ${subshell}
622   Internal editor:            ${edit_msg}
623   Diff viewer:                ${diff_msg}
624   Support for charset:        ${charset_msg}
625   Search type:                ${SEARCH_TYPE}