sys/stat.h: drop __INSIDE_CYGWIN__ guards
[newlib-cygwin.git] / winsup / configure.ac
blob9b9b59dbcb571b26bb8e816f12ccb8793d6c09af
1 dnl Autoconf configure script for Cygwin.
2 dnl
3 dnl This file is part of Cygwin.
4 dnl
5 dnl This software is a copyrighted work licensed under the terms of the
6 dnl Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
7 dnl details.
8 dnl
9 dnl Process this file with autoconf to produce a configure script.
11 AC_PREREQ([2.59])
12 AC_INIT([Cygwin],[0],[cygwin@cygwin.com],[cygwin],[https://cygwin.com])
13 AC_CONFIG_AUX_DIR(..)
14 AC_CANONICAL_TARGET
15 AM_INIT_AUTOMAKE([foreign no-define no-dist subdir-objects -Wall -Wno-portability -Wno-extra-portability])
16 AM_SILENT_RULES([yes])
18 realdirpath() {
19     test -z "$1" && return 1
20     (cd "$1" 2>/dev/null && pwd)
21     if test $? -ne 0; then
22         return 1
23     else
24         return 0
25     fi
28 winsup_srcdir="$(realdirpath $srcdir)"
29 target_builddir="$(realdirpath ..)"
31 AC_NO_EXECUTABLES
33 AC_PROG_INSTALL
34 AC_PROG_MKDIR_P
35 AC_PROG_CC
36 AC_PROG_CXX
37 AC_PROG_CPP
38 AM_PROG_AS
40 AC_LANG(C)
41 AC_LANG(C++)
43 AC_ARG_WITH([cross-bootstrap],[AS_HELP_STRING([--with-cross-bootstrap],[do not build programs using the MinGW toolchain or check for MinGW libraries (useful for bootstrapping a cross-compiler)])],[],[with_cross_bootstrap=no])
45 AC_CYGWIN_INCLUDES
47 AC_CONFIG_HEADERS([cygwin/config.h])
49 AC_CHECK_TOOL(AR, ar, ar)
50 AC_CHECK_TOOL(AS, as, as)
51 AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool)
52 AC_CHECK_TOOL(LD, ld, ld)
53 AC_CHECK_TOOL(NM, nm, nm)
54 AC_CHECK_TOOL(OBJCOPY, objcopy, objcopy)
55 AC_CHECK_TOOL(OBJDUMP, objdump, objdump)
56 AC_CHECK_TOOL(RANLIB, ranlib, ranlib)
57 AC_CHECK_TOOL(STRIP, strip, strip)
58 AC_CHECK_TOOL(WINDRES, windres, windres)
60 AC_ARG_ENABLE(debugging,
61 [AS_HELP_STRING([--enable-debugging],[Build a cygwin DLL which has more consistency checking for debugging])],
62 [case "${enableval}" in
63 yes)     AC_DEFINE([DEBUGGING],[1],[Define if DEBUGGING support is requested.]) ;;
64 no)      ;;
65 esac
68 DLL_ENTRY="dll_entry"
70 case "$target_cpu" in
71    x86_64)      ;;
72    *)           AC_MSG_ERROR([Invalid target processor "$target_cpu"]) ;;
73 esac
75 AC_SUBST(DLL_ENTRY)
77 AM_CONDITIONAL(TARGET_X86_64, [test $target_cpu = "x86_64"])
79 AC_ARG_ENABLE(doc,
80               [AS_HELP_STRING([--disable-doc], [do not build documentation])],,
81               enable_doc=yes)
82 AM_CONDITIONAL(BUILD_DOC, [test $enable_doc != "no"])
84 AC_CHECK_PROGS([DOCBOOK2XTEXI], [docbook2x-texi db2x_docbook2texi])
85 if test -z "$DOCBOOK2XTEXI" ; then
86     if test "x$enable_doc" != "xno"; then
87         AC_MSG_ERROR([docbook2texi is required to build documentation])
88     else
89         unset DOCBOOK2XTEXI
90         AM_MISSING_PROG([DOCBOOK2XTEXI], [docbook2texi])
91     fi
94 AC_CHECK_PROGS([XMLTO], [xmlto])
95 if test -z "$XMLTO"; then
96     if test "x$enable_doc" != "xno"; then
97         AC_MSG_ERROR([xmlto is required to build documentation])
98     else
99         unset XMLTO
100         AM_MISSING_PROG([XMLTO], [xmlto])
101     fi
104 if test "x$with_cross_bootstrap" != "xyes"; then
105     AC_CHECK_PROGS(MINGW_CXX, ${target_cpu}-w64-mingw32-g++)
106     test -n "$MINGW_CXX" || AC_MSG_ERROR([no acceptable MinGW g++ found in \$PATH])
107     AC_CHECK_PROGS(MINGW_CC, ${target_cpu}-w64-mingw32-gcc)
108     test -n "$MINGW_CC" || AC_MSG_ERROR([no acceptable MinGW gcc found in \$PATH])
110 AM_CONDITIONAL(CROSS_BOOTSTRAP, [test "x$with_cross_bootstrap" != "xyes"])
112 AC_EXEEXT
114 AC_ARG_ENABLE([dumper],
115               [AS_HELP_STRING([--disable-dumper], [do not build the 'dumper' utility])],
116               [build_dumper=$enableval],
117               [build_dumper=yes])
119 AM_CONDITIONAL(BUILD_DUMPER, [test "x$build_dumper" = "xyes"])
121 # libbfd.a doesn't have a pkgconfig file, so we guess what it's dependencies
122 # are, based on what's present in the build environment
123 BFD_LIBS="-lintl -liconv -liberty -lz"
124 AC_CHECK_LIB([sframe], [sframe_decode], [BFD_LIBS="${BFD_LIBS} -lsframe"])
125 AC_CHECK_LIB([zstd], [ZSTD_isError], [BFD_LIBS="${BFD_LIBS} -lzstd"])
126 AC_SUBST([BFD_LIBS])
128 AC_CONFIG_FILES([
129     Makefile
130     cygwin/Makefile
131     cygserver/Makefile
132     doc/Makefile
133     utils/Makefile
134     utils/mingw/Makefile
135     testsuite/Makefile
136     testsuite/mingw/Makefile
139 AC_OUTPUT