2 dnl Configure.in file for the Midnight Commander
5 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
7 AC_CONFIG_SRCDIR(src/main.c)
8 AC_CONFIG_AUX_DIR(config)
9 AM_INIT_AUTOMAKE(mc, 4.6.0-pre1a)
11 AM_CONFIG_HEADER(config.h)
24 dnl Find glib 1.2.x. This check should be kept close to the beginning,
25 dnl as it tends to fail often.
28 dnl This temporary variable is a workaround for a bug in Autoconf-2.53
29 glib_path=$PATH:/usr/local/bin
31 dnl Klugde for FreeBSD, where glib-config is renamed to glib12-config.
32 AC_PATH_PROGS([GLIB_CONFIG], [glib-config glib12-config],,[$glib_path])
34 AC_ARG_VAR([GLIB_CONFIG], [Path to glib-config])
35 AM_PATH_GLIB(1.2.0,,[AC_MSG_ERROR([Test for GLIB failed. MC requires GLIB.])])
44 AC_CHECK_TOOL(AR, ar, ar)
46 dnl Only list browsers here that can be run in background (i.e. with `&')
47 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
50 dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
51 dnl We use only part of the functionality of mmap, so on AIX,
52 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
55 [ --with-mmap Force using the mmap call (only useful on AIX)],
58 ac_cv_func_mmap_fixed_mapped=yes
59 AC_MSG_NOTICE([forcing MMAP support])
62 ac_cv_func_mmap_fixed_mapped=no
63 AC_MSG_NOTICE([disabling MMAP support])
68 ALL_LINGUAS="az be bg ca cs da de el es es_ES eu fi fr hu it ja ko lv \
69 nl no pl pt pt_BR ro ru sk sl sv uk ta tr wa zh_CN zh_TW"
72 dnl Internationalization
75 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
76 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
80 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
82 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
85 dnl Enforce coding standards
87 if test "x$GCC" = xyes; then
88 CFLAGS="$CFLAGS -Wall"
92 dnl OS specific flags.
100 AC_DEFINE(_POSIX_SOURCE)
103 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
104 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
109 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
110 malloc.h stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h \
111 sys/time.h sys/timeb.h sys/select.h sys/ioctl.h stropts.h \
119 dnl Missing structure components
125 dnl Check availability of some functions
128 AC_CHECK_FUNCS([strerror statfs strftime \
129 memmove pwdauth truncate initgroups putenv \
130 memset memcpy tcsetattr tcgetattr cfgetospeed \
131 sigaction sigemptyset sigprocmask sigaddset \
132 sysconf setuid setreuid telldir seekdir])
135 dnl getpt is a GNU Extension (glibc 2.1.x)
137 AC_CHECK_FUNCS(getpt)
141 dnl On SCO and some SVR4, crypt is on libcrypt.a
142 dnl grantpt in libpt.a
145 AC_CHECK_FUNCS(crypt, , [
146 AC_CHECK_LIB(crypt, crypt, [LCRYPT="-lcrypt"], [
147 AC_CHECK_LIB(crypt_i, crypt, [LCRYPT="-lcrypt_i"])])])
150 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
152 dnl replacing lstat with statlstat on sco makes it more portable between
154 AC_CHECK_FUNCS(statlstat)
157 dnl If running under AIX, AC_AIX does not tell us that
159 AC_MSG_CHECKING([for AIX defines])
161 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
165 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
167 ], [AC_MSG_RESULT(no)])
170 dnl This is from GNU fileutils, check aclocal.m4 for more information
175 dnl Missing typedefs and replacements
179 AC_CHECK_TYPE(umode_t, int)
180 AC_CHECK_TYPE(off_t, long)
183 AC_CHECK_TYPE(nlink_t, unsigned int)
192 textmode_x11_support="no"
193 AC_ARG_WITH(tm-x-support,
194 [ --with-tm-x-support Get keyboard events from X Window System [[no]]],
195 [if test x$withval = xyes; then
197 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
198 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
199 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
200 [Define to enable getting events from X Window System])
201 textmode_x11_support="yes"
206 dnl Network related functions
209 AC_CHECK_LIB(nsl, t_accept)
210 AC_CHECK_LIB(socket, socket)
213 AC_CHECK_FUNCS(socket, have_socket=yes)
214 if test $have_socket = no; then
215 # socket is not in the default libraries. See if it's in some other.
216 for lib in bsd socket inet; do
217 AC_CHECK_LIB($lib, socket, [
220 AC_DEFINE(HAVE_SOCKET)
225 have_gethostbyname=no
226 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
227 if test $have_gethostbyname = no; then
228 # gethostbyname is not in the default libraries. See if it's in some other.
229 for lib in bsd socket inet; do
230 AC_CHECK_LIB([$lib], [gethostbyname],
231 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
235 AC_CHECK_FUNCS(socketpair)
238 dnl Sequent wants getprocessstats
240 AC_CHECK_LIB(seq, get_process_stats, [
242 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
243 [Define if you have function `get_process_stats' and
244 have to use that instead of gettimeofday])])
249 if test x$use_vfs = xyes; then
250 AC_MSG_NOTICE([enabling VFS code])
251 vfs_type="Midnight Commander Virtual File System"
254 dnl This should be unadorned "slang" or "ncurses"
257 dnl Screen manager name (for the output only)
258 screen_manager=unknown
260 mouse_lib="xterm only"
263 AC_ARG_WITH(gpm-mouse,
264 [ --with-gpm-mouse[[=base-dir]] Compile with gpm mouse support (Linux only)
266 [if test x$withval != xno
268 if test x$withval != xyes
270 LDFLAGS="$LDFLAGS -L$withval/lib"
271 CPPFLAGS="$CPPFLAGS -I$withval/include"
273 AC_DEFINE(HAVE_LIBGPM, 1,
274 [Define to enable gpm mouse support on Linux])
275 mouse_lib="GPM and xterm"
276 MCLIBS="-lgpm $MCLIBS"
278 [AC_CHECK_LIB(gpm, Gpm_Repeat,
279 [AC_DEFINE(HAVE_LIBGPM)
280 mouse_lib="GPM and xterm"
281 MCLIBS="-lgpm $MCLIBS"],
282 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
289 [ --with-ncurses[[=base-dir]] Compile with ncurses [[no]]],
290 [if test x$withval != xno; then
291 if test x$withval != xyes; then
292 LDFLAGS="$LDFLAGS -L$withval/lib"
293 CPPFLAGS="$CPPFLAGS -I$withval/include"
296 AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
297 [ncurses_h_found=yes; break])
298 if test -z "$ncurses_h_found"; then
299 AC_MSG_ERROR([Could not find ncurses header])
302 dnl curses_version is specific to ncurses, it's not in old curses
303 AC_CHECK_LIB(ncurses, has_colors, [MCLIBS="$MCLIBS -lncurses"],
304 [AC_MSG_ERROR([Could not find ncurses library])])
306 screen_type="ncurses"
307 screen_manager="ncurses"
308 AC_DEFINE(USE_NCURSES, 1,
309 [Define to use ncurses for screen management])
314 [ --with-hsc Compile with support for HSC firewall instead
315 of FTP proxy [[no]]],
316 [if test x$withval = xyes; then
317 AC_DEFINE(HSC_PROXY, 1,
318 [Define if you want to use the HSC firewall])
323 dnl Check for the -mandoc package
325 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
327 AC_MSG_CHECKING([for manual formatting macros])
328 AC_CACHE_VAL(ac_cv_mandoc, [
329 nroff -mandoc < /dev/null > /dev/null 2>&1
338 AC_MSG_RESULT([$MANDOC])
345 dnl Check if nroff accepts -Tlatin1 or -Tascii
348 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
349 AC_CACHE_VAL(ac_cv_nroff_tascii, [
350 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
353 ac_cv_nroff_tascii=" -Tlatin1"
355 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
358 ac_cv_nroff_tascii=" -Tascii"
360 ac_cv_nroff_tascii=""
364 if test "x$ac_cv_nroff_tascii" = x; then
367 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
370 TROFFASCII="$ac_cv_nroff_tascii"
374 dnl Check for - option to file
376 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
377 if $HAVE_FILECMD; then
378 AC_MSG_CHECKING([for - option to file command])
379 AC_CACHE_VAL(ac_cv_filestdin, [[
380 cat > conftest.c <<\EOF
387 cat > conftest.sed <<\EOF
391 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
392 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
393 if test "x$filehyphen_1" = "x$filehyphen_2"; then
398 rm conftest.c conftest.sed
401 if test x$ac_cv_filestdin = xyes; then
402 AC_DEFINE(FILE_STDIN, 1,
403 [Define if the file command accepts - for stdin])
405 filestdin=$ac_cv_filestdin
406 AC_MSG_RESULT([$filestdin])
409 dnl Check for -L option to file
412 AC_MSG_CHECKING([for -L option to file command])
413 AC_CACHE_VAL(ac_cv_filel, [
414 file -L . > /dev/null 2>&1
422 if test x$ac_cv_filel = xyes; then
423 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
426 AC_MSG_RESULT([$filel])
430 AC_MSG_CHECKING([for subshell support])
431 AC_ARG_WITH(subshell,
432 [ --with-subshell Compile in concurrent subshell [[yes]]
433 --with-subshell=optional Don't run concurrent shell by default [[no]]],
435 if test x$withval = xoptional
437 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
438 [Define to make subshell support optional])
441 if test x$withval = xyes
445 [dnl Default: enable the subshell support
448 if test "x$result" != xno; then
449 AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
450 [Define to enable subshell support])
452 AC_MSG_RESULT([$result])
455 if test "x$screen_type" != xncurses; then
458 slang_use_system_installed_lib=false
459 AC_CHECK_LIB(slang,SLang_init_tty,
460 [AC_CHECK_HEADERS([slang.h slang/slang.h],
461 [slang_h_found=yes; break])
462 if test "x$slang_h_found" = xyes; then
463 slang_use_system_installed_lib=true
464 slang_check_lib=false
470 [ --with-slang Compile with S-Lang screen manager [[yes]]],
471 [if test x$withval = xyes; then
476 AC_ARG_WITH(included-slang,
477 [ --with-included-slang Use S-Lang library included with mc sources
478 [[use installed library if found]]],
479 [if test x$withval = xyes; then
480 slang_use_system_installed_lib=false
486 [ --with-termcap Same as above, and try using termcap database [[no]]],
487 [if test x$withval = xyes; then
489 slang_check_lib=false
490 slang_use_system_installed_lib=false
496 dnl Internal editor support.
499 [ --with-edit Enable internal editor [[yes]]])
501 if test x$with_edit != xno; then
502 AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
505 AC_MSG_NOTICE([using internal editor])
511 if test $use_vfs = yes; then
512 AC_ARG_WITH(ext2undel,
513 [ --with-ext2undel Compile with ext2 undelete code [[yes if found]]],
514 [if test x$withval != xno; then
515 if test x$withval != xyes; then
516 LDFLAGS="$LDFLAGS -L$withval/lib"
517 CPPFLAGS="$CPPFLAGS -I$withval/include"
522 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
527 dnl Ncurses specific checks
529 dnl If ncurses exports the ESCDELAY variable it should be set to 0
530 dnl or you'll have to press Esc three times to dismiss a dialog box.
532 if test "x$screen_type" = xncurses; then
535 AC_CACHE_CHECK([for ESCDELAY variable],
536 [mc_cv_ncurses_escdelay],
537 [AC_TRY_COMPILE([], [
544 [mc_cv_ncurses_escdelay=yes],
545 [mc_cv_ncurses_escdelay=no]
548 if test "$mc_cv_ncurses_escdelay" = yes; then
549 AC_DEFINE(HAVE_ESCDELAY, 1,
550 [Define if ncurses has ESCDELAY variable])
553 AC_CHECK_FUNCS(resizeterm)
557 if test "x$screen_type" = "x"; then
562 dnl The variables used for expanding the auto saver.
569 cons_saver="cons.saver"
573 dnl On Linux, check for PAM authentication available
575 AC_CHECK_LIB(pam, pam_start, [
576 AC_DEFINE(HAVE_PAM, 1,
577 [Define if PAM (Pluggable Authentication Modules) is available])
586 dnl User visible support for charset conversion.
588 AC_ARG_ENABLE([charset],
589 [ --enable-charset Support for charset selection and conversion [[no]]])
591 if test "x$enable_charset" = xyes; then
592 if test "x$am_cv_func_iconv" != xyes; then
593 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
595 AC_DEFINE(HAVE_CHARSET, 1,
596 [Define to enable charset selection and conversion])
601 if test "$GLIBC21" != yes; then
602 AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
606 dnl This code should be moved to the ac_WITH_SLANG
608 dnl We check for the existance of setupterm on curses library
609 dnl this is required to load certain definitions on some termcaps
610 dnl editions (AIX and OSF/1 I seem to remember).
611 dnl Note that we avoid using setupterm
612 if test "x$screen_type" = xslang; then
617 AC_CHECK_LIB(curses,setupterm,
621 if (key_end == parm_insert_line)
625 [MCLIBS="$MCLIBS -lcurses"
626 AC_DEFINE(USE_SETUPTERM, 1,
627 [Define to use function `setupterm'
628 from `curses' library in S-Lang])])
633 LIBS="$LIBS $posix_libs"
640 dnl Libraries used only when building the mc binary
643 dnl Version for the RedHat package, without dashes
644 RH_VERSION=`echo $VERSION | sed 's/-//'`
647 if test -n "$use_smbfs"; then
648 AC_CONFIG_SUBDIRS([vfs/samba])
651 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
652 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
653 AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue])
654 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$use_undelfs"])
655 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
656 AM_CONDITIONAL(USE_MCFS, [test -n "$use_mcfs"])
657 AM_CONDITIONAL(INCLUDED_SLANG,
658 [test "x$slang_use_system_installed_lib" = xfalse])
659 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
660 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
662 AH_BOTTOM([#include <extraconf.h>])
691 doc/mc.1 doc/mcedit.1 doc/mcserv.8
692 doc/es/mc.1 doc/es/Makefile
694 doc/it/mc.1 doc/it/Makefile
695 doc/pl/mc.1 doc/pl/Makefile
696 doc/ru/mc.1 doc/ru/Makefile
698 intl/Makefile po/Makefile.in
701 AC_CONFIG_COMMANDS(potfiles,
702 [grep ^top_builddir po/Makefile.in >/dev/null && sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
706 if test "x$screen_type" = xslang; then
707 screen_manager="${screen_manager}${slang_term}"
713 Source code location: ${srcdir}
715 Compiler flags: ${CFLAGS}
716 File system: ${vfs_type}
718 Screen manager: ${screen_manager}
719 Install console saver: ${install_saver}
720 Mouse support: ${mouse_lib}
721 X11 events support: ${textmode_x11_support}
722 Debugger code: ${mem_debug}
723 With subshell support: ${subshell}
724 Internal editor: ${EDIT_msg}
725 Install path: ${prefix}/bin, ${prefix}/lib/mc