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.0a)
11 AM_CONFIG_HEADER(config.h)
23 dnl First try glib 2.x. If it's not found, use glib 1.2.x.
24 dnl Keep this check close to the beginning, so that the users
25 dnl without any glib won't have their time wasted by other checks.
29 [ --with-glib12 Force using glib 1.2.x [[no]]])
32 if test "x$with_glib12" != "xyes"; then
33 PKG_CHECK_MODULES(GLIB, [glib-2.0], [glib_found=yes], [:])
36 dnl Fall back to glib-1.2, don't use pkgconfig to find it.
37 if test "x$glib_found" != "xyes" ; then
38 dnl This temporary variable is a workaround for a bug in Autoconf-2.53
39 glib_path=$PATH:/usr/local/bin
41 dnl Klugde for FreeBSD, where glib-config is renamed to glib12-config.
42 AC_PATH_PROGS([GLIB_CONFIG], [glib-config glib12-config],,[$glib_path])
44 AC_ARG_VAR([GLIB_CONFIG], [Path to glib-config (version 1.2.x only)])
45 AM_PATH_GLIB(1.2.6, , [AC_MSG_ERROR([Test for glib failed.
46 GNU Midnight Commander requires glib 1.2.6 or above.])])
47 dnl Save GLIB_CFLAGS and GLIB_LIBS, since the following call to
48 dnl AM_PATH_GLIB will overwrite them.
49 save_GLIB_CFLAGS="$GLIB_CFLAGS"
50 save_GLIB_LIBS="$GLIB_LIBS"
51 dnl Check for gmodule. Store the flags necessary to compile and
52 dnl link programs using gmodule functionality in GMODULE_CFLAGS
54 AM_PATH_GLIB(1.2.6, [gmodule_found=yes], , [gmodule])
55 GMODULE_CFLAGS="$GLIB_CFLAGS"
56 GMODULE_LIBS="$GLIB_LIBS"
57 GLIB_CFLAGS="$save_GLIB_CFLAGS"
58 GLIB_LIBS="$save_GLIB_LIBS"
60 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0], [gmodule_found=yes])
63 if test "x$gmodule_found" = "xyes" ; then
64 dnl Check if the gmodule functionality supported on this system.
73 AC_CHECK_TOOL(AR, ar, ar)
75 dnl Only list browsers here that can be run in background (i.e. with `&')
76 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
79 dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
80 dnl We use only part of the functionality of mmap, so on AIX,
81 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
84 [ --with-mmap Force using the mmap call (only useful on AIX)],
87 ac_cv_func_mmap_fixed_mapped=yes
88 AC_MSG_NOTICE([forcing MMAP support])
91 ac_cv_func_mmap_fixed_mapped=no
92 AC_MSG_NOTICE([disabling MMAP support])
98 dnl Internationalization
101 AM_GNU_GETTEXT_VERSION(0.11.5)
103 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
104 CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
107 dnl Determine which help translations we want to install.
108 ALL_DOC_LINGUAS="es hu it pl ru"
111 if test "x$USE_NLS" = xyes; then
112 if test -z "$LINGUAS"; then
113 langs="`grep -v '^#' $srcdir/po/LINGUAS`"
121 for h_lang in $ALL_DOC_LINGUAS; do
122 for lang in $langs; do
123 if test "$lang" = "$h_lang"; then
124 DOC_LINGUAS="$DOC_LINGUAS $lang"
129 AC_SUBST(DOC_LINGUAS)
132 dnl Hack to make extraconf.h visible even if compiling outside srcdir.
134 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
137 dnl Enforce coding standards
139 if test "x$GCC" = xyes; then
140 CFLAGS="$CFLAGS -Wall"
144 dnl OS specific flags.
150 AC_DEFINE(_POSIX_SOURCE)
153 AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
154 AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
160 AC_CHECK_HEADERS([unistd.h string.h memory.h grp.h limits.h malloc.h \
161 stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h sys/time.h \
162 sys/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h])
169 dnl Missing structure components
175 dnl Check availability of some functions
178 AC_CHECK_FUNCS([strerror statfs strftime \
179 memmove truncate initgroups putenv \
180 memset memcpy tcsetattr tcgetattr cfgetospeed \
181 sigaction sigemptyset sigprocmask sigaddset \
182 sysconf setuid setreuid telldir seekdir])
185 dnl getpt is a GNU Extension (glibc 2.1.x)
187 AC_CHECK_FUNCS(getpt)
188 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
190 dnl replacing lstat with statlstat on sco makes it more portable between
192 AC_CHECK_FUNCS(statlstat)
195 dnl If running under AIX, AC_AIX does not tell us that
197 AC_MSG_CHECKING([for AIX defines])
199 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
203 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
205 ], [AC_MSG_RESULT(no)])
208 dnl This is from GNU fileutils, check aclocal.m4 for more information
213 dnl Missing typedefs and replacements
217 AC_CHECK_TYPE(umode_t, int)
218 AC_CHECK_TYPE(off_t, long)
221 AC_CHECK_TYPE(nlink_t, unsigned int)
223 dnl This is needed for regex.c only
224 AC_CHECK_TYPE(uintptr_t,
225 [AC_DEFINE(HAVE_UINTPTR_T, 1,
226 [Define if you have the `uintptr_t' type.])
234 dnl Used to read keyboard modifiers when running under X11.
238 if test "x$no_x" = xyes; then
239 textmode_x11_support="no"
241 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
242 if test "x$mc_cv_g_module_supported" = "xyes" ; then
243 dnl Replace the contents of GLIB_CFLAGS and GLIB_LIBS with those of
244 dnl GMODULE_CFLAGS and GMODULE_LIBS, only if X is available and gmodule
245 dnl functionality is supported on the system. This way, mc will be
246 dnl linked against the gmodule library only when it's really required.
247 GLIB_CFLAGS="$GMODULE_CFLAGS"
248 GLIB_LIBS="$GMODULE_LIBS"
250 MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
252 AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
253 [Define to enable getting events from X Window System])
254 textmode_x11_support="yes"
258 dnl Network related functions
261 AC_CHECK_LIB(nsl, t_accept)
262 AC_CHECK_LIB(socket, socket)
265 AC_CHECK_FUNCS(socket, have_socket=yes)
266 if test $have_socket = no; then
267 # socket is not in the default libraries. See if it's in some other.
268 for lib in bsd socket inet; do
269 AC_CHECK_LIB($lib, socket, [
272 AC_DEFINE(HAVE_SOCKET)
277 have_gethostbyname=no
278 AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
279 if test $have_gethostbyname = no; then
280 # gethostbyname is not in the default libraries. See if it's in some other.
281 for lib in bsd socket inet; do
282 AC_CHECK_LIB([$lib], [gethostbyname],
283 [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
287 AC_CHECK_FUNCS(socketpair)
290 dnl Sequent wants getprocessstats
292 AC_CHECK_LIB(seq, get_process_stats, [
294 AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
295 [Define if you have function `get_process_stats' and
296 have to use that instead of gettimeofday])])
301 if test x$use_vfs = xyes; then
302 AC_MSG_NOTICE([enabling VFS code])
303 vfs_type="Midnight Commander Virtual File System"
307 dnl Check for gpm mouse support (Linux only)
309 mouse_lib="xterm only"
310 AC_ARG_WITH(gpm-mouse,
311 [ --with-gpm-mouse Compile with gpm mouse support (Linux only)
316 if test x$with_gpm_mouse != xno; then
317 AC_CHECK_LIB(gpm, Gpm_Repeat,
318 [AC_DEFINE(HAVE_LIBGPM, 1,
319 [Define to enable gpm mouse support on Linux])
320 mouse_lib="gpm and xterm"
321 MCLIBS="$MCLIBS -lgpm"],
322 [AC_MSG_WARN([libgpm is missing or older than 0.18])
329 dnl Check nroff and the options it supports
331 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
338 AC_MSG_CHECKING([for manual formatting macros])
339 AC_CACHE_VAL(ac_cv_mandoc, [
340 nroff -mandoc < /dev/null > /dev/null 2>&1
348 AC_MSG_RESULT([$MANDOC])
350 AC_MSG_CHECKING([for option to disable ANSI color in manuals])
351 AC_CACHE_VAL(ac_cv_man_nocolor, [
352 nroff -c < /dev/null > /dev/null 2>&1
359 MAN_FLAGS=$ac_cv_man_nocolor
360 AC_MSG_RESULT([${MAN_NOCOLOR-none}])
362 AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
363 AC_CACHE_VAL(ac_cv_nroff_tascii, [
365 nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
367 ac_cv_nroff_tascii=-Tlatin1
369 nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
371 ac_cv_nroff_tascii=-Tascii
375 AC_MSG_RESULT([${ac_cv_nroff_tascii-no}])
376 MAN_FLAGS="$MAN_FLAGS $ac_cv_nroff_tascii"
384 dnl Check for - option to file
386 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
387 if $HAVE_FILECMD; then
388 AC_MSG_CHECKING([for - option to file command])
389 AC_CACHE_VAL(ac_cv_filestdin, [[
390 cat > conftest.c <<\EOF
397 cat > conftest.sed <<\EOF
401 filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
402 filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
403 if test "x$filehyphen_1" = "x$filehyphen_2"; then
408 rm conftest.c conftest.sed
411 if test x$ac_cv_filestdin = xyes; then
412 AC_DEFINE(FILE_STDIN, 1,
413 [Define if the file command accepts - for stdin])
415 filestdin=$ac_cv_filestdin
416 AC_MSG_RESULT([$filestdin])
419 dnl Check for -L option to file
422 AC_MSG_CHECKING([for -L option to file command])
423 AC_CACHE_VAL(ac_cv_filel, [
424 file -L . > /dev/null 2>&1
432 if test x$ac_cv_filel = xyes; then
433 AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
436 AC_MSG_RESULT([$filel])
440 AC_MSG_CHECKING([for subshell support])
441 AC_ARG_WITH(subshell,
442 [ --with-subshell Compile in concurrent subshell [[yes]]
443 --with-subshell=optional Don't run concurrent shell by default [[no]]],
445 if test x$withval = xoptional
447 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
448 [Define to make subshell support optional])
451 if test x$withval = xyes
455 [dnl Default: enable the subshell support
458 if test "x$result" != xno; then
459 AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
460 [Define to enable subshell support])
462 AC_MSG_RESULT([$result])
467 dnl Select the screen library. mcslang is the included S-Lang library.
470 [ --with-screen=LIB Compile with screen library: slang, mcslang or
471 ncurses [[slang if found, else mcslang]]])
473 case x$with_screen in
475 MC_WITH_SLANG(strict)
487 AC_MSG_ERROR([Value of the screen library is incorrect])
493 dnl Force using termcap. This option is processed in MC_WITH_MCSLANG.
494 dnl Report an error if this option is not applicable.
497 [ --with-termcap Try using termcap database [[only if no terminfo]]],
498 [if test x$with_screen != xmcslang; then
499 AC_MSG_ERROR([Option `--with-termcap' only works with `--with-screen=mcslang'])
505 dnl Internal editor support.
508 [ --with-edit Enable internal editor [[yes]]])
510 if test x$with_edit != xno; then
511 AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
514 AC_MSG_NOTICE([using internal editor])
520 if test $use_vfs = yes; then
521 AC_ARG_WITH(ext2undel,
522 [ --with-ext2undel Compile with ext2 undelete code [[yes if found]]],
523 [if test x$withval != xno; then
524 if test x$withval != xyes; then
525 LDFLAGS="$LDFLAGS -L$withval/lib"
526 CPPFLAGS="$CPPFLAGS -I$withval/include"
531 AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
536 dnl Check if the OS is supported by the console saver.
545 dnl User visible support for charset conversion.
547 AC_ARG_ENABLE([charset],
548 [ --enable-charset Support for charset selection and conversion [[no]]])
550 if test "x$enable_charset" = xyes; then
551 if test "x$am_cv_func_iconv" != xyes; then
552 AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
554 AC_DEFINE(HAVE_CHARSET, 1,
555 [Define to enable charset selection and conversion])
560 if test "$GLIBC21" != yes; then
561 AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
569 dnl Libraries used only when building the mc binary
572 dnl Version for the RedHat package, without dashes
573 RPM_VERSION=`echo $VERSION | sed 's/-//g'`
574 AC_SUBST(RPM_VERSION)
576 if test -n "$use_smbfs"; then
577 AC_CONFIG_SUBDIRS([vfs/samba])
580 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
581 AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
582 AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue])
583 AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$use_undelfs"])
584 AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
585 AM_CONDITIONAL(USE_MCFS, [test -n "$use_mcfs"])
586 AM_CONDITIONAL(INCLUDED_SLANG, [test "x$with_screen" = xmcslang])
587 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
588 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
590 AH_BOTTOM([#include <extraconf.h>])
628 doc/mc.1 doc/mcedit.1 doc/mcview.1 doc/mcserv.8
629 doc/es/mc.1 doc/es/Makefile
630 doc/hu/mc.1 doc/hu/Makefile
631 doc/it/mc.1 doc/it/Makefile
632 doc/pl/mc.1 doc/pl/Makefile
633 doc/ru/mc.1 doc/ru/Makefile
644 Source code location: ${srcdir}
646 Compiler flags: ${CFLAGS}
647 File system: ${vfs_type}
649 Screen library: ${screen_msg}
650 Mouse support: ${mouse_lib}
651 X11 events support: ${textmode_x11_support}
652 With subshell support: ${subshell}
653 Internal editor: ${edit_msg}