Refactoring.
[midnight-commander.git] / configure.ac
blob02c004213224f20eb125f1eb97fc899340facc7d
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
5 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
6 AC_PREREQ(2.60)
7 m4_pattern_forbid(MC_)
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_SRCDIR(src/main.c)
10 AC_CONFIG_AUX_DIR(config)
11 MC_VERSION
12 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_CONFIG_HEADER(config.h)
18 AM_MAINTAINER_MODE
19 AC_CANONICAL_HOST
21 AC_USE_SYSTEM_EXTENSIONS
23 AC_PROG_LIBTOOL
24 PKG_PROG_PKG_CONFIG
25 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
27 AC_ISC_POSIX
29 AC_PROG_CC_STDC
30 AM_PROG_CC_C_O
32 dnl Doxygen
34 DX_HTML_FEATURE(ON)
35 DX_CHM_FEATURE(OFF)
36 DX_CHI_FEATURE(OFF)
37 DX_MAN_FEATURE(OFF)
38 DX_RTF_FEATURE(OFF)
39 DX_XML_FEATURE(OFF)
40 DX_PDF_FEATURE(OFF)
41 DX_PS_FEATURE(OFF)
42 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
44 dnl PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
46 dnl
47 dnl First try glib 2.x.
48 dnl Keep this check close to the beginning, so that the users
49 dnl without any glib won't have their time wasted by other checks.
50 dnl
52 AC_ARG_WITH([glib_static],
53             [  --with-glib-static       Link glib statically [[no]]])
55 glib_found=no
57 PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.8], [glib_found=yes], [:])
58 if test x"$glib_found" = xno; then
59     AC_MSG_ERROR([glib-2.0 not found or version too old (must be >= 2.8)])
63 AC_HEADER_MAJOR
64 AC_C_CONST
65 AC_SYS_LARGEFILE
67 AC_PROG_LN_S
68 AC_CHECK_TOOL(AR, ar, ar)
70 dnl Only list browsers here that can be run in background (i.e. with `&')
71 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla konqueror opera netscape])
73 dnl
74 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
75 dnl We use only part of the functionality of mmap, so on AIX,
76 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
77 dnl
78 AC_ARG_WITH(mmap,
79         [  --with-mmap              Use the mmap call [[yes if found]]])
80 if test x$with_mmap != xno; then
81     if test x$with_mmap = x; then
82         AC_FUNC_MMAP
83     else
84         AC_DEFINE(HAVE_MMAP, 1)
85     fi
88 dnl
89 dnl Internationalization
90 dnl
91 AM_GNU_GETTEXT(no-libtool, need-ngettext)
92 AM_GNU_GETTEXT_VERSION(0.14.3)
94 if test "x$USE_INCLUDED_LIBINTL" = xyes; then
95     CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
98 dnl Determine which help translations we want to install.
99 ALL_DOC_LINGUAS="es hu it pl ru sr"
101 DOC_LINGUAS=
102 if test "x$USE_NLS" = xyes; then
103     if test -z "$LINGUAS"; then
104         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
105     else
106         langs="$LINGUAS"
107     fi
108 else
109     langs=
112 for h_lang in $ALL_DOC_LINGUAS; do
113     for lang in $langs; do
114         if test "$lang" = "$h_lang"; then
115             DOC_LINGUAS="$DOC_LINGUAS $lang"
116             break
117         fi
118     done
119 done
120 AC_SUBST(DOC_LINGUAS)
123 dnl OS specific flags.
125 case $host_os in
126 aux*)
127     # A/UX
128     LIBS="$LIBS -lposix"
129     AC_DEFINE(_POSIX_SOURCE)
130     ;;
131 esac
133 AC_PROG_INSTALL
134 AC_CHECK_HEADERS([unistd.h string.h memory.h limits.h malloc.h \
135         utime.h fcntl.h sys/statfs.h sys/vfs.h sys/time.h \
136         sys/timeb.h sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
137         security/pam_misc.h sys/socket.h sys/sysmacros.h sys/types.h \
138         sys/mkdev.h wchar.h wctype.h])
140 AC_HEADER_TIME
141 AC_HEADER_DIRENT
142 AC_HEADER_STDC
144 dnl Missing structure components
145 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
146 AC_STRUCT_ST_BLOCKS
149 dnl Check availability of some functions
152 AC_CHECK_FUNCS([\
153         atoll \
154         cfgetospeed \
155         initgroups isascii \
156         setreuid statfs sysconf \
157         tcgetattr tcsetattr truncate \
158         strverscmp \
159         strncasecmp \
160         realpath
164 dnl getpt is a GNU Extension (glibc 2.1.x)
166 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
167 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
169 dnl replacing lstat with statlstat on sco makes it more portable between
170 dnl sco clones
171 AC_CHECK_FUNCS(statlstat)
174 dnl If running under AIX, AC_AIX does not tell us that
176 AC_MSG_CHECKING([for AIX defines])
177 AC_EGREP_CPP(yes,
178 [#if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
180 #endif
181 ], [
182 AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
183 AC_MSG_RESULT(yes)
184 ], [AC_MSG_RESULT(no)])
187 dnl This is from GNU fileutils, check aclocal.m4 for more information
189 AC_GET_FS_INFO
192 dnl Missing typedefs and replacements
195 AC_CHECK_SIZEOF(long)
196 AC_CHECK_SIZEOF(long long)
197 AC_TYPE_MODE_T
198 AC_TYPE_OFF_T
199 AC_CHECK_SIZEOF(off_t)
200 AC_TYPE_PID_T
201 AC_TYPE_UID_T
202 AC_CHECK_TYPE(nlink_t, unsigned int)
203 AC_CHECK_TYPES([socklen_t],,,
205 #include <sys/types.h>
206 #include <sys/socket.h>
209 dnl This is needed for regex.c only
210 AC_CHECK_TYPE(uintptr_t,
211               [AC_DEFINE(HAVE_UINTPTR_T, 1,
212                          [Define if you have the `uintptr_t' type.])
215 AC_FUNC_ALLOCA
216 AC_FUNC_STRCOLL
219 dnl X11 support.
220 dnl Used to read keyboard modifiers when running under X11.
221 AC_PATH_XTRA
223 dnl Check if the gmodule functionality supported on this system.
224 AC_G_MODULE_SUPPORTED
227 dnl Try to find static libraries for glib and gmodule.
229 if test x$with_glib_static = xyes; then
230     new_GLIB_LIBS=
231     for i in $GLIB_LIBS; do
232         case x$i in
233         x-lglib*)
234             lib=glib ;;
235         x-lgmodule*)
236             lib=gmodule ;;
237         *)
238             lib=
239             add="$i" ;;
240         esac
242         if test -n "$lib"; then
243             lib1=`echo $i | sed 's/^-l//'`
244             if test -f "$GLIB_LIBDIR/lib${lib1}.a"; then
245                 add="$GLIB_LIBDIR/lib${lib1}.a"
246             else
247                 if test -f "$GLIB_LIBDIR/lib${lib}.a"; then
248                     add="$GLIB_LIBDIR/lib${lib}.a"
249                 else
250                     AC_MSG_ERROR([Cannot find static $lib])
251                 fi
252             fi
253         fi
254         new_GLIB_LIBS="$new_GLIB_LIBS $add"
255     done
256     GLIB_LIBS="$new_GLIB_LIBS"
260 dnl Sequent wants getprocessstats
262 AC_CHECK_LIB(seq, get_process_stats, [
263         LIBS="$LIBS -lseq"
264         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
265                   [Define if you have function `get_process_stats' and
266 have to use that instead of gettimeofday])])
268 AC_MC_VFS_CHECKS
271 dnl Check for gpm mouse support (Linux only)
273 mouse_lib="xterm only"
274 AC_ARG_WITH(gpm-mouse,
275         [  --with-gpm-mouse         Compile with gpm mouse support (Linux only)
276                            [[yes if found]]])
278 case $host_os in
279 linux*)
280     if test x$with_gpm_mouse != xno; then
281         AC_CHECK_LIB(gpm, Gpm_Repeat,
282             [AC_DEFINE(HAVE_LIBGPM, 1,
283                        [Define to enable gpm mouse support on Linux])
284             mouse_lib="gpm and xterm"
285             MCLIBS="$MCLIBS -lgpm"],
286             if test "x$with_gpm_mouse" = "xyes"; then
287                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
288             else
289                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
290             fi
291         )
292     fi
293     ;;
294 esac
296 MC_CHECK_SEARCH_TYPE
299 dnl Check nroff and the options it supports
301 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
303 dnl Default values
304 MANDOC=-man
305 MAN_FLAGS=
307 if $HAVE_nroff; then
308     AC_MSG_CHECKING([for manual formatting macros])
309     AC_CACHE_VAL(mc_cv_mandoc, [
310     nroff -mandoc < /dev/null > /dev/null 2>&1
311     if test $? = 0; then
312         mc_cv_mandoc=-mandoc
313     else
314         mc_cv_mandoc=-man
315     fi
316     ])
317     MANDOC=$mc_cv_mandoc
318     AC_MSG_RESULT([$MANDOC])
320     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
321     AC_CACHE_VAL(mc_cv_man_nocolor, [
322     nroff -c < /dev/null > /dev/null 2>&1
323     if test $? = 0; then
324         mc_cv_man_nocolor=-c
325     else
326         mc_cv_man_nocolor=
327     fi
328     ])
329     MAN_FLAGS=$mc_cv_man_nocolor
330     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
332     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
333     AC_CACHE_VAL(mc_cv_nroff_tascii, [
334     mc_cv_nroff_tascii=
335     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
336     if test $? = 0; then
337         mc_cv_nroff_tascii=-Tlatin1
338     else
339         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
340         if test $? = 0; then
341             mc_cv_nroff_tascii=-Tascii
342         fi
343     fi
344     ])
345     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
346     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
349 AC_SUBST(MANDOC)
350 AC_SUBST(MAN_FLAGS)
354 dnl Check for -L option to file
356 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
357 if $HAVE_FILECMD; then
358     AC_MSG_CHECKING([for -L option to file command])
359     AC_CACHE_VAL(mc_cv_filel, [
360     file -L . > /dev/null 2>&1
361     if test $? = 0; then
362         mc_cv_filel=yes
363     else
364         mc_cv_filel=no
365     fi
366     ])
367     if test x$mc_cv_filel = xyes; then
368         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
369     fi
370     filel=$mc_cv_filel
371     AC_MSG_RESULT([$filel])
375 AC_MSG_CHECKING([for subshell support])
376 AC_ARG_WITH(subshell,
377         [  --with-subshell          Compile in concurrent subshell [[yes]]
378   --with-subshell=optional Don't run concurrent shell by default [[no]]],
379         [result=no
380         if test x$withval = xoptional
381         then
382                 AC_DEFINE(SUBSHELL_OPTIONAL, 1,
383                           [Define to make subshell support optional])
384                 result="optional"
385         fi
386         if test x$withval = xyes
387         then
388                 result="yes"
389         fi],
390         [dnl Default: enable the subshell support
391         result="yes"
393 if test "x$result" != xno; then
394         AC_DEFINE(HAVE_SUBSHELL_SUPPORT, 1,
395                   [Define to enable subshell support])
397 AC_MSG_RESULT([$result])
398 subshell="$result"
401 MC_WITH_SCREEN
405 dnl Internal editor support.
407 AC_ARG_WITH(edit,
408         [  --with-edit              Enable internal editor [[yes]]])
410 if test x$with_edit != xno; then
411         AC_DEFINE(USE_INTERNAL_EDIT, 1, [Define to enable internal editor])
412         use_edit=yes
413         edit_msg="yes"
414         AC_MSG_NOTICE([using internal editor])
415 else
416         edit_msg="no"
420 dnl Diff viewer support.
422 AC_ARG_WITH(diff_viewer,
423         [  --with-diff-viewer       Compile with diff viewer [[yes]]])
425 if test x$with_diff_viewer != xno; then
426         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
427         use_diff=yes
428         diff_msg="yes"
429         AC_MSG_NOTICE([using diff viewer])
430 else
431         diff_msg="no"
435 dnl Check if the OS is supported by the console saver.
436 cons_saver=""
437 case $host_os in
438 linux*)
439     cons_saver=yes
440 esac
443 dnl Support for background operations
444 AC_ARG_ENABLE([background],
445               [  --enable-background     Support for background file operations [[yes]]])
446 if test "x$enable_background" != xno; then
447     AC_DEFINE(WITH_BACKGROUND, 1, [Define to enable background file operations])
452 dnl User visible support for charset conversion.
454 AC_ARG_ENABLE([charset],
455               [  --enable-charset        Support for charset selection and conversion [[yes]]])
456 have_charset=
457 charset_msg="no"
458 if test "x$enable_charset" != "xno"; then
459     AC_DEFINE(HAVE_CHARSET, 1,
460               [Define to enable charset selection and conversion])
461     have_charset=yes
462     charset_msg="yes"
465 if test "$GLIBC21" != yes; then
466     AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
469 MC_CHECK_CFLAGS
471 CFLAGS_OPTS=""
473 if test "x$CFLAGS" = "x"; then
474     CFLAGS_OPTS=" -O2 "
477 if test x$USE_MAINTAINER_MODE = xyes; then
478     CFLAGS_OPTS="-g3 -O -ggdb"
479     AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
482 AC_ARG_ENABLE(
483     [werror],
484     AC_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors] )
487 if test "x$enable_werror" = xyes; then
488     MC_CHECK_ONE_CFLAG([-Werror])
490 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
492 AC_SUBST(CFLAGS)
493 AC_SUBST(CPPFLAGS)
494 AC_SUBST(LDFLAGS)
495 AC_SUBST(LIBS)
497 dnl Libraries used only when building the mc binary
498 AC_SUBST(MCLIBS)
500 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
501 AC_SUBST(MAN_DATE)
503 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
504 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
505 AM_CONDITIONAL(USE_EDIT, [test -n "$use_edit"])
506 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
507 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
508 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
510 AC_CONFIG_FILES(
512 src/man2hlp/man2hlp
515 chmod +x src/man2hlp/man2hlp
518 AC_CONFIG_FILES([
519 Makefile
521 contrib/Makefile
522 contrib/dist/Makefile
523 contrib/dist/debian/Makefile
524 contrib/dist/gentoo/Makefile
525 contrib/dist/redhat/Makefile
526 contrib/dist/redhat/mc.spec
527 contrib/dist/pkginfo
528 contrib/dist/prototype
530 misc/Makefile
531 misc/skins/Makefile
532 misc/mc.ext
534 src/Makefile
535 src/consaver/Makefile
536 src/editor/Makefile
537 src/man2hlp/Makefile
538 src/viewer/Makefile
539 src/diffviewer/Makefile
540 src/filemanager/Makefile
542 lib/Makefile
543 lib/filehighlight/Makefile
544 lib/mcconfig/Makefile
545 lib/search/Makefile
546 lib/skin/Makefile
547 lib/strutil/Makefile
548 lib/tty/Makefile
549 lib/vfs/Makefile
550 lib/vfs/mc-vfs/Makefile
551 lib/vfs/mc-vfs/extfs/Makefile
552 lib/vfs/mc-vfs/extfs/a+
553 lib/vfs/mc-vfs/extfs/apt+
554 lib/vfs/mc-vfs/extfs/audio
555 lib/vfs/mc-vfs/extfs/deb
556 lib/vfs/mc-vfs/extfs/deba
557 lib/vfs/mc-vfs/extfs/debd
558 lib/vfs/mc-vfs/extfs/dpkg+
559 lib/vfs/mc-vfs/extfs/iso9660
560 lib/vfs/mc-vfs/extfs/hp48+
561 lib/vfs/mc-vfs/extfs/lslR
562 lib/vfs/mc-vfs/extfs/mailfs
563 lib/vfs/mc-vfs/extfs/patchfs
564 lib/vfs/mc-vfs/extfs/rpms+
565 lib/vfs/mc-vfs/extfs/s3+
566 lib/vfs/mc-vfs/extfs/uace
567 lib/vfs/mc-vfs/extfs/ualz
568 lib/vfs/mc-vfs/extfs/uar
569 lib/vfs/mc-vfs/extfs/uarc
570 lib/vfs/mc-vfs/extfs/uarj
571 lib/vfs/mc-vfs/extfs/uc1541
572 lib/vfs/mc-vfs/extfs/uha
573 lib/vfs/mc-vfs/extfs/ulha
574 lib/vfs/mc-vfs/extfs/urar
575 lib/vfs/mc-vfs/extfs/uzip
576 lib/vfs/mc-vfs/extfs/uzoo
577 lib/vfs/mc-vfs/fish/Makefile
578 lib/widget/Makefile
580 misc/syntax/Makefile
582 doc/Makefile
583 doc/hints/Makefile
584 doc/man/mc.1 doc/man/mcedit.1 doc/man/mcview.1 doc/man/Makefile
585 doc/man/es/mc.1 doc/man/es/Makefile
586 doc/man/hu/mc.1 doc/man/hu/Makefile
587 doc/man/it/mc.1 doc/man/it/Makefile
588 doc/man/pl/mc.1 doc/man/pl/Makefile
589 doc/man/ru/mc.1 doc/man/ru/Makefile
590 doc/man/sr/mc.1 doc/man/sr/Makefile
592 doc/hlp/Makefile
593 doc/hlp/es/Makefile
594 doc/hlp/hu/Makefile
595 doc/hlp/it/Makefile
596 doc/hlp/pl/Makefile
597 doc/hlp/ru/Makefile
598 doc/hlp/sr/Makefile
600 intl/Makefile
601 po/Makefile.in
604 AC_OUTPUT
606 echo "
607 Configuration:
609   Source code location:       ${srcdir}
610   Compiler:                   ${CC}
611   Compiler flags:             ${CFLAGS}
612   File system:                ${vfs_type}
613                               ${vfs_flags}
614   Screen library:             ${screen_msg}
615   Mouse support:              ${mouse_lib}
616   X11 events support:         ${textmode_x11_support}
617   With subshell support:      ${subshell}
618   Internal editor:            ${edit_msg}
619   Diff viewer:                ${diff_msg}
620   Support for charset:        ${charset_msg}
621   Search type:                ${SEARCH_TYPE}