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-pre1b)
11 AM_CONFIG_HEADER(config.h)
23 dnl Check if the user requested to compile with glib 2.x. If not, use
24 dnl glib 1.2.x. This check should be kept close to the beginning, as it
25 dnl fails for the users without any glib.
27 AC_ARG_WITH(glib2, [ --with-glib2 Use glib 2.x [[no]]])
29 if test "x$with_glib2" = "xyes" ; then
30 PKG_CHECK_MODULES(GLIB, "glib-2.0")
32 dnl This temporary variable is a workaround for a bug in Autoconf-2.53
33 glib_path=$PATH:/usr/local/bin
35 dnl Klugde for FreeBSD, where glib-config is renamed to glib12-config.
36 AC_PATH_PROGS([GLIB_CONFIG], [glib-config glib12-config],,[$glib_path])
38 AC_ARG_VAR([GLIB_CONFIG], [Path to glib-config (version 1.2.x only)])
39 AM_PATH_GLIB(1.2.6,,[AC_MSG_ERROR([Test for glib failed.
40 GNU Midnight Commander requires glib 1.2.6 or above.])])
49 AC_CHECK_TOOL(AR, ar, ar)
51 dnl Only list browsers here that can be run in background (i.e. with `&')
52 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
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.
60 [ --with-mmap Force using the mmap call (only useful on AIX)],
63 ac_cv_func_mmap_fixed_mapped=yes
64 AC_MSG_NOTICE([forcing MMAP support])
67 ac_cv_func_mmap_fixed_mapped=no
68 AC_MSG_NOTICE([disabling MMAP support])
73 ALL_LINGUAS="az be bg ca cs da de el es es_ES eu fi fr hu it ja ko lv \
74 nl no pl pt pt_BR ro ru sk sl sv uk ta tr wa zh_CN zh_TW"
77 dnl Internationalization
80 AM_GNU_GETTEXT_VERSION(0.11.5)
82 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
83 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
87 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
89 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
92 dnl Enforce coding standards
94 if test "x$GCC" = xyes; then
95 CFLAGS="$CFLAGS -Wall"
99 dnl OS specific flags.
107 AC_DEFINE(_POSIX_SOURCE)
110 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
111 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
116 AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
117 malloc.h stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h \
118 sys/time.h sys/timeb.h sys/select.h sys/ioctl.h stropts.h \
126 dnl Missing structure components
132 dnl Check availability of some functions
135 AC_CHECK_FUNCS([strerror statfs strftime \
136 memmove pwdauth truncate initgroups putenv \
137 memset memcpy tcsetattr tcgetattr cfgetospeed \
138 sigaction sigemptyset sigprocmask sigaddset \
139 sysconf setuid setreuid telldir seekdir])
142 dnl getpt is a GNU Extension (glibc 2.1.x)
144 AC_CHECK_FUNCS(getpt)
148 dnl On SCO and some SVR4, crypt is on libcrypt.a
149 dnl grantpt in libpt.a
152 AC_CHECK_FUNCS(crypt, , [
153 AC_CHECK_LIB(crypt, crypt, [LCRYPT="-lcrypt"], [
154 AC_CHECK_LIB(crypt_i, crypt, [LCRYPT="-lcrypt_i"])])])
157 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
159 dnl replacing lstat with statlstat on sco makes it more portable between
161 AC_CHECK_FUNCS(statlstat)
164 dnl If running under AIX, AC_AIX does not tell us that
166 AC_MSG_CHECKING([for AIX defines])
168 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
172 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
174 ], [AC_MSG_RESULT(no)])
177 dnl This is from GNU fileutils, check aclocal.m4 for more information
182 dnl Missing typedefs and replacements
186 AC_CHECK_TYPE(umode_t, int)
187 AC_CHECK_TYPE(off_t, long)
190 AC_CHECK_TYPE(nlink_t, unsigned int)
199 textmode_x11_support="no"
200 AC_ARG_WITH(tm-x-support,
201 [ --with-tm-x-support Get keyboard events from X Window System [[no]]],
202 [if test x$withval = xyes; then
204 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
205 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
206 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
207 [Define to enable getting events from X Window System])
208 textmode_x11_support="yes"
213 dnl Network related functions
216 AC_CHECK_LIB(nsl, t_accept)
217 AC_CHECK_LIB(socket, socket)
220 AC_CHECK_FUNCS(socket, have_socket=yes)
221 if test $have_socket = no; then
222 # socket is not in the default libraries. See if it's in some other.
223 for lib in bsd socket inet; do
224 AC_CHECK_LIB($lib, socket, [
227 AC_DEFINE(HAVE_SOCKET)
232 have_gethostbyname=no
233 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
234 if test $have_gethostbyname = no; then
235 # gethostbyname is not in the default libraries. See if it's in some other.
236 for lib in bsd socket inet; do
237 AC_CHECK_LIB([$lib], [gethostbyname],
238 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
242 AC_CHECK_FUNCS(socketpair)
245 dnl Sequent wants getprocessstats
247 AC_CHECK_LIB(seq, get_process_stats, [
249 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
250 [Define if you have function `get_process_stats' and
251 have to use that instead of gettimeofday])])
256 if test x$use_vfs = xyes; then
257 AC_MSG_NOTICE([enabling VFS code])
258 vfs_type="Midnight Commander Virtual File System"
261 dnl This should be unadorned "slang" or "ncurses"
264 dnl Screen manager name (for the output only)
265 screen_manager=unknown
267 mouse_lib="xterm only"
270 AC_ARG_WITH(gpm-mouse,
271 [ --with-gpm-mouse[[=base-dir]] Compile with gpm mouse support (Linux only)
273 [if test x$withval != xno
275 if test x$withval != xyes
277 LDFLAGS="$LDFLAGS -L$withval/lib"
278 CPPFLAGS="$CPPFLAGS -I$withval/include"
280 AC_DEFINE(HAVE_LIBGPM, 1,
281 [Define to enable gpm mouse support on Linux])
282 mouse_lib="GPM and xterm"
283 MCLIBS="-lgpm $MCLIBS"
285 [AC_CHECK_LIB(gpm, Gpm_Repeat,
286 [AC_DEFINE(HAVE_LIBGPM)
287 mouse_lib="GPM and xterm"
288 MCLIBS="-lgpm $MCLIBS"],
289 [AC_MSG_WARN([libgpm is missing or older than 0.18])],
296 [ --with-ncurses[[=base-dir]] Compile with ncurses [[no]]],
297 [if test x$withval != xno; then
298 if test x$withval != xyes; then
299 LDFLAGS="$LDFLAGS -L$withval/lib"
300 CPPFLAGS="$CPPFLAGS -I$withval/include"
303 AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
304 [ncurses_h_found=yes; break])
305 if test -z "$ncurses_h_found"; then
306 AC_MSG_ERROR([Could not find ncurses header])
309 dnl curses_version is specific to ncurses, it's not in old curses
310 AC_CHECK_LIB(ncurses, has_colors, [MCLIBS="$MCLIBS -lncurses"],
311 [AC_MSG_ERROR([Could not find ncurses library])])
313 screen_type="ncurses"
314 screen_manager="ncurses"
315 AC_DEFINE(USE_NCURSES, 1,
316 [Define to use ncurses for screen management])
321 dnl Check for the -mandoc package
323 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
325 AC_MSG_CHECKING([for manual formatting macros])
326 AC_CACHE_VAL(ac_cv_mandoc, [
327 nroff -mandoc < /dev/null > /dev/null 2>&1
336 AC_MSG_RESULT([$MANDOC])
343 dnl Check if nroff accepts -Tlatin1 or -Tascii
346 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
347 AC_CACHE_VAL(ac_cv_nroff_tascii, [
348 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
351 ac_cv_nroff_tascii=" -Tlatin1"
353 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
356 ac_cv_nroff_tascii=" -Tascii"
358 ac_cv_nroff_tascii=""
362 if test "x$ac_cv_nroff_tascii" = x; then
365 AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
368 TROFFASCII="$ac_cv_nroff_tascii"
372 dnl Check for - option to file
374 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
375 if $HAVE_FILECMD; then
376 AC_MSG_CHECKING([for - option to file command])
377 AC_CACHE_VAL(ac_cv_filestdin, [[
378 cat > conftest.c <<\EOF
385 cat > conftest.sed <<\EOF
389 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
390 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
391 if test "x$filehyphen_1" = "x$filehyphen_2"; then
396 rm conftest.c conftest.sed
399 if test x$ac_cv_filestdin = xyes; then
400 AC_DEFINE(FILE_STDIN, 1,
401 [Define if the file command accepts - for stdin])
403 filestdin=$ac_cv_filestdin
404 AC_MSG_RESULT([$filestdin])
407 dnl Check for -L option to file
410 AC_MSG_CHECKING([for -L option to file command])
411 AC_CACHE_VAL(ac_cv_filel, [
412 file -L . > /dev/null 2>&1
420 if test x$ac_cv_filel = xyes; then
421 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
424 AC_MSG_RESULT([$filel])
428 AC_MSG_CHECKING([for subshell support])
429 AC_ARG_WITH(subshell,
430 [ --with-subshell Compile in concurrent subshell [[yes]]
431 --with-subshell=optional Don't run concurrent shell by default [[no]]],
433 if test x$withval = xoptional
435 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
436 [Define to make subshell support optional])
439 if test x$withval = xyes
443 [dnl Default: enable the subshell support
446 if test "x$result" != xno; then
447 AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
448 [Define to enable subshell support])
450 AC_MSG_RESULT([$result])
453 if test "x$screen_type" != xncurses; then
456 slang_use_system_installed_lib=false
457 AC_CHECK_LIB(slang,SLang_init_tty,
458 [AC_CHECK_HEADERS([slang.h slang/slang.h],
459 [slang_h_found=yes; break])
460 if test "x$slang_h_found" = xyes; then
461 slang_use_system_installed_lib=true
462 slang_check_lib=false
468 [ --with-slang Compile with S-Lang screen manager [[yes]]],
469 [if test x$withval = xyes; then
474 AC_ARG_WITH(included-slang,
475 [ --with-included-slang Use S-Lang library included with mc sources
476 [[use installed library if found]]],
477 [if test x$withval = xyes; then
478 slang_use_system_installed_lib=false
484 [ --with-termcap Same as above, and try using termcap database [[no]]],
485 [if test x$withval = xyes; then
487 slang_check_lib=false
488 slang_use_system_installed_lib=false
494 dnl Internal editor support.
497 [ --with-edit Enable internal editor [[yes]]])
499 if test x$with_edit != xno; then
500 AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
503 AC_MSG_NOTICE([using internal editor])
509 if test $use_vfs = yes; then
510 AC_ARG_WITH(ext2undel,
511 [ --with-ext2undel Compile with ext2 undelete code [[yes if found]]],
512 [if test x$withval != xno; then
513 if test x$withval != xyes; then
514 LDFLAGS="$LDFLAGS -L$withval/lib"
515 CPPFLAGS="$CPPFLAGS -I$withval/include"
520 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
525 dnl Ncurses specific checks
527 dnl If ncurses exports the ESCDELAY variable it should be set to 0
528 dnl or you'll have to press Esc three times to dismiss a dialog box.
530 if test "x$screen_type" = xncurses; then
533 AC_CACHE_CHECK([for ESCDELAY variable],
534 [mc_cv_ncurses_escdelay],
535 [AC_TRY_COMPILE([], [
542 [mc_cv_ncurses_escdelay=yes],
543 [mc_cv_ncurses_escdelay=no]
546 if test "$mc_cv_ncurses_escdelay" = yes; then
547 AC_DEFINE(HAVE_ESCDELAY, 1,
548 [Define if ncurses has ESCDELAY variable])
551 AC_CHECK_FUNCS(resizeterm)
555 if test "x$screen_type" = "x"; then
560 dnl The variables used for expanding the auto saver.
567 cons_saver="cons.saver"
571 dnl On Linux, check for PAM authentication available
573 AC_CHECK_LIB(pam, pam_start, [
574 AC_DEFINE(HAVE_PAM, 1,
575 [Define if PAM (Pluggable Authentication Modules) is available])
584 dnl User visible support for charset conversion.
586 AC_ARG_ENABLE([charset],
587 [ --enable-charset Support for charset selection and conversion [[no]]])
589 if test "x$enable_charset" = xyes; then
590 if test "x$am_cv_func_iconv" != xyes; then
591 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
593 AC_DEFINE(HAVE_CHARSET, 1,
594 [Define to enable charset selection and conversion])
599 if test "$GLIBC21" != yes; then
600 AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
604 dnl This code should be moved to the ac_WITH_SLANG
606 dnl We check for the existance of setupterm on curses library
607 dnl this is required to load certain definitions on some termcaps
608 dnl editions (AIX and OSF/1 I seem to remember).
609 dnl Note that we avoid using setupterm
610 if test "x$screen_type" = xslang; then
615 AC_CHECK_LIB(curses,setupterm,
619 if (key_end == parm_insert_line)
623 [MCLIBS="$MCLIBS -lcurses"
624 AC_DEFINE(USE_SETUPTERM, 1,
625 [Define to use function `setupterm'
626 from `curses' library in S-Lang])])
631 LIBS="$LIBS $posix_libs"
638 dnl Libraries used only when building the mc binary
641 dnl Version for the RedHat package, without dashes
642 RH_VERSION=`echo $VERSION | sed 's/-//'`
645 if test -n "$use_smbfs"; then
646 AC_CONFIG_SUBDIRS([vfs/samba])
649 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
650 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
651 AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue])
652 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$use_undelfs"])
653 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
654 AM_CONDITIONAL(USE_MCFS, [test -n "$use_mcfs"])
655 AM_CONDITIONAL(INCLUDED_SLANG,
656 [test "x$slang_use_system_installed_lib" = xfalse])
657 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
658 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
660 AH_BOTTOM([#include <extraconf.h>])
690 doc/mc.1 doc/mcedit.1 doc/mcserv.8
691 doc/es/mc.1 doc/es/Makefile
692 doc/hu/Makefile doc/hu/mc.hlp.hu
693 doc/it/mc.1 doc/it/Makefile
694 doc/pl/mc.1 doc/pl/Makefile
695 doc/ru/mc.1 doc/ru/Makefile
703 if test "x$screen_type" = xslang; then
704 screen_manager="${screen_manager}${slang_term}"
710 Source code location: ${srcdir}
712 Compiler flags: ${CFLAGS}
713 File system: ${vfs_type}
715 Screen manager: ${screen_manager}
716 Install console saver: ${install_saver}
717 Mouse support: ${mouse_lib}
718 X11 events support: ${textmode_x11_support}
719 With subshell support: ${subshell}
720 Internal editor: ${EDIT_msg}
721 Install path: ${prefix}/bin, ${prefix}/lib/mc