OSDN Git Service

* Makefile.common: Change method for finding current directory.
[pf3gnuchains/pf3gnuchains3x.git] / winsup / configure.in
1 dnl Autoconf configure script for Cygwin.
2 dnl Copyright 1996, 1997, 1998, 1999, 2000 Red Hat, Inc.
3 dnl
4 dnl This file is part of Cygwin.
5 dnl
6 dnl This software is a copyrighted work licensed under the terms of the
7 dnl Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
8 dnl details.
9 dnl
10 dnl Process this file with autoconf to produce a configure script.
11
12 AC_PREREQ(2.12)dnl
13 AC_INIT(Makefile.in)
14
15 dnl FIXME: We temporarily define our own version of AC_PROG_CC.  This is
16 dnl copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
17 dnl are probably using a cross compiler, which will not be able to fully
18 dnl link an executable.  This should really be fixed in autoconf
19 dnl itself.
20
21 AC_DEFUN(LIB_AC_PROG_CC,
22 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
23 AC_CHECK_TOOL(CC, gcc, gcc)
24 if test -z "$CC"; then
25   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
26   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
27 fi
28
29 AC_PROG_CC_GNU
30
31 if test $ac_cv_prog_gcc = yes; then
32   GCC=yes
33 dnl Check whether -g works, even if CFLAGS is set, in case the package
34 dnl plays around with CFLAGS (such as to build both debugging and
35 dnl normal versions of a library), tasteless as that idea is.
36   ac_test_CFLAGS="${CFLAGS+set}"
37   ac_save_CFLAGS="$CFLAGS"
38   CFLAGS=
39   AC_PROG_CC_G
40   if test "$ac_test_CFLAGS" = set; then
41     CFLAGS="$ac_save_CFLAGS"
42   elif test $ac_cv_prog_cc_g = yes; then
43     CFLAGS="-g -O2"
44   else
45     CFLAGS="-O2"
46   fi
47 else
48   GCC=
49   test "${CFLAGS+set}" = set || CFLAGS="-g"
50 fi
51 ])
52
53 AC_DEFUN(LIB_AC_PROG_CXX,
54 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
55 AC_CHECK_TOOL(CXX, g++, g++)
56 if test -z "$CXX"; then
57   AC_CHECK_PROG(CXX, c++, c++, , , )
58   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
59 fi
60
61 CXXFLAGS='$(CFLAGS)'
62 ])
63
64 AC_CANONICAL_SYSTEM
65
66 LIB_AC_PROG_CC
67 LIB_AC_PROG_CXX
68
69 SUBDIRS='w32api cygwin mingw'
70 case "$with_cross_host" in
71   ""|*cygwin*)
72     test -d $srcdir/bz2lib && SUBDIRS="$SUBDIRS bz2lib"
73     test -d $srcdir/cinstall && SUBDIRS="$SUBDIRS cinstall"
74     test -d $srcdir/subauth && SUBDIRS="$SUBDIRS subauth"
75     SUBDIRS="$SUBDIRS utils doc testsuite"
76     ;;
77 esac
78
79 AC_CONFIG_SUBDIRS($SUBDIRS)
80
81 AC_PROG_MAKE_SET
82
83 AC_SUBST(SUBDIRS)
84 AC_OUTPUT(Makefile)