mc/configure.in

626 lines
14 KiB
Plaintext

dnl
dnl Configure.in file for the Midnight Commander
dnl
AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
AC_PREREQ(2.52)
AC_CONFIG_SRCDIR(src/main.c)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE(mc, 4.6.0-pre1b)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AC_AIX
AC_MINIX
AC_ISC_POSIX
AC_PROG_CC_STDC
dnl
dnl Check if the user requested to compile with glib 2.x. If not, use
dnl glib 1.2.x. This check should be kept close to the beginning, as it
dnl fails for the users without any glib.
dnl
AC_ARG_WITH(glib2, [ --with-glib2 Use glib 2.x [[no]]])
if test "x$with_glib2" = "xyes" ; then
PKG_CHECK_MODULES(GLIB, "glib-2.0")
else
dnl This temporary variable is a workaround for a bug in Autoconf-2.53
glib_path=$PATH:/usr/local/bin
dnl Klugde for FreeBSD, where glib-config is renamed to glib12-config.
AC_PATH_PROGS([GLIB_CONFIG], [glib-config glib12-config],,[$glib_path])
AC_ARG_VAR([GLIB_CONFIG], [Path to glib-config (version 1.2.x only)])
AM_PATH_GLIB(1.2.6,,[AC_MSG_ERROR([Test for glib failed.
GNU Midnight Commander requires glib 1.2.6 or above.])])
fi
AC_HEADER_MAJOR
AC_C_CONST
AC_SYS_LARGEFILE
AC_PROG_LN_S
AC_CHECK_TOOL(AR, ar, ar)
dnl Only list browsers here that can be run in background (i.e. with `&')
AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
dnl
dnl Ovverriding mmap support. This has to be before AC_FUNC_MMAP is used.
dnl We use only part of the functionality of mmap, so on AIX,
dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
dnl
AC_ARG_WITH(mmap,
[ --with-mmap Force using the mmap call (only useful on AIX)],
[case $withval in
yes)
ac_cv_func_mmap_fixed_mapped=yes
AC_MSG_NOTICE([forcing MMAP support])
;;
no)
ac_cv_func_mmap_fixed_mapped=no
AC_MSG_NOTICE([disabling MMAP support])
;;
esac])
AC_FUNC_MMAP
ALL_LINGUAS="az be bg ca cs da de el es es_ES eu fi fr hu it ja ko lv \
nl no pl pt pt_BR ro ru sk sl sv uk ta tr wa zh_CN zh_TW"
dnl
dnl Internationalization
dnl
AM_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION(0.11.5)
if test "x$USE_INCLUDED_LIBINTL" = xyes; then
CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
fi
dnl
dnl Hack to make extraconf.h visible even if compiling outside srcdir.
dnl
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)"
dnl
dnl Enforce coding standards
dnl
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -Wall"
fi
dnl
dnl OS specific flags.
dnl
posix_libs=""
case $host_os in
aux*)
# A/UX
posix_libs="-lposix"
AC_DEFINE(_POSIX_SOURCE)
;;
sco*)
AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code])
AC_DEFINE(_SVID3, 1, [Needs to be defined on SCO])
;;
esac
AC_PROG_INSTALL
AC_CHECK_HEADERS([unistd.h string.h memory.h crypt.h grp.h limits.h \
malloc.h stdlib.h termios.h utime.h fcntl.h pwd.h sys/statfs.h \
sys/time.h sys/timeb.h sys/select.h sys/ioctl.h stropts.h \
arpa/inet.h])
AC_HEADER_TIME
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
AC_HEADER_STDC
dnl Missing structure components
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
dnl
dnl Check availability of some functions
dnl
AC_CHECK_FUNCS([strerror statfs strftime \
memmove pwdauth truncate initgroups putenv \
memset memcpy tcsetattr tcgetattr cfgetospeed \
sigaction sigemptyset sigprocmask sigaddset \
sysconf setuid setreuid telldir seekdir])
dnl
dnl getpt is a GNU Extension (glibc 2.1.x)
dnl
AC_CHECK_FUNCS(getpt)
dnl
dnl On SCO and some SVR4, crypt is on libcrypt.a
dnl grantpt in libpt.a
dnl
LCRYPT=""
AC_CHECK_FUNCS(crypt, , [
AC_CHECK_LIB(crypt, crypt, [LCRYPT="-lcrypt"], [
AC_CHECK_LIB(crypt_i, crypt, [LCRYPT="-lcrypt_i"])])])
AC_SUBST(LCRYPT)
AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
dnl replacing lstat with statlstat on sco makes it more portable between
dnl sco clones
AC_CHECK_FUNCS(statlstat)
dnl
dnl If running under AIX, AC_AIX does not tell us that
dnl
AC_MSG_CHECKING([for AIX defines])
AC_EGREP_CPP(yes,
[#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
yes
#endif
], [
AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
AC_MSG_RESULT(yes)
], [AC_MSG_RESULT(no)])
dnl
dnl This is from GNU fileutils, check aclocal.m4 for more information
dnl
AC_GET_FS_INFO
dnl
dnl Missing typedefs and replacements
dnl
AC_TYPE_MODE_T
AC_CHECK_TYPE(umode_t, int)
AC_CHECK_TYPE(off_t, long)
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_CHECK_TYPE(nlink_t, unsigned int)
AC_FUNC_ALLOCA
AC_FUNC_STRCOLL
dnl
dnl X11 support.
dnl
textmode_x11_support="no"
AC_ARG_WITH(tm-x-support,
[ --with-tm-x-support Get keyboard events from X Window System [[no]]],
[if test x$withval = xyes; then
AC_PATH_XTRA
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT, 1,
[Define to enable getting events from X Window System])
textmode_x11_support="yes"
fi
])
dnl
dnl Network related functions
dnl
AC_CHECK_LIB(nsl, t_accept)
AC_CHECK_LIB(socket, socket)
have_socket=no
AC_CHECK_FUNCS(socket, have_socket=yes)
if test $have_socket = no; then
# socket is not in the default libraries. See if it's in some other.
for lib in bsd socket inet; do
AC_CHECK_LIB($lib, socket, [
LIBS="$LIBS -l$lib"
have_socket=yes
AC_DEFINE(HAVE_SOCKET)
break])
done
fi
have_gethostbyname=no
AC_CHECK_FUNC(gethostbyname, [have_gethostbyname=yes])
if test $have_gethostbyname = no; then
# gethostbyname is not in the default libraries. See if it's in some other.
for lib in bsd socket inet; do
AC_CHECK_LIB([$lib], [gethostbyname],
[LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
done
fi
AC_CHECK_FUNCS(socketpair)
dnl
dnl Sequent wants getprocessstats
dnl
AC_CHECK_LIB(seq, get_process_stats, [
LIBS="$LIBS -lseq"
AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
[Define if you have function `get_process_stats' and
have to use that instead of gettimeofday])])
MC_VFS_CHECKS
vfs_type="normal"
if test x$use_vfs = xyes; then
AC_MSG_NOTICE([enabling VFS code])
vfs_type="Midnight Commander Virtual File System"
fi
dnl
dnl Check for gpm mouse support (Linux only)
dnl
mouse_lib="xterm only"
AC_ARG_WITH(gpm-mouse,
[ --with-gpm-mouse Compile with gpm mouse support (Linux only)
[[yes if found]]])
case $host_os in
linux*)
if test x$with_gpm_mouse != xno; then
AC_CHECK_LIB(gpm, Gpm_Repeat,
[AC_DEFINE(HAVE_LIBGPM, 1,
[Define to enable gpm mouse support on Linux])
mouse_lib="gpm and xterm"
MCLIBS="$MCLIBS -lgpm"],
[AC_MSG_WARN([libgpm is missing or older than 0.18])
])
fi
;;
esac
dnl
dnl Check for the -mandoc package
dnl
AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
if $HAVE_nroff; then
AC_MSG_CHECKING([for manual formatting macros])
AC_CACHE_VAL(ac_cv_mandoc, [
nroff -mandoc < /dev/null > /dev/null 2>&1
if test $? = 0
then
ac_cv_mandoc=-mandoc
else
ac_cv_mandoc=-man
fi
])
MANDOC=$ac_cv_mandoc
AC_MSG_RESULT([$MANDOC])
else
MANDOC=-man
fi
AC_SUBST(MANDOC)
dnl
dnl Check if nroff accepts -Tlatin1 or -Tascii
dnl
if $HAVE_nroff; then
AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
AC_CACHE_VAL(ac_cv_nroff_tascii, [
nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
if test $? = 0
then
ac_cv_nroff_tascii=" -Tlatin1"
else
nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
if test $? = 0
then
ac_cv_nroff_tascii=" -Tascii"
else
ac_cv_nroff_tascii=""
fi
fi
])
if test "x$ac_cv_nroff_tascii" = x; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes,$ac_cv_nroff_tascii])
fi
fi
TROFFASCII="$ac_cv_nroff_tascii"
AC_SUBST(TROFFASCII)
dnl
dnl Check for - option to file
dnl
AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
if $HAVE_FILECMD; then
AC_MSG_CHECKING([for - option to file command])
AC_CACHE_VAL(ac_cv_filestdin, [[
cat > conftest.c <<\EOF
/* A comment */
#if 0
#endif
void main(void)
{ return; }
EOF
cat > conftest.sed <<\EOF
s/^[^:]*:[ ]*//
s/[ ]*$//
EOF
filehyphen_1=`file conftest.c 2>/dev/null | sed -f conftest.sed`
filehyphen_2=`cat conftest.c | file - 2>/dev/null | sed -f conftest.sed`
if test "x$filehyphen_1" = "x$filehyphen_2"; then
ac_cv_filestdin=yes
else
ac_cv_filestdin=no
fi
rm conftest.c conftest.sed
]])
if test x$ac_cv_filestdin = xyes; then
AC_DEFINE(FILE_STDIN, 1,
[Define if the file command accepts - for stdin])
fi
filestdin=$ac_cv_filestdin
AC_MSG_RESULT([$filestdin])
dnl
dnl Check for -L option to file
dnl
AC_MSG_CHECKING([for -L option to file command])
AC_CACHE_VAL(ac_cv_filel, [
file -L . > /dev/null 2>&1
if test $? = 0
then
ac_cv_filel=yes
else
ac_cv_filel=no
fi
])
if test x$ac_cv_filel = xyes; then
AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
fi
filel=$ac_cv_filel
AC_MSG_RESULT([$filel])
fi
AC_MSG_CHECKING([for subshell support])
AC_ARG_WITH(subshell,
[ --with-subshell Compile in concurrent subshell [[yes]]
--with-subshell=optional Don't run concurrent shell by default [[no]]],
[result=no
if test x$withval = xoptional
then
AC_DEFINE(SUBSHELL_OPTIONAL, 1,
[Define to make subshell support optional])
result="optional"
fi
if test x$withval = xyes
then
result="yes"
fi],
[dnl Default: enable the subshell support
result="yes"
])
if test "x$result" != xno; then
AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
[Define to enable subshell support])
fi
AC_MSG_RESULT([$result])
subshell="$result"
dnl
dnl Select the screen library. mcslang is the included S-Lang library.
dnl
AC_ARG_WITH(screen,
[ --with-screen=LIB Compile with screen library: slang, mcslang or
ncurses [[slang if found, else mcslang]]])
case x$with_screen in
xslang)
MC_WITH_SLANG(strict)
;;
xmcslang)
MC_WITH_MCSLANG
;;
xncurses)
MC_WITH_NCURSES
;;
x)
MC_WITH_SLANG
;;
*)
AC_MSG_ERROR([Value of the screen library is incorrect])
;;
esac
dnl
dnl Force using termcap. This option is processed in MC_WITH_MCSLANG.
dnl Report an error if this option is not applicable.
dnl
AC_ARG_WITH(termcap,
[ --with-termcap Try using termcap database [[only if no terminfo]]],
[if test x$with_screen != xmcslang; then
AC_MSG_ERROR([Option `--with-termcap' only works with `--with-screen=mcslang'])
fi
])
dnl
dnl Internal editor support.
dnl
AC_ARG_WITH(edit,
[ --with-edit Enable internal editor [[yes]]])
if test x$with_edit != xno; then
AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
use_edit=yes
edit_msg="yes"
AC_MSG_NOTICE([using internal editor])
else
edit_msg="no"
fi
if test $use_vfs = yes; then
AC_ARG_WITH(ext2undel,
[ --with-ext2undel Compile with ext2 undelete code [[yes if found]]],
[if test x$withval != xno; then
if test x$withval != xyes; then
LDFLAGS="$LDFLAGS -L$withval/lib"
CPPFLAGS="$CPPFLAGS -I$withval/include"
fi
AC_EXT2_UNDEL
fi],[
dnl Default: detect
AC_CHECK_LIB(ext2fs, ext2fs_close, [AC_EXT2_UNDEL], , [-lcom_err])
])
fi
dnl
dnl The variables used for expanding the auto saver.
dnl
cons_saver=""
install_saver="no"
PAMLIBS=""
case $host_os in
linux*)
cons_saver="cons.saver"
install_saver="yes"
dnl
dnl On Linux, check for PAM authentication available
dnl
AC_CHECK_LIB(pam, pam_start, [
AC_DEFINE(HAVE_PAM, 1,
[Define if PAM (Pluggable Authentication Modules) is available])
PAMLIBS="-lpam -ldl"
],[],[-ldl])
;;
esac
AC_SUBST(cons_saver)
AC_SUBST(PAMLIBS)
dnl
dnl User visible support for charset conversion.
dnl
AC_ARG_ENABLE([charset],
[ --enable-charset Support for charset selection and conversion [[no]]])
have_charset=
if test "x$enable_charset" = xyes; then
if test "x$am_cv_func_iconv" != xyes; then
AC_MSG_WARN([Cannot enable charset support because iconv function is missing])
else
AC_DEFINE(HAVE_CHARSET, 1,
[Define to enable charset selection and conversion])
have_charset=yes
fi
fi
if test "$GLIBC21" != yes; then
AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
fi
LIBS="$LIBS $posix_libs"
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
dnl Libraries used only when building the mc binary
AC_SUBST(MCLIBS)
dnl Version for the RedHat package, without dashes
RPM_VERSION=`echo $VERSION | sed 's/-//g'`
AC_SUBST(RPM_VERSION)
if test -n "$use_smbfs"; then
AC_CONFIG_SUBDIRS([vfs/samba])
fi
AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
AM_CONDITIONAL(USE_VFS, [test "x$use_vfs" = xyes])
AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue])
AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$use_undelfs"])
AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
AM_CONDITIONAL(USE_MCFS, [test -n "$use_mcfs"])
AM_CONDITIONAL(INCLUDED_SLANG, [test "x$with_screen" = xmcslang])
AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
AH_BOTTOM([#include <extraconf.h>])
AC_CONFIG_FILES([
Makefile
mc.spec
doc/Makefile
vfs/Makefile
vfs/extfs/Makefile
lib/Makefile
src/Makefile
slang/Makefile
edit/Makefile
syntax/Makefile
pc/Makefile
m4/Makefile
lib/mc.ext
lib/mc.sh
lib/mc.csh
vfs/extfs/deb
vfs/extfs/ftplist
vfs/extfs/lslR
vfs/extfs/uar
vfs/extfs/ucpio
vfs/extfs/ulha
vfs/extfs/uha
vfs/extfs/urar
vfs/extfs/uzoo
doc/mc.1 doc/mcedit.1 doc/mcserv.8
doc/es/mc.1 doc/es/Makefile
doc/hu/mc.1 doc/hu/Makefile
doc/it/mc.1 doc/it/Makefile
doc/pl/mc.1 doc/pl/Makefile
doc/ru/mc.1 doc/ru/Makefile
intl/Makefile
po/Makefile.in
])
AC_OUTPUT
# Expand $bindir and $datadir to show the user.
# Two levels of expansion should be enough.
bindir_msg=`eval echo "$bindir"`
bindir_msg=`eval echo "$bindir_msg"`
datadir_msg=`eval echo "$datadir"`
datadir_msg=`eval echo "$datadir_msg"`
echo "
Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
Compiler flags: ${CFLAGS}
File system: ${vfs_type}
${vfs_flags}
Screen library: ${screen_msg}
Install console saver: ${install_saver}
Mouse support: ${mouse_lib}
X11 events support: ${textmode_x11_support}
With subshell support: ${subshell}
Internal editor: ${edit_msg}
Install path for binaries: ${bindir_msg}
Install path for data: ${datadir_msg}
"