1# This file is a shell script fragment that supplies the information
2# necessary for a configure script to process the program in
3# this directory.  For more information, look at ../configure.
4
5# If the language specific compiler does not exist, but the "gcc" directory 
6# does, we do not build anything. Note, $r is set by the top-level Makefile.
7# Note that when we look for the compiler, we search both with and without
8# extension to handle cross and canadian cross builds. 
9# Note that if $norecursion is set we're being called from config.status,
10# so don't check for the compiler; we might be doing a make clean.
11compiler_name=cc1plus
12rm -f skip-this-dir
13if test -n "$r" && [ -z "$norecursion" ] ; then
14  if test -d "$r"/gcc; then
15    if test -f "$r"/gcc/$compiler_name \
16       || test -f "$r"/gcc/$compiler_name.exe; then
17      true
18    else
19      echo "rm -f multilib.out" > skip-this-dir
20    fi
21  fi
22fi
23
24if [ "${srcdir}" = "." ] ; then
25  if [ "${with_target_subdir}" != "." ] ; then
26    topsrcdir=${with_multisrctop}../..
27  else
28    topsrcdir=${with_multisrctop}..
29  fi
30else
31  topsrcdir=${srcdir}/..
32fi
33
34if [ -d ${topsrcdir}/gcc ] ; then
35  configdirs="tests dbz stdio testsuite"
36else
37  configdirs="tests dbz stdio"
38fi
39srctrigger=libioP.h
40srcname="input/output library"
41package_makefile_frag=Make.pack
42package_makefile_rules_frag=Make.pack.r
43
44# per-host:
45
46# per-target:
47
48echo "# Warning: this fragment is automatically generated" > temp.mt
49frags=
50
51case "${target}" in
52  *-hpux*)       frags=hpux.mt ;;
53  alpha*-*-linux-gnulibc1)
54		 frags="linux.mt linuxaxp1.mt mtsafe.mt" ;;
55  powerpc*-*-linux-gnulibc1)
56		 frags="linux.mt linuxaxp1.mt mtsafe.mt" ;;
57  *-linux-gnulibc1)
58		 frags=linuxlibc1.mt ;;
59  *-linux-gnu)   frags="linux.mt mtsafe.mt" ;;
60  *-sco3.2v[45]*)   frags=sco4.mt ;;
61  *-isc*)        frags=isc.mt ;;
62  *-netware*)    frags=netware.mt ;;
63  *-beos*)	 frags="beos.mt mtsafe.mt" ;;
64  *-haiku*)	 frags="haiku.mt mtsafe.mt" ;;
65  *)             frags=${target_cpu}.mt ;;
66esac
67
68case "${enable_shared}" in
69  yes) shared=yes ;;
70  no) shared=no ;;
71  *libio*) shared=yes ;;
72  *) shared=no ;;
73esac
74
75if [ "${shared}" = "yes" ]; then
76  case "${target}" in
77    alpha*-*-linux*)	frags="${frags} ../../config/mh-elfalphapic" ;;
78    arm*-*-*)		frags="${frags} ../../config/mh-armpic" ;;
79    hppa*-*-*)		frags="${frags} ../../config/mh-papic" ;;
80    i[3456]86-*-*)	frags="${frags} ../../config/mh-x86pic" ;;
81    powerpc*-*-aix*)	;;
82    powerpc*-*-*)	frags="${frags} ../../config/mh-ppcpic" ;;
83    *-*-*)		frags="${frags} ../../config/mh-${target_cpu}pic" ;;
84  esac
85fi
86
87# Take care of header file lossage.
88case "${target}" in
89  alpha*-*-linux-gnulibc1)
90    # For some reason stdio-lock.h is not installed on Red Hat systems.
91    # Further, libc-lock.h needs to define the pthreads stuff weak, and
92    # fails to do this for other than _LIBC.  Install our own versions
93    # of these files.
94    cp ${srcdir}/config/linuxaxp1-libc-lock.h libc-lock.h
95    cp ${srcdir}/config/linuxaxp1-stdio-lock.h stdio-lock.h
96    ;;
97  powerpc*-*-linux-gnulibc1)
98    # For some reason stdio-lock.h is not installed on Red Hat systems.
99    # Further, libc-lock.h needs to define the pthreads stuff weak, and
100    # fails to do this for other than _LIBC.  Install our own versions
101    # of these files.
102    cp ${srcdir}/config/linuxaxp1-libc-lock.h libc-lock.h
103    cp ${srcdir}/config/linuxaxp1-stdio-lock.h stdio-lock.h
104    ;;
105  *-linux-gnu)
106    # We have a correct libc-lock.h in glibc 2.1 but not all glibc 2.0.
107    # Create a wrapper if necessary.
108    (echo "#include <bits/libc-lock.h>" | ${CC-cc} -E -) >/dev/null 2>&1 ||
109      {
110	echo "#include_next <libc-lock.h>" > libc-lock.h
111	echo 'asm (".weak _pthread_cleanup_pop_restore");' >> libc-lock.h
112	echo 'asm (".weak _pthread_cleanup_push_defer");' >> libc-lock.h
113
114      }
115    ;;
116esac
117
118for frag in ${frags}; do
119  case ${frag} in
120    ../* )
121      if [ ${srcdir} = . ]; then
122	[ -n "${with_target_subdir}" ] && frag=../${frag}
123	[ -n "${with_multisrctop}" ] && frag=${with_multisrctop}${frag}
124      fi
125      ;;
126  esac
127  frag=${srcdir}/config/$frag
128  if [ -f ${frag} ]; then
129    echo "Appending ${frag} to target-mkfrag"
130    echo "# Following fragment copied from ${frag}" >> temp.mt
131    cat ${frag} >> temp.mt
132  fi
133done
134
135target_makefile_frag=target-mkfrag
136${moveifchange} temp.mt target-mkfrag
137
138LIBDIR=yes
139TO_TOPDIR=../
140ALL='$(_G_CONFIG_H) libio.a libiostream.a iostream.list'
141case "${target}" in
142  *-*-cygwin*)
143    XCINCLUDES='-I. -I$(srcdir) -I$(srcdir)/../winsup/include'
144    XCXXINCLUDES='-I. -I$(srcdir) -I$(srcdir)/../winsup/include'
145    ;;
146  *)
147    XCINCLUDES='-I. -I$(srcdir)'
148    XCXXINCLUDES='-I. -I$(srcdir)'
149    ;;
150esac
151MOSTLYCLEAN='*.o pic stamp-picdir core iostream.list'
152DISTCLEAN='config.status Makefile *~ Make.pack target-mkfrag multilib.out'
153CLEAN='_G_config.h *.a'
154INFO_FILES=iostream
155if [ -n "${with_cross_host}" -a -d ${topsrcdir}/gcc ]; then
156    CHECK_SUBDIRS=testsuite
157fi
158(. ${srcdir}/config.shared) >${package_makefile_frag} 2>${package_makefile_rules_frag}
159
160# post-target:
161
162# If cross-compiling, we install in $(tooldir)/lib or in $(libsubdir)
163# depending on --enable-version-specific-runtime-libs.
164if [ -n "${with_cross_host}" ] ; then
165    rm -f Makefile.tem
166    sed \
167        -e 's|\(^[ 	]*INSTALLDIR[ 	]*=[ 	]*\)\$(libdir)|\1$(tooldir)/lib|' \
168	Makefile >Makefile.tem
169    mv -f Makefile.tem Makefile
170fi
171
172. ${topsrcdir}/config-ml.in
173
174gxx_include_dir=
175# Specify the g++ header file directory
176# Check whether --with-gxx-include-dir or --without-gxx-include-dir was given.
177if test "${with_gxx_include_dir+set}" = set; then
178  withval="$with_gxx_include_dir"
179  case "${withval}" in
180    yes)
181      echo "configure.in: error: bad value ${withval} given for g++ include directory" 1>&2
182      exit 1
183      ;;
184    no)	;;
185    *)	gxx_include_dir=$with_gxx_include_dir ;;
186  esac
187fi
188
189if test x${gxx_include_dir} = x; then
190  if test x${enable_version_specific_runtime_libs} = xyes; then
191    gxx_include_dir='${libsubdir}/include/g++'
192  else
193    . ${topsrcdir}/config.if
194    gxx_include_dir='${prefix}/include/g++'
195  fi
196fi
197
198rm -f Makefile.tem
199sed -e "s%^gxx_include_dir[ 	]*=.*$%gxx_include_dir=${gxx_include_dir}%" \
200       Makefile >Makefile.tem
201mv -f Makefile.tem Makefile
202