Rename mc_config_get_profile_root() to mc_get_profile_root()
[midnight-commander.git] / configure.ac
blob04423335b6d964f2e137a90b5984419cfaf635c9
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
5 AC_PREREQ(2.60)
6 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
7 m4_pattern_forbid(MC_)
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_AUX_DIR(config)
10 AC_CONFIG_SRCDIR(src/main.c)
11 AC_CONFIG_HEADERS(config.h)
12 mc_VERSION
13 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_MAINTAINER_MODE
19 AC_CANONICAL_HOST
21 AC_USE_SYSTEM_EXTENSIONS
24 dnl ############################################################################
25 dnl Check for compiler
26 dnl ############################################################################
28 AC_PROG_CC_STDC
29 AM_PROG_CC_C_O
31 mc_CHECK_CFLAGS
33 CFLAGS_OPTS=""
34 if test "x$CFLAGS" = "x"; then
35     CFLAGS_OPTS=" -O2 "
37 if test x$USE_MAINTAINER_MODE = xyes; then
38     CFLAGS_OPTS="-g3 -O -ggdb"
39     AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
42 AC_ARG_ENABLE([werror],
43     AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors]))
44 if test "x$enable_werror" = xyes; then
45     mc_CHECK_ONE_CFLAG([-Werror])
48 AC_PROG_LIBTOOL
51 dnl ############################################################################
52 dnl Check for programs
53 dnl ############################################################################
55 PKG_PROG_PKG_CONFIG
56 AC_PROG_INSTALL
57 AC_PROG_LN_S
58 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
59 AC_PATH_PROG([PYTHON], [python], [/usr/bin/python])
60 AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
62 dnl Check nroff and the options it supports
63 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
64 dnl Default values
65 MANDOC=-man
66 MAN_FLAGS=
67 if $HAVE_nroff; then
68     AC_MSG_CHECKING([for manual formatting macros])
69     AC_CACHE_VAL(mc_cv_mandoc, [
70     nroff -mandoc < /dev/null > /dev/null 2>&1
71     if test $? = 0; then
72         mc_cv_mandoc=-mandoc
73     else
74         mc_cv_mandoc=-man
75     fi
76     ])
77     MANDOC=$mc_cv_mandoc
78     AC_MSG_RESULT([$MANDOC])
80     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
81     AC_CACHE_VAL(mc_cv_man_nocolor, [
82     nroff -c < /dev/null > /dev/null 2>&1
83     if test $? = 0; then
84         mc_cv_man_nocolor=-c
85     else
86         mc_cv_man_nocolor=
87     fi
88     ])
89     MAN_FLAGS=$mc_cv_man_nocolor
90     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
92     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
93     AC_CACHE_VAL(mc_cv_nroff_tascii, [
94     mc_cv_nroff_tascii=
95     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
96     if test $? = 0; then
97         mc_cv_nroff_tascii=-Tlatin1
98     else
99         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
100         if test $? = 0; then
101             mc_cv_nroff_tascii=-Tascii
102         fi
103     fi
104     ])
105     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
106     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
109 AC_SUBST(MANDOC)
110 AC_SUBST(MAN_FLAGS)
112 dnl Check for -L option to file
113 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
114 if $HAVE_FILECMD; then
115     AC_MSG_CHECKING([for -L option to file command])
116     AC_CACHE_VAL(mc_cv_filel, [
117     file -L . > /dev/null 2>&1
118     if test $? = 0; then
119         mc_cv_filel=yes
120     else
121         mc_cv_filel=no
122     fi
123     ])
124     if test x$mc_cv_filel = xyes; then
125         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
126     fi
127     filel=$mc_cv_filel
128     AC_MSG_RESULT([$filel])
131 dnl Only list browsers here that can be run in background (i.e. with `&')
132 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
135 dnl ############################################################################
136 dnl Check for other tools
137 dnl ############################################################################
139 AC_CHECK_TOOL(AR, ar, ar)
140 mc_UNIT_TESTS
143 dnl ############################################################################
144 dnl Check for main libraies
145 dnl ############################################################################
147 mc_CHECK_GLIB
148 mc_G_MODULE_SUPPORTED
149 mc_WITH_SCREEN
150 mc_CHECK_SEARCH_TYPE
151 dnl X11 support. Used to read keyboard modifiers when running under X11.
152 mc_WITH_X
155 dnl ############################################################################
156 dnl Check for header files
157 dnl ############################################################################
159 AC_CHECK_HEADERS([string.h memory.h limits.h malloc.h \
160         utime.h sys/statfs.h sys/vfs.h \
161         sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
162         sys/socket.h])
163 AC_HEADER_MAJOR
166 dnl ############################################################################
167 dnl Check for types
168 dnl ############################################################################
170 dnl Check largefile before type sizeof checks
171 AC_SYS_LARGEFILE
173 AC_CHECK_SIZEOF(long)
174 AC_TYPE_UINTMAX_T
175 AC_CHECK_SIZEOF(uintmax_t)
176 AC_TYPE_OFF_T
177 AC_CHECK_SIZEOF(off_t)
178 AC_TYPE_MODE_T
179 gl_PROMOTED_TYPE_MODE_T
180 AC_TYPE_PID_T
181 AC_TYPE_UID_T
183 AC_STRUCT_ST_BLOCKS
184 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
185 gl_STAT_SIZE
187 AH_TEMPLATE([sig_atomic_t],
188             [/* Define to `int' if <signal.h> doesn't define.])
189 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
190             [Some systems declare sig_atomic_t as volatile, some others -- no.
191              This define will have value `sig_atomic_t' or
192              `volatile sig_atomic_t' accordingly.])
194 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
195 AC_EGREP_HEADER(sig_atomic_t,signal.h,
196   [
197     ac_cv_type_sig_atomic_t=yes;
198     AC_EGREP_HEADER(volatile.*sig_atomic_t,
199                     signal.h,
200                     [
201                         is_sig_atomic_t_volatile=yes;
202                         AC_MSG_RESULT([yes, volatile])
203                     ],
204                     [
205                         is_sig_atomic_t_volatile=no;
206                         AC_MSG_RESULT([yes, non volatile])
207                     ])
208   ],
209   [
210     AC_MSG_RESULT(no)
211     AC_CHECK_TYPE(sig_atomic_t, int)
212     is_sig_atomic_t_volatile=no
213   ])
214 if test $is_sig_atomic_t_volatile = 'yes'
215 then
216     AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
217 else
218     AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
222 dnl ############################################################################
223 dnl Check for functions
224 dnl ############################################################################
226 AC_CHECK_FUNCS([\
227         strverscmp \
228         strncasecmp \
229         realpath
232 dnl getpt is a GNU Extension (glibc 2.1.x)
233 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
234 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
236 dnl replacing lstat with statlstat on sco makes it more portable between
237 dnl sco clones
238 AC_CHECK_FUNCS(statlstat)
240 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
241 dnl We use only part of the functionality of mmap, so on AIX,
242 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
243 AC_ARG_WITH([mmap],
244         AS_HELP_STRING([--with-mmap], [Use the mmap call @<:@yes if found@:>@]))
245 if test x$with_mmap != xno; then
246     if test x$with_mmap = x; then
247         AC_FUNC_MMAP
248     else
249         AC_DEFINE(HAVE_MMAP, 1)
250     fi
253 dnl Sequent wants getprocessstats
254 AC_CHECK_LIB(seq, get_process_stats, [
255         LIBS="$LIBS -lseq"
256         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
257                   [Define if you have function `get_process_stats' and
258 have to use that instead of gettimeofday])])
260 mc_AC_GET_FS_INFO
263 dnl ############################################################################
264 dnl Internationalization
265 dnl ############################################################################
267 AM_GNU_GETTEXT([no-libtool], [need-ngettext])
268 AM_GNU_GETTEXT_VERSION([0.18.1])
270 mc_I18N
272 dnl ############################################################################
273 dnl OS specific flags
274 dnl ############################################################################
276 case $host_os in
277 aux*)
278     # A/UX
279     LIBS="$LIBS -lposix"
280     AC_DEFINE(_POSIX_SOURCE)
281     ;;
282 esac
284 dnl If running under AIX, AC_AIX does not tell us that
285 AC_MSG_CHECKING([for AIX defines])
286 AC_EGREP_CPP([yes],
287     [
288         #if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
289         yes
290         #endif
291     ],
292     [
293         AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
294         AC_MSG_RESULT(yes)
295     ],
296     [
297         AC_MSG_RESULT(no)
298     ])
300 dnl Check if the OS is supported by the console saver.
301 cons_saver=""
302 case $host_os in
303 linux*)
304     cons_saver=yes
305 esac
307 dnl Check for gpm mouse support (Linux only)
308 mouse_lib="xterm only"
309 AC_ARG_WITH([gpm-mouse],
310     AS_HELP_STRING([--with-gpm-mouse], [Compile with gpm mouse support (Linux only) @<:@yes if found@:>@]))
312 case $host_os in
313 linux*)
314     if test x$with_gpm_mouse != xno; then
315         AC_CHECK_LIB(gpm, Gpm_Repeat,
316             [AC_DEFINE(HAVE_LIBGPM, 1,
317                        [Define to enable gpm mouse support on Linux])
318             mouse_lib="gpm and xterm"
319             MCLIBS="$MCLIBS -lgpm"],
320             if test "x$with_gpm_mouse" = "xyes"; then
321                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
322             else
323                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
324             fi
325         )
326     fi
327     ;;
328 esac
331 dnl ############################################################################
332 dnl libmc
333 dnl ############################################################################
335 LIBMC_VERSION="0.0.1"
336 LIBMC_RELEASE="1"
337 AC_SUBST(LIBMC_VERSION)
338 AC_SUBST(LIBMC_RELEASE)
340 AC_ARG_ENABLE([mclib],
341         [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
342         [
343             if test "x$enableval" = "xno" ; then
344                 enable_mclib=no
345             else
346                 if test "x$enable_shared" = "xno" ; then
347                     AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
348                     enable_mclib=no
349                 else
350                     enable_mclib=yes
351                 fi
352             fi
353         ],
354         [enable_mclib=no])
356 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
359 dnl ############################################################################
360 dnl Where config files should be placed
361 dnl ############################################################################
363 AC_ARG_WITH([homedir],
364     AS_HELP_STRING([--with-homedir],
365                    [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
366     [
367         if test "x$withval" = "xXDG"; then
368             with_homedir=XDG
369         else
370             with_homedir=$withval
371         fi
372     ],
373     [with_homedir=XDG])
376 if test x$with_homedir = xXDG; then
377     AC_DEFINE(MC_HOMEDIR_XDG, 1, [Define to enable XDG standard support])
378 else
379     AC_DEFINE(MC_HOMEDIR_XDG, 0, [Define to disable XDG standard support])
380     AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
384 dnl ############################################################################
385 dnl MC options
386 dnl ############################################################################
388 mc_ASSERT
390 mc_WITH_INTERNAL_EDIT
392 dnl Diff viewer support.
393 AC_ARG_WITH([diff_viewer],
394     AS_HELP_STRING([--with-diff-viewer], [Compile with diff viewer @<:@yes@:>@]))
396 if test x$with_diff_viewer != xno; then
397         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
398         use_diff=yes
399         diff_msg="yes"
400         AC_MSG_NOTICE([using diff viewer])
401 else
402         diff_msg="no"
405 mc_SUBSHELL
406 mc_BACKGROUND
407 mc_VFS_CHECKS
409 dnl ############################################################################
410 dnl Directories
411 dnl ############################################################################
413 dnl ${prefix} and ${exec_prefix} are undefined here if --prefix is not used in command line
414 dnl Let define ${prefix} and ${exec_prefix}
415 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
416 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
418 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
419     EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
420 elif test x${libexecdir} = x'${exec_prefix}/lib'; then
421     EXTHELPERSDIR=${prefix}/lib/${PACKAGE}/ext.d
422 else
423     EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
425 AC_SUBST(EXTHELPERSDIR)
428 dnl ############################################################################
429 dnl Documentation
430 dnl ############################################################################
432 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
433 AC_SUBST(MAN_DATE)
435 dnl Determine which help translations we want to install.
436 ALL_DOC_LINGUAS="es hu it pl ru sr"
438 DOC_LINGUAS=
439 if test "x$USE_NLS" = xyes; then
440     if test -z "$LINGUAS"; then
441         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
442     else
443         langs="$LINGUAS"
444     fi
445 else
446     langs=
449 for h_lang in $ALL_DOC_LINGUAS; do
450     for lang in $langs; do
451         if test "$lang" = "$h_lang"; then
452             DOC_LINGUAS="$DOC_LINGUAS $lang"
453             break
454         fi
455     done
456 done
457 AC_SUBST(DOC_LINGUAS)
459 DX_HTML_FEATURE(ON)
460 DX_CHM_FEATURE(OFF)
461 DX_CHI_FEATURE(OFF)
462 DX_MAN_FEATURE(OFF)
463 DX_RTF_FEATURE(OFF)
464 DX_XML_FEATURE(OFF)
465 DX_PDF_FEATURE(OFF)
466 DX_PS_FEATURE(OFF)
467 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
470 dnl ############################################################################
471 dnl Configure results
472 dnl ############################################################################
474 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
476 AC_SUBST(MCLIBS)
477 AC_SUBST(CFLAGS)
478 AC_SUBST(CPPFLAGS)
479 AC_SUBST(LDFLAGS)
480 AC_SUBST(LIBS)
482 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
483 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
484 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
485 AM_CONDITIONAL(USE_INTERNAL_EDIT, [test x"$use_internal_edit" = xyes ])
486 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
487 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
488 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
489 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
490 dnl Clarify do we really need GModule
491 AM_CONDITIONAL([HAVE_GMODULE], [test -n "$g_module_supported" && \
492                                 test x"$textmode_x11_support" = x"yes" -o x"$enable_aspell" = x"yes"])
494 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
496 AC_CONFIG_FILES(
498 src/man2hlp/man2hlp
501 chmod +x src/man2hlp/man2hlp
504 AC_CONFIG_FILES([
505 Makefile
507 contrib/Makefile
508 contrib/dist/Makefile
509 contrib/dist/gentoo/Makefile
510 contrib/dist/redhat/Makefile
511 contrib/dist/redhat/mc.spec
512 contrib/dist/pkginfo
513 contrib/dist/prototype
515 misc/Makefile
516 misc/mc.menu
517 misc/mcedit.menu
518 misc/skins/Makefile
519 misc/ext.d/Makefile
520 misc/ext.d/doc.sh
521 misc/ext.d/misc.sh
522 misc/ext.d/text.sh
523 misc/ext.d/web.sh
524 misc/macros.d/Makefile
525 misc/mc.ext
527 src/Makefile
528 src/consaver/Makefile
529 src/editor/Makefile
530 src/man2hlp/Makefile
531 src/subshell/Makefile
532 src/viewer/Makefile
533 src/diffviewer/Makefile
534 src/filemanager/Makefile
536 src/vfs/Makefile
538 src/vfs/cpio/Makefile
540 src/vfs/extfs/Makefile
541 src/vfs/extfs/helpers/Makefile
542 src/vfs/extfs/helpers/a+
543 src/vfs/extfs/helpers/apt+
544 src/vfs/extfs/helpers/audio
545 src/vfs/extfs/helpers/deb
546 src/vfs/extfs/helpers/deba
547 src/vfs/extfs/helpers/debd
548 src/vfs/extfs/helpers/dpkg+
549 src/vfs/extfs/helpers/iso9660
550 src/vfs/extfs/helpers/hp48+
551 src/vfs/extfs/helpers/lslR
552 src/vfs/extfs/helpers/mailfs
553 src/vfs/extfs/helpers/patchfs
554 src/vfs/extfs/helpers/rpms+
555 src/vfs/extfs/helpers/s3+
556 src/vfs/extfs/helpers/uace
557 src/vfs/extfs/helpers/ualz
558 src/vfs/extfs/helpers/uar
559 src/vfs/extfs/helpers/uarc
560 src/vfs/extfs/helpers/uarj
561 src/vfs/extfs/helpers/uc1541
562 src/vfs/extfs/helpers/ucab
563 src/vfs/extfs/helpers/uha
564 src/vfs/extfs/helpers/ulha
565 src/vfs/extfs/helpers/ulib
566 src/vfs/extfs/helpers/urar
567 src/vfs/extfs/helpers/uzip
568 src/vfs/extfs/helpers/uzoo
570 src/vfs/fish/Makefile
571 src/vfs/fish/helpers/Makefile
573 src/vfs/ftpfs/Makefile
575 src/vfs/sftpfs/Makefile
577 src/vfs/local/Makefile
579 src/vfs/sfs/Makefile
581 src/vfs/smbfs/Makefile
583 src/vfs/tar/Makefile
585 src/vfs/undelfs/Makefile
587 lib/Makefile
588 lib/event/Makefile
589 lib/filehighlight/Makefile
590 lib/mcconfig/Makefile
591 lib/search/Makefile
592 lib/skin/Makefile
593 lib/strutil/Makefile
594 lib/tty/Makefile
596 lib/vfs/Makefile
598 lib/widget/Makefile
600 misc/syntax/Makefile
601 misc/syntax/Syntax
603 doc/Makefile
605 doc/hints/Makefile
606 doc/hints/l10n/Makefile
608 doc/man/Makefile
609 doc/man/es/Makefile
610 doc/man/hu/Makefile
611 doc/man/it/Makefile
612 doc/man/pl/Makefile
613 doc/man/ru/Makefile
614 doc/man/sr/Makefile
616 doc/hlp/Makefile
617 doc/hlp/es/Makefile
618 doc/hlp/hu/Makefile
619 doc/hlp/it/Makefile
620 doc/hlp/pl/Makefile
621 doc/hlp/ru/Makefile
622 doc/hlp/sr/Makefile
624 intl/Makefile
625 po/Makefile.in
628 if test x$enable_tests != xno; then
629     AC_CONFIG_FILES([
630 tests/Makefile
631 tests/lib/Makefile
632 tests/lib/mcconfig/Makefile
633 tests/lib/search/Makefile
634 tests/lib/strutil/Makefile
635 tests/lib/vfs/Makefile
636 tests/lib/widget/Makefile
637 tests/src/Makefile
638 tests/src/filemanager/Makefile
639 tests/src/editor/Makefile
640 tests/src/editor/test-data.txt
644 AC_OUTPUT
646 AC_MSG_NOTICE([
648 Configuration:
650   Source code location:       ${srcdir}
651   Compiler:                   ${CC}
652   Compiler flags:             ${CFLAGS}
653   Assertions:                 ${enable_assert}
654   File system:                ${vfs_type}
655                               ${vfs_flags}
656   Screen library:             ${screen_msg}
657   Mouse support:              ${mouse_lib}
658   X11 events support:         ${textmode_x11_support}
659   With subshell support:      ${subshell}
660   With background operations: ${enable_background}
661   Internal editor:            ${edit_msg}
662   Diff viewer:                ${diff_msg}
663   Support for charset:        ${charset_msg}
664   Search type:                ${SEARCH_TYPE}
667 dnl option checking is disable by default due to AC_CONFIG_SUBDIRS
668 dnl we enable it back for top-level ./configure
669 if test -n "$ac_unrecognized_opts"; then
670   case $enable_option_checking in
671     fatal) AC_MSG_ERROR([unrecognized options: $ac_unrecognized_opts]) ;;
672     *)     AC_MSG_WARN( [unrecognized options: $ac_unrecognized_opts]) ;;
673   esac