Ticket #2129: fix build with static GLib.
[midnight-commander.git] / configure.ac
blob6c363111b4349b8371cef05ced7980a62aef464e
1 dnl
2 dnl Configure.in file for the Midnight Commander
3 dnl
5 AC_PREREQ(2.60)
6 AC_INIT([GNU Midnight Commander], [], [mc-devel@gnome.org])
7 m4_pattern_forbid(MC_)
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_AUX_DIR(config)
10 AC_CONFIG_SRCDIR(src/main.c)
11 AC_CONFIG_HEADERS(config.h)
12 MC_VERSION
13 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_MAINTAINER_MODE
19 AC_CANONICAL_HOST
21 AC_USE_SYSTEM_EXTENSIONS
24 dnl ############################################################################
25 dnl Check for compiler
26 dnl ############################################################################
28 AC_PROG_CC_STDC
29 AM_PROG_CC_C_O
31 MC_CHECK_CFLAGS
33 CFLAGS_OPTS=""
34 if test "x$CFLAGS" = "x"; then
35     CFLAGS_OPTS=" -O2 "
37 if test x$USE_MAINTAINER_MODE = xyes; then
38     CFLAGS_OPTS="-g3 -O -ggdb"
39     AC_DEFINE(USE_MAINTAINER_MODE, 1, [Use maintainer mode])
42 AC_ARG_ENABLE([werror],
43     AS_HELP_STRING([--enable-werror], [Handle all compiler warnings as errors]))
44 if test "x$enable_werror" = xyes; then
45     MC_CHECK_ONE_CFLAG([-Werror])
48 AC_PROG_LIBTOOL
51 dnl ############################################################################
52 dnl Check for programs
53 dnl ############################################################################
55 PKG_PROG_PKG_CONFIG
56 AC_PROG_INSTALL
57 AC_PROG_LN_S
58 AC_PATH_PROG([PERL], [perl], [/usr/bin/perl])
59 AC_PATH_PROG([PYTHON], [python], [/usr/bin/python])
60 AC_PATH_PROG([RUBY], [ruby], [/usr/bin/ruby])
62 dnl Check nroff and the options it supports
63 AC_CHECK_PROG(HAVE_nroff, nroff, true, false)
64 dnl Default values
65 MANDOC=-man
66 MAN_FLAGS=
67 if $HAVE_nroff; then
68     AC_MSG_CHECKING([for manual formatting macros])
69     AC_CACHE_VAL(mc_cv_mandoc, [
70     nroff -mandoc < /dev/null > /dev/null 2>&1
71     if test $? = 0; then
72         mc_cv_mandoc=-mandoc
73     else
74         mc_cv_mandoc=-man
75     fi
76     ])
77     MANDOC=$mc_cv_mandoc
78     AC_MSG_RESULT([$MANDOC])
80     AC_MSG_CHECKING([for option to disable ANSI color in manuals])
81     AC_CACHE_VAL(mc_cv_man_nocolor, [
82     nroff -c < /dev/null > /dev/null 2>&1
83     if test $? = 0; then
84         mc_cv_man_nocolor=-c
85     else
86         mc_cv_man_nocolor=
87     fi
88     ])
89     MAN_FLAGS=$mc_cv_man_nocolor
90     AC_MSG_RESULT([${MAN_NOCOLOR-none}])
92     AC_MSG_CHECKING([if nroff accepts -Tlatin1 or -Tascii])
93     AC_CACHE_VAL(mc_cv_nroff_tascii, [
94     mc_cv_nroff_tascii=
95     nroff -Tlatin1 < /dev/null > /dev/null 2>&1 /dev/null
96     if test $? = 0; then
97         mc_cv_nroff_tascii=-Tlatin1
98     else
99         nroff -Tascii < /dev/null > /dev/null 2>&1 /dev/null
100         if test $? = 0; then
101             mc_cv_nroff_tascii=-Tascii
102         fi
103     fi
104     ])
105     AC_MSG_RESULT([${mc_cv_nroff_tascii-no}])
106     MAN_FLAGS="$MAN_FLAGS $mc_cv_nroff_tascii"
109 AC_SUBST(MANDOC)
110 AC_SUBST(MAN_FLAGS)
112 dnl Check for -L option to file
113 AC_CHECK_PROG(HAVE_FILECMD, file, true, false)
114 if $HAVE_FILECMD; then
115     AC_MSG_CHECKING([for -L option to file command])
116     AC_CACHE_VAL(mc_cv_filel, [
117     file -L . > /dev/null 2>&1
118     if test $? = 0; then
119         mc_cv_filel=yes
120     else
121         mc_cv_filel=no
122     fi
123     ])
124     if test x$mc_cv_filel = xyes; then
125         AC_DEFINE(FILE_L, 1, [Define if the file command accepts the -L option])
126     fi
127     filel=$mc_cv_filel
128     AC_MSG_RESULT([$filel])
131 dnl Only list browsers here that can be run in background (i.e. with `&')
132 AC_CHECK_PROGS(X11_WWW, [gnome-moz-remote mozilla firefox konqueror opera])
135 dnl ############################################################################
136 dnl Check for other tools
137 dnl ############################################################################
139 AC_CHECK_TOOL(AR, ar, ar)
140 MC_UNIT_TESTS
143 dnl ############################################################################
144 dnl Check for main libraies
145 dnl ############################################################################
147 AC_CHECK_GLIB
148 MC_WITH_SCREEN
149 MC_CHECK_SEARCH_TYPE
150 dnl X11 support. Used to read keyboard modifiers when running under X11.
151 MC_WITH_X
154 dnl ############################################################################
155 dnl Check for header files
156 dnl ############################################################################
158 AC_CHECK_HEADERS([string.h memory.h limits.h malloc.h \
159         utime.h sys/statfs.h sys/vfs.h \
160         sys/select.h sys/ioctl.h stropts.h arpa/inet.h \
161         sys/socket.h sys/sysmacros.h sys/mkdev.h])
162 AC_HEADER_ASSERT
165 dnl ############################################################################
166 dnl Check for types
167 dnl ############################################################################
169 dnl Check largefile before type sizeof checks
170 AC_SYS_LARGEFILE
172 AC_CHECK_SIZEOF(long)
173 AC_TYPE_UINTMAX_T
174 AC_CHECK_SIZEOF(uintmax_t)
175 AC_TYPE_OFF_T
176 AC_CHECK_SIZEOF(off_t)
177 AC_TYPE_MODE_T
178 AC_TYPE_PID_T
179 AC_TYPE_UID_T
181 AC_STRUCT_ST_BLOCKS
182 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_rdev])
184 AH_TEMPLATE([sig_atomic_t],
185             [/* Define to `int' if <signal.h> doesn't define.])
186 AH_TEMPLATE([SIG_ATOMIC_VOLATILE_T],
187             [Some systems declare sig_atomic_t as volatile, some others -- no.
188              This define will have value `sig_atomic_t' or
189              `volatile sig_atomic_t' accordingly.])
191 AC_MSG_CHECKING(for sig_atomic_t in signal.h)
192 AC_EGREP_HEADER(sig_atomic_t,signal.h,
193   [
194     ac_cv_type_sig_atomic_t=yes;
195     AC_EGREP_HEADER(volatile.*sig_atomic_t,
196                     signal.h,
197                     [
198                         is_sig_atomic_t_volatile=yes;
199                         AC_MSG_RESULT([yes, volatile])
200                     ],
201                     [
202                         is_sig_atomic_t_volatile=no;
203                         AC_MSG_RESULT([yes, non volatile])
204                     ])
205   ],
206   [
207     AC_MSG_RESULT(no)
208     AC_CHECK_TYPE(sig_atomic_t, int)
209     is_sig_atomic_t_volatile=no
210   ])
211 if test $is_sig_atomic_t_volatile = 'yes'
212 then
213     AC_DEFINE(SIG_ATOMIC_VOLATILE_T, sig_atomic_t)
214 else
215     AC_DEFINE(SIG_ATOMIC_VOLATILE_T, [volatile sig_atomic_t])
219 dnl ############################################################################
220 dnl Check for functions
221 dnl ############################################################################
223 AC_CHECK_FUNCS([\
224         strverscmp \
225         strncasecmp \
226         realpath
229 dnl getpt is a GNU Extension (glibc 2.1.x)
230 AC_CHECK_FUNCS(posix_openpt, , [AC_CHECK_FUNCS(getpt)])
231 AC_CHECK_FUNCS(grantpt, , [AC_CHECK_LIB(pt, grantpt)])
233 dnl replacing lstat with statlstat on sco makes it more portable between
234 dnl sco clones
235 AC_CHECK_FUNCS(statlstat)
237 dnl Ovverriding mmap support.  This has to be before AC_FUNC_MMAP is used.
238 dnl We use only part of the functionality of mmap, so on AIX,
239 dnl it's possible to use mmap, even if it doesn't pass the autoconf test.
240 AC_ARG_WITH([mmap],
241         AS_HELP_STRING([--with-mmap], [Use the mmap call @<:@yes if found@:>@]))
242 if test x$with_mmap != xno; then
243     if test x$with_mmap = x; then
244         AC_FUNC_MMAP
245     else
246         AC_DEFINE(HAVE_MMAP, 1)
247     fi
250 dnl Sequent wants getprocessstats
251 AC_CHECK_LIB(seq, get_process_stats, [
252         LIBS="$LIBS -lseq"
253         AC_DEFINE(HAVE_GET_PROCESS_STATS, 1,
254                   [Define if you have function `get_process_stats' and
255 have to use that instead of gettimeofday])])
257 mc_AC_GET_FS_INFO
260 dnl ############################################################################
261 dnl Internationalization
262 dnl ############################################################################
264 AM_GNU_GETTEXT(no-libtool, need-ngettext)
265 AM_GNU_GETTEXT_VERSION(0.14.3)
267 MC_I18N
269 dnl ############################################################################
270 dnl OS specific flags
271 dnl ############################################################################
273 case $host_os in
274 aux*)
275     # A/UX
276     LIBS="$LIBS -lposix"
277     AC_DEFINE(_POSIX_SOURCE)
278     ;;
279 esac
281 dnl If running under AIX, AC_AIX does not tell us that
282 AC_MSG_CHECKING([for AIX defines])
283 AC_EGREP_CPP([yes],
284     [
285         #if defined(AIX) || defined(_AIX) || defined(__aix__) || defined(aix)
286         yes
287         #endif
288     ],
289     [
290         AC_DEFINE(IS_AIX, 1, [Define if compiling for AIX])
291         AC_MSG_RESULT(yes)
292     ],
293     [
294         AC_MSG_RESULT(no)
295     ])
297 dnl Check if the OS is supported by the console saver.
298 cons_saver=""
299 case $host_os in
300 linux*)
301     cons_saver=yes
302 esac
304 dnl Check for gpm mouse support (Linux only)
305 mouse_lib="xterm only"
306 AC_ARG_WITH([gpm-mouse],
307     AS_HELP_STRING([--with-gpm-mouse], [Compile with gpm mouse support (Linux only) @<:@yes if found@:>@]))
309 case $host_os in
310 linux*)
311     if test x$with_gpm_mouse != xno; then
312         AC_CHECK_LIB(gpm, Gpm_Repeat,
313             [AC_DEFINE(HAVE_LIBGPM, 1,
314                        [Define to enable gpm mouse support on Linux])
315             mouse_lib="gpm and xterm"
316             MCLIBS="$MCLIBS -lgpm -ltinfo"],
317             if test "x$with_gpm_mouse" = "xyes"; then
318                 [AC_MSG_ERROR([libgpm is missing or older than 0.18])]
319             else
320                 [AC_MSG_WARN([libgpm is missing or older than 0.18])]
321             fi
322         )
323     fi
324     ;;
325 esac
328 dnl ############################################################################
329 dnl libmc
330 dnl ############################################################################
332 LIBMC_VERSION="0.0.1"
333 LIBMC_RELEASE="1"
334 AC_SUBST(LIBMC_VERSION)
335 AC_SUBST(LIBMC_RELEASE)
337 AC_ARG_ENABLE([mclib],
338         [AS_HELP_STRING([--enable-mclib], [Compile shared library libmc.so @<:@no@:>@])],
339         [
340             if test "x$enableval" = "xno" ; then
341                 enable_mclib=no
342             else
343                 if test "x$enable_shared" = "xno" ; then
344                     AC_MSG_WARN([Build of shared library is disabled. Specify --enable-shared first])
345                     enable_mclib=no
346                 else
347                     enable_mclib=yes
348                 fi
349             fi
350         ],
351         [enable_mclib=no])
353 AM_CONDITIONAL([ENABLE_MCLIB], [test x$enable_mclib = xyes])
356 dnl ############################################################################
357 dnl Where config files should be placed
358 dnl ############################################################################
360 AC_ARG_WITH([homedir],
361     AS_HELP_STRING([--with-homedir],
362                    [Choose any place of user settings relative to home dir, or XDG for respect XDG standards @<:@XDG@:>@]),
363     [
364         if test "x$withval" = "xXDG"; then
365             with_homedir=XDG
366         else
367             with_homedir=$withval
368         fi
369     ],
370     [with_homedir=XDG])
373 if test x$with_homedir = xXDG; then
374     AC_DEFINE(MC_HOMEDIR_XDG, 1,
375         [Define to enable XDG standard support])
376 else
377     AC_DEFINE_UNQUOTED([MC_USERCONF_DIR], ["$with_homedir"], [Where configs will be placed relative to $HOME])
381 dnl ############################################################################
382 dnl MC options
383 dnl ############################################################################
385 MC_WITH_INTERNAL_EDIT
387 dnl Diff viewer support.
388 AC_ARG_WITH([diff_viewer],
389     AS_HELP_STRING([--with-diff-viewer], [Compile with diff viewer @<:@yes@:>@]))
391 if test x$with_diff_viewer != xno; then
392         AC_DEFINE(USE_DIFF_VIEW, 1, [Define to enable diff viewer])
393         use_diff=yes
394         diff_msg="yes"
395         AC_MSG_NOTICE([using diff viewer])
396 else
397         diff_msg="no"
400 MC_SUBSHELL
401 MC_BACKGROUND
402 AC_MC_VFS_CHECKS
404 dnl ############################################################################
405 dnl Directories
406 dnl ############################################################################
408 dnl ${prefix} and ${exec_prefix} are undefined here if --prefix is not used in command line
409 dnl Let define ${prefix} and ${exec_prefix}
410 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
411 test "x$exec_prefix" = "xNONE" && exec_prefix="${prefix}"
413 if test x${libexecdir} = x'${exec_prefix}/libexec'; then
414     EXTHELPERSDIR=${prefix}/libexec/${PACKAGE}/ext.d
415 elif test x${libexecdir} = x'${exec_prefix}/lib'; then
416     EXTHELPERSDIR=${prefix}/lib/${PACKAGE}/ext.d
417 else
418     EXTHELPERSDIR=${libexecdir}/${PACKAGE}/ext.d
420 AC_SUBST(EXTHELPERSDIR)
423 dnl ############################################################################
424 dnl Documentation
425 dnl ############################################################################
427 MAN_DATE="$(LC_ALL=C date "+%B %Y")"
428 AC_SUBST(MAN_DATE)
430 dnl Determine which help translations we want to install.
431 ALL_DOC_LINGUAS="es hu it pl ru sr"
433 DOC_LINGUAS=
434 if test "x$USE_NLS" = xyes; then
435     if test -z "$LINGUAS"; then
436         langs="`grep -v '^#' $srcdir/po/LINGUAS`"
437     else
438         langs="$LINGUAS"
439     fi
440 else
441     langs=
444 for h_lang in $ALL_DOC_LINGUAS; do
445     for lang in $langs; do
446         if test "$lang" = "$h_lang"; then
447             DOC_LINGUAS="$DOC_LINGUAS $lang"
448             break
449         fi
450     done
451 done
452 AC_SUBST(DOC_LINGUAS)
454 DX_HTML_FEATURE(ON)
455 DX_CHM_FEATURE(OFF)
456 DX_CHI_FEATURE(OFF)
457 DX_MAN_FEATURE(OFF)
458 DX_RTF_FEATURE(OFF)
459 DX_XML_FEATURE(OFF)
460 DX_PDF_FEATURE(OFF)
461 DX_PS_FEATURE(OFF)
462 DX_INIT_DOXYGEN(mc,doxygen.cfg,devel)
465 dnl ############################################################################
466 dnl Configure results
467 dnl ############################################################################
469 CFLAGS="$mc_configured_cflags $CFLAGS_OPTS $CFLAGS"
471 AC_SUBST(MCLIBS)
472 AC_SUBST(CFLAGS)
473 AC_SUBST(CPPFLAGS)
474 AC_SUBST(LDFLAGS)
475 AC_SUBST(LIBS)
477 AM_CONDITIONAL(USE_NLS, [test x"$USE_NLS" = xyes])
478 AM_CONDITIONAL(USE_MAINTAINER_MODE, [test x"$USE_MAINTAINER_MODE" = xyes])
479 AM_CONDITIONAL(USE_SCREEN_SLANG, [test x"$with_screen" = xslang])
480 AM_CONDITIONAL(USE_INTERNAL_EDIT, [test x"$use_internal_edit" = xyes ])
481 AM_CONDITIONAL(USE_ASPELL, [test x"$enable_aspell" = xyes ])
482 AM_CONDITIONAL(USE_DIFF, [test -n "$use_diff"])
483 AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
484 AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
486 AC_DEFINE_UNQUOTED([MC_CONFIGURE_ARGS], ["$ac_configure_args"], [MC configure arguments])
488 AC_CONFIG_FILES(
490 src/man2hlp/man2hlp
493 chmod +x src/man2hlp/man2hlp
496 AC_CONFIG_FILES([
497 Makefile
499 contrib/Makefile
500 contrib/dist/Makefile
501 contrib/dist/gentoo/Makefile
502 contrib/dist/redhat/Makefile
503 contrib/dist/redhat/mc.spec
504 contrib/dist/pkginfo
505 contrib/dist/prototype
507 misc/Makefile
508 misc/skins/Makefile
509 misc/ext.d/Makefile
510 misc/ext.d/doc.sh
511 misc/ext.d/misc.sh
512 misc/ext.d/text.sh
513 misc/ext.d/web.sh
514 misc/macros.d/Makefile
515 misc/mc.ext
517 src/Makefile
518 src/consaver/Makefile
519 src/editor/Makefile
520 src/man2hlp/Makefile
521 src/viewer/Makefile
522 src/diffviewer/Makefile
523 src/filemanager/Makefile
525 src/vfs/Makefile
527 src/vfs/cpio/Makefile
529 src/vfs/extfs/Makefile
530 src/vfs/extfs/helpers/Makefile
531 src/vfs/extfs/helpers/a+
532 src/vfs/extfs/helpers/apt+
533 src/vfs/extfs/helpers/audio
534 src/vfs/extfs/helpers/deb
535 src/vfs/extfs/helpers/deba
536 src/vfs/extfs/helpers/debd
537 src/vfs/extfs/helpers/dpkg+
538 src/vfs/extfs/helpers/iso9660
539 src/vfs/extfs/helpers/hp48+
540 src/vfs/extfs/helpers/lslR
541 src/vfs/extfs/helpers/mailfs
542 src/vfs/extfs/helpers/patchfs
543 src/vfs/extfs/helpers/rpms+
544 src/vfs/extfs/helpers/s3+
545 src/vfs/extfs/helpers/uace
546 src/vfs/extfs/helpers/ualz
547 src/vfs/extfs/helpers/uar
548 src/vfs/extfs/helpers/uarc
549 src/vfs/extfs/helpers/uarj
550 src/vfs/extfs/helpers/uc1541
551 src/vfs/extfs/helpers/ucab
552 src/vfs/extfs/helpers/uha
553 src/vfs/extfs/helpers/ulha
554 src/vfs/extfs/helpers/ulib
555 src/vfs/extfs/helpers/urar
556 src/vfs/extfs/helpers/uzip
557 src/vfs/extfs/helpers/uzoo
559 src/vfs/fish/Makefile
560 src/vfs/fish/helpers/Makefile
562 src/vfs/ftpfs/Makefile
564 src/vfs/sftpfs/Makefile
566 src/vfs/local/Makefile
568 src/vfs/sfs/Makefile
570 src/vfs/smbfs/Makefile
572 src/vfs/tar/Makefile
574 src/vfs/undelfs/Makefile
576 lib/Makefile
577 lib/event/Makefile
578 lib/filehighlight/Makefile
579 lib/mcconfig/Makefile
580 lib/search/Makefile
581 lib/skin/Makefile
582 lib/strutil/Makefile
583 lib/tty/Makefile
585 lib/vfs/Makefile
587 lib/widget/Makefile
589 misc/syntax/Makefile
590 misc/syntax/Syntax
592 doc/Makefile
594 doc/hints/Makefile
595 doc/hints/l10n/Makefile
597 doc/man/Makefile
598 doc/man/es/Makefile
599 doc/man/hu/Makefile
600 doc/man/it/Makefile
601 doc/man/pl/Makefile
602 doc/man/ru/Makefile
603 doc/man/sr/Makefile
605 doc/hlp/Makefile
606 doc/hlp/es/Makefile
607 doc/hlp/hu/Makefile
608 doc/hlp/it/Makefile
609 doc/hlp/pl/Makefile
610 doc/hlp/ru/Makefile
611 doc/hlp/sr/Makefile
613 intl/Makefile
614 po/Makefile.in
617 if test x$enable_tests != xno; then
618     AC_CONFIG_FILES([
619 tests/Makefile
620 tests/lib/Makefile
621 tests/lib/mcconfig/Makefile
622 tests/lib/search/Makefile
623 tests/lib/strutil/Makefile
624 tests/lib/vfs/Makefile
625 tests/lib/widget/Makefile
626 tests/src/Makefile
627 tests/src/filemanager/Makefile
628 tests/src/editor/Makefile
629 tests/src/editor/test-data.txt
633 AC_OUTPUT
635 AC_MSG_NOTICE([
637 Configuration:
639   Source code location:       ${srcdir}
640   Compiler:                   ${CC}
641   Compiler flags:             ${CFLAGS}
642   File system:                ${vfs_type}
643                               ${vfs_flags}
644   Screen library:             ${screen_msg}
645   Mouse support:              ${mouse_lib}
646   X11 events support:         ${textmode_x11_support}
647   With subshell support:      ${subshell}
648   With background operations: ${enable_background}
649   Internal editor:            ${edit_msg}
650   Diff viewer:                ${diff_msg}
651   Support for charset:        ${charset_msg}
652   Search type:                ${SEARCH_TYPE}