Ticket #2851: fixes of ext.d scripts:
[midnight-commander.git] / configure.ac
blob0ffb31c35c4d8bddaae7c61397d2d3cfb7ab0dd4
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 LIBMC_VERSION="0.0.1"
15 LIBMC_RELEASE="1"
16 AC_SUBST(LIBMC_VERSION)
17 AC_SUBST(LIBMC_RELEASE)
19 dnl Enable silent rules by default (if yes)
20 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
22 AM_CONFIG_HEADER(config.h)
23 AM_MAINTAINER_MODE
24 AC_CANONICAL_HOST
26 AC_USE_SYSTEM_EXTENSIONS
28 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS],["$ac_configure_args"],[MC configure arguments])
30 AC_PROG_LIBTOOL
31 PKG_PROG_PKG_CONFIG
32 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
34 AC_ISC_POSIX
36 AC_PROG_CC_STDC
37 AM_PROG_CC_C_O
39 dnl Doxygen
41 DX_HTML_FEATURE(ON)
42 DX_CHM_FEATURE(OFF)
43 DX_CHI_FEATURE(OFF)
44 DX_MAN_FEATURE(OFF)
45 DX_RTF_FEATURE(OFF)
46 DX_XML_FEATURE(OFF)
47 DX_PDF_FEATURE(OFF)
48 DX_PS_FEATURE(OFF)
49 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
51 dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
53 AC_CHECK_GLIB
54 AC_G_MODULE_SUPPORTED
56 AC_ARG_ENABLE([mclib],
57         [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
58         [
59             if test "x$enableval" = "xno" ; then
60                 enable_mclib=no
61             else
62                 if test "x$enable_shared" = "xno" ; then
63                     AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
64                     enable_mclib=no
65                 else
66                     enable_mclib=yes
67                 fi
68             fi
69         ],
70         [enable_mclib=no])
72 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
74 AC_HEADER_MAJOR
75 AC_C_CONST
76 dnl Check this before type sizeof checks
77 AC_SYS_LARGEFILE
79 AC_PROG_LN_S
80 AC_CHECK_TOOL(AR, ar, ar)
82 dnl Only list browsers here that can be run in background (i.e. with `&')
83 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
85 dnl
86 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
87 dnl We use only part of the functionality of mmap, so on AIX,
88 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
89 dnl
90 AC_ARG_WITH(mmap,
91         [  --with-mmap              Use the mmap call [[yes if found]]])
92 if test x$with_mmap != xno; then
93     if test x$with_mmap = x; then
94         AC_FUNC_MMAP
95     else
96         AC_DEFINE(HAVE_MMAP, 1)
97     fi
101 dnl Internationalization
103 AM_GNU_GETTEXT(no-libtool, need-ngettext)
104 AM_GNU_GETTEXT_VERSION(0.14.3)
106 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
107     CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
110 dnl Determine which help translations we want to install.
111 ALL_DOC_LINGUAS="es hu it pl ru sr"
113 DOC_LINGUAS=
114 if test "x$USE_NLS" = xyes; then
115     if test -z "$LINGUAS"; then
116         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
117     else
118         langs="$LINGUAS"
119     fi
120 else
121     langs=
124 for h_lang in $ALL_DOC_LINGUAS; do
125     for lang in $langs; do
126         if test "$lang" = "$h_lang"; then
127             DOC_LINGUAS="$DOC_LINGUAS $lang"
128             break
129         fi
130     done
131 done
132 AC_SUBST(DOC_LINGUAS)
135 dnl OS specific flags.
137 case $host_os in
138 aux*)
139     # A/UX
140     LIBS="$LIBS -lposix"
141     AC_DEFINE(_POSIX_SOURCE)
142     ;;
143 esac
145 AC_PROG_INSTALL
146 AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
147         utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
148         sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
149         sys/socket.h sys/sysmacros.h sys/types.h sys/mkdev.h])
151 AC_HEADER_TIME
152 AC_HEADER_DIRENT
153 AC_HEADER_ASSERT
155 dnl Missing structure components
156 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
157 AC_STRUCT_ST_BLOCKS
160 dnl Check availability of some functions
163 AC_CHECK_FUNCS([\
164         atoll \
165         isascii \
166         statfs sysconf \
167         tcgetattr tcsetattr \
168         ftruncate \
169         strverscmp \
170         strncasecmp \
171         realpath
175 dnl getpt is a GNU Extension (glibc 2.1.x)
177 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
178 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
180 dnl replacing lstat with statlstat on sco makes it more portable between
181 dnl sco clones
182 AC_CHECK_FUNCS(statlstat)
185 dnl If running under AIX, AC_AIX does not tell us that
187 AC_MSG_CHECKING([for AIX defines])
188 AC_EGREP_CPP(yes,
189 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
191 #endif
192 ], [
193 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
194 AC_MSG_RESULT(yes)
195 ], [AC_MSG_RESULT(no)])
198 dnl Missing typedefs and replacements
201 AC_CHECK_SIZEOF(long)
202 AC_TYPE_UINTMAX_T
203 AC_CHECK_SIZEOF(uintmax_t)
204 AC_TYPE_OFF_T
205 AC_CHECK_SIZEOF(off_t)
206 AC_TYPE_MODE_T
207 AC_TYPE_PID_T
208 AC_TYPE_UID_T
210 AC_FUNC_STRCOLL
212 mc_AC_GET_FS_INFO
214 dnl X11 support.
215 dnl Used to read keyboard modifiers when running under X11.
216 MC_WITH_X
219 dnl Sequent wants getprocessstats
221 AC_CHECK_LIB(seq, get_process_stats, [
222         LIBS="$LIBS -lseq"
223         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
224                   [Define if you have function `get_process_stats' and
225 have to use that instead of gettimeofday])])
227 AC_MC_VFS_CHECKS
230 dnl Check for gpm mouse support (Linux only)
232 mouse_lib="xterm only"
233 AC_ARG_WITH(gpm-mouse,
234         [  --with-gpm-mouse         Compile with gpm mouse support (Linux only)
235                            [[yes if found]]])
237 case $host_os in
238 linux*)
239     if test x$with_gpm_mouse != xno; then
240         AC_CHECK_LIB(gpm, Gpm_Repeat,
241             [AC_DEFINE(HAVE_LIBGPM, 1,
242                        [Define to enable gpm mouse support on Linux])
243             mouse_lib="gpm and xterm"
244             MCLIBS="$MCLIBS -lgpm"],
245             if test "x$with_gpm_mouse" = "xyes"; then
246                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
247             else
248                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
249             fi
250         )
251     fi
252     ;;
253 esac
255 MC_CHECK_SEARCH_TYPE
258 dnl Check nroff and the options it supports
260 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
262 dnl Default values
263 MANDOC=-man
264 MAN_FLAGS=
266 if $HAVE_nroff; then
267     AC_MSG_CHECKING([for manual formatting macros])
268     AC_CACHE_VAL(mc_cv_mandoc, [
269     nroff -mandoc < /dev/null > /dev/null 2>&1
270     if test $? = 0; then
271         mc_cv_mandoc=-mandoc
272     else
273         mc_cv_mandoc=-man
274     fi
275     ])
276     MANDOC=$mc_cv_mandoc
277     AC_MSG_RESULT([$MANDOC])
279     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
280     AC_CACHE_VAL(mc_cv_man_nocolor, [
281     nroff -c < /dev/null > /dev/null 2>&1
282     if test $? = 0; then
283         mc_cv_man_nocolor=-c
284     else
285         mc_cv_man_nocolor=
286     fi
287     ])
288     MAN_FLAGS=$mc_cv_man_nocolor
289     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
291     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
292     AC_CACHE_VAL(mc_cv_nroff_tascii, [
293     mc_cv_nroff_tascii=
294     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
295     if test $? = 0; then
296         mc_cv_nroff_tascii=-Tlatin1
297     else
298         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
299         if test $? = 0; then
300             mc_cv_nroff_tascii=-Tascii
301         fi
302     fi
303     ])
304     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
305     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
308 AC_SUBST(MANDOC)
309 AC_SUBST(MAN_FLAGS)
313 dnl Check for -L option to file
315 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
316 if $HAVE_FILECMD; then
317     AC_MSG_CHECKING([for -L option to file command])
318     AC_CACHE_VAL(mc_cv_filel, [
319     file -L . > /dev/null 2>&1
320     if test $? = 0; then
321         mc_cv_filel=yes
322     else
323         mc_cv_filel=no
324     fi
325     ])
326     if test x$mc_cv_filel = xyes; then
327         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
328     fi
329     filel=$mc_cv_filel
330     AC_MSG_RESULT([$filel])
334 AC_MSG_CHECKING([for subshell support])
335 AC_ARG_WITH(subshell,
336         [  --with-subshell          Compile in concurrent subshell [[yes]]
337   --with-subshell=optional Don't run concurrent shell by default [[no]]],
338         [result=no
339         if test x$withval = xoptional
340         then
341                 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
342                           [Define to make subshell support optional])
343                 result="optional"
344         fi
345         if test x$withval = xyes
346         then
347                 result="yes"
348         fi],
349         [dnl Default: enable the subshell support
350         result="yes"
352 if test "x$result" != xno; then
353         AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
354                   [Define to enable subshell support])
356 AC_MSG_RESULT([$result])
357 subshell="$result"
359 MC_WITH_SCREEN
361 MC_WITH_EDIT
364 dnl Diff viewer support.
366 AC_ARG_WITH(diff_viewer,
367         [  --with-diff-viewer       Compile with diff viewer [[yes]]])
369 if test x$with_diff_viewer != xno; then
370         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
371         use_diff=yes
372         diff_msg="yes"
373         AC_MSG_NOTICE([using diff viewer])
374 else
375         diff_msg="no"
379 dnl Check if the OS is supported by the console saver.
380 cons_saver=""
381 case $host_os in
382 linux*)
383     cons_saver=yes
384 esac
388 dnl Where config files should be placed
391 AC_ARG_WITH([homedir],
392     AS_HELP_STRING([--with-homedir], [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
393     [
394         if test "x$withval" = "xXDG"; then
395             with_homedir=XDG
396         else
397             with_homedir=$withval
398         fi
399     ],
400     [with_homedir=XDG])
403 if test x$with_homedir = xXDG; then
404     AC_DEFINE(MC_HOMEDIR_XDG, 1,
405         [Define to enable XDG standard support])
406 else
407     AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
411 MC_BACKGROUND
415 dnl User visible support for charset conversion.
417 AC_ARG_ENABLE([charset],
418               [  --enable-charset        Support for charset selection and conversion [[yes]]])
419 have_charset=
420 charset_msg="no"
421 if test "x$enable_charset" != "xno"; then
422     AC_DEFINE(HAVE_CHARSET, 1,
423               [Define to enable charset selection and conversion])
424     have_charset=yes
425     charset_msg="yes"
428 if test "$GLIBC21" != yes; then
429     AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
432 MC_CHECK_CFLAGS
434 CFLAGS_OPTS=""
436 if test "x$CFLAGS" = "x"; then
437     CFLAGS_OPTS=" -O2 "
440 if test x$USE_MAINTAINER_MODE = xyes; then
441     CFLAGS_OPTS="-g3 -O -ggdb"
442     AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
445 AC_ARG_ENABLE(
446     [werror],
447     AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors])
450 if test "x$enable_werror" = xyes; then
451     MC_CHECK_ONE_CFLAG([-Werror])
453 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
455 MC_UNIT_TESTS
457 AC_SUBST(CFLAGS)
458 AC_SUBST(CPPFLAGS)
459 AC_SUBST(LDFLAGS)
460 AC_SUBST(LIBS)
462 dnl Libraries used only when building the mc binary
463 AC_SUBST(MCLIBS)
466 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
467     EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
468 else
469     EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
471 AC_SUBST(EXTHELPERSDIR)
473 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
474 AC_SUBST(MAN_DATE)
476 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
477 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
478 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
479 AM_CONDITIONAL(USE_EDIT, [test x"$use_edit" = xyes ])
480 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
481 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
482 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
483 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
485 AC_CONFIG_FILES(
487 src/man2hlp/man2hlp
490 chmod +x src/man2hlp/man2hlp
493 AC_CONFIG_FILES([
494 Makefile
496 contrib/Makefile
497 contrib/dist/Makefile
498 contrib/dist/debian/Makefile
499 contrib/dist/gentoo/Makefile
500 contrib/dist/redhat/Makefile
501 contrib/dist/redhat/mc.spec
502 contrib/dist/pkginfo
503 contrib/dist/prototype
505 misc/Makefile
506 misc/skins/Makefile
507 misc/ext.d/Makefile
508 misc/ext.d/doc.sh
509 misc/ext.d/misc.sh
510 misc/ext.d/text.sh
511 misc/ext.d/web.sh
512 misc/macros.d/Makefile
513 misc/mc.ext
515 src/Makefile
516 src/consaver/Makefile
517 src/editor/Makefile
518 src/man2hlp/Makefile
519 src/viewer/Makefile
520 src/diffviewer/Makefile
521 src/filemanager/Makefile
523 src/vfs/Makefile
525 src/vfs/cpio/Makefile
527 src/vfs/extfs/Makefile
528 src/vfs/extfs/helpers/Makefile
529 src/vfs/extfs/helpers/a+
530 src/vfs/extfs/helpers/apt+
531 src/vfs/extfs/helpers/audio
532 src/vfs/extfs/helpers/deb
533 src/vfs/extfs/helpers/deba
534 src/vfs/extfs/helpers/debd
535 src/vfs/extfs/helpers/dpkg+
536 src/vfs/extfs/helpers/iso9660
537 src/vfs/extfs/helpers/hp48+
538 src/vfs/extfs/helpers/lslR
539 src/vfs/extfs/helpers/mailfs
540 src/vfs/extfs/helpers/patchfs
541 src/vfs/extfs/helpers/rpms+
542 src/vfs/extfs/helpers/s3+
543 src/vfs/extfs/helpers/uace
544 src/vfs/extfs/helpers/ualz
545 src/vfs/extfs/helpers/uar
546 src/vfs/extfs/helpers/uarc
547 src/vfs/extfs/helpers/uarj
548 src/vfs/extfs/helpers/uc1541
549 src/vfs/extfs/helpers/ucab
550 src/vfs/extfs/helpers/uha
551 src/vfs/extfs/helpers/ulha
552 src/vfs/extfs/helpers/ulib
553 src/vfs/extfs/helpers/urar
554 src/vfs/extfs/helpers/uzip
555 src/vfs/extfs/helpers/uzoo
557 src/vfs/fish/Makefile
558 src/vfs/fish/helpers/Makefile
560 src/vfs/ftpfs/Makefile
562 src/vfs/sftpfs/Makefile
564 src/vfs/local/Makefile
566 src/vfs/sfs/Makefile
568 src/vfs/smbfs/Makefile
570 src/vfs/tar/Makefile
572 src/vfs/undelfs/Makefile
574 lib/Makefile
575 lib/event/Makefile
576 lib/filehighlight/Makefile
577 lib/mcconfig/Makefile
578 lib/search/Makefile
579 lib/skin/Makefile
580 lib/strutil/Makefile
581 lib/tty/Makefile
583 lib/vfs/Makefile
585 lib/widget/Makefile
587 misc/syntax/Makefile
589 doc/Makefile
590 doc/hints/Makefile
591 doc/man/Makefile
592 doc/man/es/Makefile
593 doc/man/hu/Makefile
594 doc/man/it/Makefile
595 doc/man/pl/Makefile
596 doc/man/ru/Makefile
597 doc/man/sr/Makefile
599 doc/hlp/Makefile
600 doc/hlp/es/Makefile
601 doc/hlp/hu/Makefile
602 doc/hlp/it/Makefile
603 doc/hlp/pl/Makefile
604 doc/hlp/ru/Makefile
605 doc/hlp/sr/Makefile
607 intl/Makefile
608 po/Makefile.in
611 if test x$enable_tests != xno; then
612     AC_CONFIG_FILES([
613 tests/Makefile
614 tests/lib/Makefile
615 tests/lib/mcconfig/Makefile
616 tests/lib/search/Makefile
617 tests/lib/vfs/Makefile
618 tests/src/Makefile
619 tests/src/filemanager/Makefile
625 AC_OUTPUT
627 echo "
628 Configuration:
630   Source code location:       ${srcdir}
631   Compiler:                   ${CC}
632   Compiler flags:             ${CFLAGS}
633   File system:                ${vfs_type}
634                               ${vfs_flags}
635   Screen library:             ${screen_msg}
636   Mouse support:              ${mouse_lib}
637   X11 events support:         ${textmode_x11_support}
638   With subshell support:      ${subshell}
639   With background operations: ${enable_background}
640   Internal editor:            ${edit_msg}
641   Diff viewer:                ${diff_msg}
642   Support for charset:        ${charset_msg}
643   Search type:                ${SEARCH_TYPE}