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