source: trunk/third/cns/configure @ 8789

Revision 8789, 31.7 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r8788, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
4
5# Configuration script
6# Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
7
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
22# This file is based on one written by K. Richard Pixley.
23
24#
25# Shell script to create proper links to machine-dependent files in
26# preparation for compilation.
27#
28# If configure succeeds, it leaves its status in config.status.
29# If configure fails after disturbing the status quo,
30#       config.status is removed.
31#
32
33export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
34
35remove=rm
36hard_link=ln
37symbolic_link='ln -s'
38
39#for Test
40#remove="echo rm"
41#hard_link="echo ln"
42#symbolic_link="echo ln -s"
43
44# clear some things potentially inherited from environment.
45
46Makefile=Makefile
47Makefile_in=Makefile.in
48arguments=$*
49build_alias=
50configdirs=
51exec_prefix=
52exec_prefixoption=
53fatal=
54floating_point=default
55gas=default
56host_alias=NOHOST
57host_makefile_frag=
58moveifchange=
59norecursion=
60other_options=
61package_makefile_frag=
62prefix=/usr/kerberos
63progname=
64program_prefix=
65program_prefixoption=
66program_suffix=
67program_suffixoption=
68program_transform_name=
69program_transform_nameoption=
70redirect=">/dev/null"
71removing=
72site=
73site_makefile_frag=
74site_option=
75srcdir=
76srctrigger=
77subdirs=
78target_alias=NOTARGET
79target_makefile_frag=
80undefs=NOUNDEFS
81version="Kerberos configure"
82x11=default
83
84### we might need to use some other shell than /bin/sh for running subshells
85#
86config_shell=${CONFIG_SHELL-/bin/sh}
87
88NO_EDIT="This file was generated automatically by configure.  Do not edit."
89
90## this is a little touchy and won't always work, but...
91##
92## if the argv[0] starts with a slash then it is an absolute name that can (and
93## must) be used as is.
94##
95## otherwise, if argv[0] has no slash in it, we can assume that it is on the
96## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
97##
98
99progname=$0
100# if PWD already has a value, it is probably wrong.
101if [ -n "$PWD" ]; then PWD=`pwd`; fi
102
103case "${progname}" in
104/*) ;;
105*/*) ;;
106*)
107        PATH=$PATH:${PWD=`pwd`} ; export PATH
108        ;;
109esac
110
111# Loop over all args
112
113while :
114do
115
116# Break out if there are no more args
117        case $# in
118        0)
119                break
120                ;;
121        esac
122
123# Get the first arg, and shuffle
124        option=$1
125        shift
126
127# Make all options have two hyphens
128        orig_option=$option     # Save original for error messages
129        case $option in
130        --*) ;;
131        -*) option=-$option ;;
132        esac
133               
134# Split out the argument for options that take them
135        case $option in
136        --*=*)
137                optarg=`echo $option | sed -e 's/^[^=]*=//'`
138                ;;
139# These options have mandatory values.  Since we didn't find an = sign,
140# the value must be in the next argument
141        --b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
142                optarg=$1
143                shift
144                ;;
145        esac
146
147# Now, process the options
148        case $option in
149
150        --build* | --b*)
151                case "$build_alias" in
152                "") build_alias=$optarg ;;
153                *) echo '***' Can only configure for one build machine at a time.  1>&2
154                   fatal=yes
155                   ;;
156                esac
157                ;;
158# Accepted for compatibility with new autoconf; ignored.
159        --cache*)
160                ;;
161        --disable-*)
162                enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
163                eval $enableopt=no
164                disableoptions="$disableoptions $option"
165                ;;
166        --enable-*)
167                case "$option" in
168                *=*)    ;;
169                *)      optarg=yes ;;
170                esac
171
172                enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
173                eval $enableopt="$optarg"
174                enableoptions="$enableoptions $option"
175                ;;
176        --exec-prefix* | --ex*)
177                exec_prefix=$optarg
178                exec_prefixoption="--exec-prefix=$optarg"
179                ;;
180        --gas | --g*)
181                gas=yes
182                ;;
183        --help | --he*)
184                fatal=yes
185                ;;
186        --host* | --ho*)
187                case $host_alias in
188                NOHOST) host_alias=$optarg ;;
189                *) echo '***' Can only configure for one host at a time.  1>&2
190                   fatal=yes
191                   ;;
192                esac
193                ;;
194        --nfp | --nf*)
195                floating_point=no
196                ;;
197        --norecursion | --no*)
198                norecursion=yes
199                ;;
200        --prefix* | --pre*)
201                prefix=$optarg
202                prefixoption="--prefix=$optarg"
203                ;;
204        --program-prefix* | --program-p*)
205                program_prefix=$optarg
206                program_prefixoption="--program-prefix=$optarg"
207                ;;
208        --program-suffix* | --program-s*)
209                program_suffix=$optarg
210                program_suffixoption="--program-suffix=$optarg"
211                ;;
212        --program-transform-name* | --program-t*)
213                # Double any backslashes or dollar signs in the argument
214                program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
215                program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
216                ;;
217        --rm)
218                removing=--rm
219                ;;
220        --silent | --sil* | --quiet | --q*)
221                redirect=">/dev/null"
222                verbose=--silent
223                ;;
224        --site* | --sit*)
225                site=$optarg
226                site_option="--site=$optarg"
227                ;;
228        --srcdir*/ | --sr*/)
229                # Remove trailing slashes.  Otherwise, when the file name gets
230                # bolted into an object file as debug info, it has two slashes
231                # in it.  Ordinarily this is ok, but emacs takes double slash
232                # to mean "forget the first part".
233                srcdir=`echo $optarg | sed -e 's:/$::'`
234                ;;
235        --srcdir* | --sr*)
236                srcdir=$optarg
237                ;;
238        --target* | --ta*)
239                case $target_alias in
240                NOTARGET) target_alias=$optarg ;;
241                *) echo '***' Can only configure for one target at a time.  1>&2
242                   fatal=yes
243                   ;;
244                esac
245                ;;
246        --tmpdir* | --tm*)
247                TMPDIR=$optarg
248                tmpdiroption="--tmpdir=$optarg"
249                ;;
250        --verbose | --v | --verb*)
251                redirect=
252                verbose=--verbose
253                ;;
254        --version | --V | --vers*)
255                echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
256                exit 0
257                ;;
258        --with-*)
259                case "$option" in
260                *=*)    ;;
261                *)      optarg=yes ;;
262                esac
263
264                withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
265                eval $withopt="$optarg"
266                withoptions="$withoptions $option"
267                ;;
268        --without-*)
269                withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
270                eval $withopt=no
271                withoutoptions="$withoutoptions $option"
272                ;;
273        --x)    with_x=yes
274                withoptions="$withoptions --with-x"
275                ;;
276        --x-i* | --x-l*) other_options="$other_options $orig_option"
277                ;;
278        --*)
279                echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
280                exit 1
281                ;;
282        *)
283                case $undefs in
284                NOUNDEFS) undefs=$option ;;
285                *) echo '***' Can only configure for one host and one target at a time.  1>&2
286                   fatal=yes
287                   ;;
288                esac
289                ;;
290        esac
291done
292
293# process host and target
294
295# Do some error checking and defaulting for the host and target type.
296# The inputs are:
297#    configure --host=HOST --target=TARGET UNDEFS
298#
299# The rules are:
300# 1. You aren't allowed to specify --host, --target, and undefs at the
301#    same time.
302# 2. Host defaults to undefs.
303# 3. If undefs is not specified, then host defaults to the current host,
304#    as determined by config.guess.
305# 4. Target defaults to undefs.
306# 5. If undefs is not specified, then target defaults to host.
307
308case "${fatal}" in
309"")
310        # Make sure that host, target & undefs aren't all specified at the
311        # same time.
312        case $host_alias---$target_alias---$undefs in
313        NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
314                ;;
315        *) echo '***' Can only configure for one host and one target at a time.  1>&2
316           fatal=yes
317           break 2
318                ;;
319        esac
320
321        # Now, do defaulting for host.
322        case $host_alias in
323        NOHOST)
324                case $undefs in
325                NOUNDEFS)
326                        # Neither --host option nor undefs were present.
327                        # Call config.guess.
328                        guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
329                        if host_alias=`${guesssys}`
330                        then
331                                # If the string we are going to use for
332                                # the target is a prefix of the string
333                                # we just guessed for the host, then
334                                # assume we are running native, and force
335                                # the same string for both target and host.
336                                case $target_alias in
337                                NOTARGET) ;;
338                                *)
339                                        if expr $host_alias : $target_alias >/dev/null
340                                        then
341                                                host_alias=$target_alias
342                                        fi
343                                        ;;
344                                esac
345                                echo "Configuring for a ${host_alias} host." 1>&2
346                                arguments="--host=$host_alias $arguments"
347                        else
348                                echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
349                                fatal=yes
350                        fi
351                        ;;
352                *)
353                        host_alias=$undefs
354                        ;;
355                esac
356        esac
357
358        # Do defaulting for target.  If --target option isn't present, default
359        # to undefs.  If undefs isn't present, default to host.
360        case $target_alias in
361        NOTARGET)
362                case $undefs in
363                NOUNDEFS)
364                        target_alias=$host_alias
365                        ;;
366                *)
367                        target_alias=$undefs
368                        ;;
369                esac
370        esac
371        ;;
372*) ;;
373esac
374
375if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
376        exec 1>&2
377        echo Usage: configure [OPTIONS] [HOST]
378        echo
379        echo Options: [defaults in brackets]
380        echo ' --prefix=MYDIR            install into MYDIR [/usr/kerberos]'
381        echo ' --exec-prefix=MYDIR       install host-dependent files into MYDIR [/usr/kerberos]'
382        echo ' --help                    print this message [normal config]'
383        echo ' --build=BUILD             configure for building on BUILD [BUILD=HOST]'
384        echo ' --host=HOST               configure for HOST [determined via config.guess]'
385        echo ' --norecursion             configure this directory only [recurse]'
386        echo ' --program-prefix=FOO      prepend FOO to installed program names [""]'
387        echo ' --program-suffix=FOO      append FOO to installed program names [""]'
388        echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
389        echo ' --site=SITE               configure with site-specific makefile for SITE'
390        echo ' --srcdir=DIR              find the sources in DIR [. or ..]'
391        echo ' --target=TARGET   configure for TARGET [TARGET=HOST]'
392        echo ' --tmpdir=TMPDIR   create temporary files in TMPDIR [/tmp]'
393        echo ' --nfp                     configure for software floating point [hard float]'
394        echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
395        echo ' --without-FOO             package FOO is NOT available'
396        echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
397        echo ' --disable-FOO             do not include feature FOO'
398        echo
399        echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
400        echo
401        if [ -r config.status ] ; then
402                cat config.status
403        fi
404
405        exit 1
406fi
407
408configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
409moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
410
411# this is a hack.  sun4 must always be a valid host alias or this will fail.
412if ${configsub} sun4 >/dev/null 2>&1 ; then
413        true
414else
415        echo '***' cannot find config.sub.  1>&2
416        exit 1
417fi
418
419touch config.junk
420if ${moveifchange} config.junk config.trash ; then
421        true
422else
423        echo '***' cannot find move-if-change.  1>&2
424        exit 1
425fi
426rm -f config.junk config.trash
427
428case "${srcdir}" in
429"")
430        if [ -r configure.in ] ; then
431                srcdir=.
432        else
433                if [ -r ${progname}.in ] ; then
434                        srcdir=`echo ${progname} | sed 's:/configure$::'`
435                else
436                        echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
437                        exit 1
438                fi
439        fi
440        ;;
441*) ;;
442esac
443
444### warn about some conflicting configurations.
445
446case "${srcdir}" in
447".") ;;
448*)
449        if [ -f ${srcdir}/config.status ] ; then
450                echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
451                exit 1
452        fi
453esac
454
455# default exec_prefix
456case "${exec_prefixoption}" in
457"") exec_prefix="\$(prefix)" ;;
458*) ;;
459esac
460
461### break up ${srcdir}/configure.in.
462case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
463"")
464        echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
465        exit 1
466        ;;
467*) ;;
468esac
469
470case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
471"")
472        echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
473        exit 1
474        ;;
475*) ;;
476esac
477
478case "${TMPDIR}" in
479"") TMPDIR=/tmp ; export TMPDIR ;;
480*) ;;
481esac
482
483# keep this filename short for &%*%$*# 14 char file names
484tmpfile=${TMPDIR}/cONf$$
485# Note that under many versions of sh a trap handler for 0 will *override* any
486# exit status you explicitly specify!  At this point, the only non-error exit
487# is at the end of the script; these actions are duplicated there, minus
488# the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
489# trap handler, or you'll lose.
490trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
491
492# split ${srcdir}/configure.in into common, per-host, per-target,
493# and post-target parts.  Post-target is optional.
494sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
495sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
496if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
497  sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
498  sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
499else
500  sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
501  echo >${tmpfile}.pos
502fi
503
504### do common part of configure.in
505
506. ${tmpfile}.com
507
508# some sanity checks on configure.in
509case "${srctrigger}" in
510"")
511        echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
512        exit 1
513        ;;
514*) ;;
515esac
516
517case "${build_alias}" in
518"")     ;;
519*)
520        if result=`${config_shell} ${configsub} ${build_alias}` ; then
521            buildopt="--build=${build_alias}"
522            build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
523            build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
524            build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
525            build=${build_cpu}-${build_vendor}-${build_os}
526        else
527            echo "Unrecognized build system name ${build_alias}." 1>&2
528            exit 1
529        fi
530        ;;
531esac
532
533if result=`${config_shell} ${configsub} ${host_alias}` ; then
534    true
535else
536    echo "Unrecognized host system name ${host_alias}." 1>&2
537    exit 1
538fi
539host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
540host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
541host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
542host=${host_cpu}-${host_vendor}-${host_os}
543
544. ${tmpfile}.hst
545
546if result=`${config_shell} ${configsub} ${target_alias}` ; then
547    true
548else
549    echo "Unrecognized target system name ${target_alias}." 1>&2
550    exit 1
551fi
552target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
553target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
554target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
555target=${target_cpu}-${target_vendor}-${target_os}
556
557. ${tmpfile}.tgt
558
559# Find the source files, if location was not specified.
560case "${srcdir}" in
561"")
562        srcdirdefaulted=1
563        srcdir=.
564        if [ ! -r ${srctrigger} ] ; then
565                srcdir=..
566        fi
567        ;;
568*) ;;
569esac
570
571if [ ! -r ${srcdir}/${srctrigger} ] ; then
572        case "${srcdirdefaulted}" in
573        "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
574        *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
575        esac
576
577        echo '***' \(At least ${srctrigger} is missing.\) 1>&2
578        exit 1
579fi
580
581# Some systems (e.g., one of the i386-aix systems the gas testers are
582# using) don't handle "\$" correctly, so don't use it here.
583tooldir='$(exec_prefix)'/${target_alias}
584
585if [ "${host_alias}" != "${target_alias}" ] ; then
586    if [ "${program_prefixoption}" = "" ] ; then
587        if [ "${program_suffixoption}" = "" ] ; then
588            if [ "${program_transform_nameoption}" = "" ] ; then
589                program_prefix=${target_alias}- ;
590            fi
591        fi
592    fi
593fi
594
595# Merge program_prefix and program_suffix onto program_transform_name
596# Use a double $ so that make ignores it
597if [ "${program_suffix}" != "" ] ; then
598    program_transform_name="-e s,\$\$,${program_suffix}, ${program_transform_name}"
599fi
600
601if [ "${program_prefix}" != "" ] ; then
602    program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
603fi
604
605for subdir in . ${subdirs} ; do
606
607    # ${subdir} is relative path from . to the directory we're currently
608    # configuring.
609    # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
610    invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
611
612    ### figure out what to do with srcdir
613    case "${srcdir}" in
614        ".")  # no -srcdir option.  We're building in place.
615                makesrcdir=. ;;
616        /*) # absolute path
617                makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
618                ;;
619        *) # otherwise relative
620                case "${subdir}" in
621                .) makesrcdir=${srcdir} ;;
622                *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
623                esac
624                ;;
625    esac
626
627    if [ "${subdir}/" != "./" ] ; then
628        Makefile=${subdir}/Makefile
629    fi
630
631    if [ ! -d ${subdir} ] ; then
632        if mkdir ${subdir} ; then
633                true
634        else
635                echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
636                exit 1
637        fi
638    fi
639
640    case "${removing}" in
641    "")
642        case "${subdir}" in
643        .) ;;
644        *) eval echo Building in ${subdir} ${redirect} ;;
645        esac
646
647        # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
648        # Set up the list of links to be made.
649        # ${links} is the list of link names, and ${files} is the list of names to link to.
650
651        # Make the links.
652        configlinks="${links}"
653        if [ -r ${subdir}/config.status ] ; then
654                mv -f ${subdir}/config.status ${subdir}/config.back
655        fi
656        while [ -n "${files}" ] ; do
657                # set file to car of files, files to cdr of files
658                set ${files}; file=$1; shift; files=$*
659                set ${links}; link=$1; shift; links=$*
660
661                if [ ! -r ${srcdir}/${file} ] ; then
662                        echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
663                        echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
664                        exit 1
665                fi
666
667                ${remove} -f ${link}
668                # Make a symlink if possible, otherwise try a hard link
669                if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
670                        true
671                else
672                        # We need to re-remove the file because Lynx leaves a
673                        # very strange directory there when it fails an NFS symlink.
674                        ${remove} -r -f ${link}
675                        ${hard_link} ${srcdir}/${file} ${link}
676                fi
677                if [ ! -r ${link} ] ; then
678                        echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
679                        exit 1
680                fi
681
682                echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
683        done
684
685        # Create a .gdbinit file which runs the one in srcdir
686        # and tells GDB to look there for source files.
687
688        if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
689                case ${srcdir} in
690                .) ;;
691                *) cat > ${subdir}/.gdbinit <<EOF
692# ${NO_EDIT}
693dir ${makesrcdir}
694dir .
695source ${makesrcdir}/.gdbinit
696EOF
697                        ;;
698                esac
699        fi
700
701        # Install a makefile, and make it set VPATH
702        # if necessary so that the sources are found.
703        # Also change its value of srcdir.
704        # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
705        # been somewhat optimized and is perhaps a bit twisty.
706
707        # code is order so as to try to sed the smallest input files we know.
708
709        # the four makefile fragments MUST end up in the resulting Makefile in this order:
710        # package, target, host, and site.  so do these separately because I don't trust the
711        #  order of sed -e expressions.
712
713        if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
714
715            # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
716            rm -f ${subdir}/Makefile.tem
717              case "${site}" in
718              "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
719              *)
720                      site_makefile_frag=${srcdir}/config/ms-${site}
721
722                      if [ -f ${site_makefile_frag} ] ; then
723                              sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
724                                      > ${subdir}/Makefile.tem
725                      else
726                              cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
727                              site_makefile_frag=
728                      fi
729                      ;;
730            esac
731            # working copy now in ${subdir}/Makefile.tem
732
733            # Conditionalize the makefile for this host.
734            rm -f ${Makefile}
735            case "${host_makefile_frag}" in
736              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
737              *)
738                      if [ ! -f ${host_makefile_frag} ] ; then
739                              host_makefile_frag=${srcdir}/${host_makefile_frag}
740                      fi
741                      if [ -f ${host_makefile_frag} ] ; then
742                              sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
743                      else
744                              echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
745                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
746                              mv ${subdir}/Makefile.tem ${Makefile}
747                      fi
748            esac
749            # working copy now in ${Makefile}
750
751            # Conditionalize the makefile for this target.
752            rm -f ${subdir}/Makefile.tem
753            case "${target_makefile_frag}" in
754              "") mv ${Makefile} ${subdir}/Makefile.tem ;;
755              *)
756                      if [ ! -f ${target_makefile_frag} ] ; then
757                              target_makefile_frag=${srcdir}/${target_makefile_frag}
758                      fi
759                      if [ -f ${target_makefile_frag} ] ; then
760                              sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
761                      else
762                              mv ${Makefile} ${subdir}/Makefile.tem
763                              target_makefile_frag=
764                      fi
765                      ;;
766            esac
767            # real copy now in ${subdir}/Makefile.tem
768
769            # Conditionalize the makefile for this package.
770            rm -f ${Makefile}
771            case "${package_makefile_frag}" in
772              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
773              *)
774                      if [ ! -f ${package_makefile_frag} ] ; then
775                              package_makefile_frag=${srcdir}/${package_makefile_frag}
776                      fi
777                      if [ -f ${package_makefile_frag} ] ; then
778                              sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
779                              rm -f ${subdir}/Makefile.tem
780                      else
781                              echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
782                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
783                              mv ${subdir}/Makefile.tem ${Makefile}
784                      fi
785            esac
786            # working copy now in ${Makefile}
787
788            mv ${Makefile} ${subdir}/Makefile.tem
789
790            # real copy now in ${subdir}/Makefile.tem
791
792            # prepend warning about editting, and a bunch of variables.
793            rm -f ${Makefile}
794            cat > ${Makefile} <<EOF
795# ${NO_EDIT}
796VPATH = ${makesrcdir}
797links = ${configlinks}
798host_alias = ${host_alias}
799host_cpu = ${host_cpu}
800host_vendor = ${host_vendor}
801host_os = ${host_os}
802host_canonical = ${host_cpu}-${host_vendor}-${host_os}
803target_alias = ${target_alias}
804target_cpu = ${target_cpu}
805target_vendor = ${target_vendor}
806target_os = ${target_os}
807target_canonical = ${target_cpu}-${target_vendor}-${target_os}
808EOF
809            case "${build}" in
810              "") ;;
811              *)  cat >> ${Makefile} << EOF
812build_alias = ${build_alias}
813build_cpu = ${build_cpu}
814build_vendor = ${build_vendor}
815build_os = ${build_os}
816build_canonical = ${build_cpu}-${build_vendor}-${build_os}
817EOF
818            esac
819
820            case "${package_makefile_frag}" in
821              "") ;;
822              /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
823              *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
824            esac
825
826            case "${target_makefile_frag}" in
827              "") ;;
828              /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
829              *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
830            esac
831
832            case "${host_makefile_frag}" in
833              "") ;;
834              /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
835              *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
836            esac
837
838            if [ "${site_makefile_frag}" != "" ] ; then
839                echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
840            fi
841
842            # make sure that some sort of reasonable default exists for these
843            # two variables
844            CXX=${CXX-"g++ -O"}
845            CC=${CC-cc}
846
847            # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
848            # remove any form feeds.
849            if [ -z "${subdirs}" ]; then
850                rm -f ${subdir}/Makefile.tem2
851                sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
852                    -e "s:^NONSUBDIRS[  ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
853                    ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
854                rm -f ${subdir}/Makefile.tem
855                mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
856            fi
857            sed -e "s:^prefix[  ]*=.*$:prefix = ${prefix}:" \
858                    -e "s:^exec_prefix[         ]*=.*$:exec_prefix = ${exec_prefix}:" \
859                    -e "s:^SHELL[        ]*=.*$:SHELL = ${config_shell}:" \
860                    -e "s:^srcdir[      ]*=.*$:srcdir = ${makesrcdir}:" \
861                    -e "s///" \
862                    -e "s:^program_prefix[      ]*=.*$:program_prefix = ${program_prefix}:" \
863                    -e "s:^program_suffix[      ]*=.*$:program_suffix = ${program_suffix}:" \
864                    -e "s:^program_transform_name[      ]*=.*$:program_transform_name = ${program_transform_name}:" \
865                    -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
866                    ${subdir}/Makefile.tem >> ${Makefile}
867            # final copy now in ${Makefile}
868
869        else
870           echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
871        fi
872
873        rm -f ${subdir}/Makefile.tem
874
875        case "${host_makefile_frag}" in
876        "") using= ;;
877        *) using="and \"${host_makefile_frag}\"" ;;
878        esac
879
880        case "${target_makefile_frag}" in
881        "") ;;
882        *) using="${using} and \"${target_makefile_frag}\"" ;;
883        esac
884
885        case "${site_makefile_frag}" in
886        "") ;;
887        *) using="${using} and \"${site_makefile_frag}\"" ;;
888        esac
889
890        newusing=`echo "${using}" | sed 's/and/using/'`
891        using=${newusing}
892        echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
893
894        . ${tmpfile}.pos
895
896        # describe the chosen configuration in config.status.
897        # Make that file a shellscript which will reestablish
898        # the same configuration.  Used in Makefiles to rebuild
899        # Makefiles.
900
901        case "${norecursion}" in
902        "") arguments="${arguments} --norecursion" ;;
903        *) ;;
904        esac
905
906        if [ ${subdir} = . ] ; then
907            echo "#!/bin/sh
908# ${NO_EDIT}
909# This directory was configured as follows:
910${progname}" ${arguments}  "
911# ${using}" > ${subdir}/config.new
912        else
913            echo "#!/bin/sh
914# ${NO_EDIT}
915# This directory was configured as follows:
916cd ${invsubdir}
917${progname}" ${arguments}  "
918# ${using}" > ${subdir}/config.new
919        fi
920        chmod a+x ${subdir}/config.new
921        if [ -r ${subdir}/config.back ] ; then
922                mv -f ${subdir}/config.back ${subdir}/config.status
923        fi
924        ${moveifchange} ${subdir}/config.new ${subdir}/config.status
925        ;;
926
927    *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
928    esac
929done
930
931# If there are subdirectories, then recur.
932if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
933        for configdir in ${configdirs} ; do
934
935                if [ -d ${srcdir}/${configdir} ] ; then
936                        eval echo Configuring ${configdir}... ${redirect}
937                        case "${srcdir}" in
938                        ".") ;;
939                        *)
940                                if [ ! -d ./${configdir} ] ; then
941                                        if mkdir ./${configdir} ; then
942                                                true
943                                        else
944                                                echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
945                                                exit 1
946                                        fi
947                                fi
948                                ;;
949                        esac
950
951                        POPDIR=${PWD=`pwd`}
952                        cd ${configdir}
953
954### figure out what to do with srcdir
955                        case "${srcdir}" in
956                        ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
957                        /*) # absolute path
958                                newsrcdir=${srcdir}/${configdir}
959                                srcdiroption="--srcdir=${newsrcdir}"
960                                ;;
961                        *) # otherwise relative
962                                newsrcdir=../${srcdir}/${configdir}
963                                srcdiroption="--srcdir=${newsrcdir}"
964                                ;;
965                        esac
966
967### check for guested configure, otherwise fix possibly relative progname
968                        if [ -f ${newsrcdir}/configure ] ; then
969                                recprog=${newsrcdir}/configure
970                        elif [ -f ${newsrcdir}/configure.in ] ; then
971                                case "${progname}" in
972                                /*)     recprog=${progname} ;;
973                                *)      recprog=../${progname} ;;
974                                esac
975                        else
976                                eval echo No configuration information in ${configdir} ${redirect}
977                                recprog=
978                        fi
979
980### The recursion line is here.
981                        if [ ! -z "${recprog}" ] ; then
982                                if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
983                                        ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
984                                        ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
985                                        true
986                                else
987                                        echo Configure in `pwd` failed, exiting. 1>&2
988                                        exit 1
989                                fi
990                        fi
991
992                        cd ${POPDIR}
993                fi
994        done
995fi
996
997# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
998# and reset the trap handler.
999rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
1000trap 0
1001
1002exit 0
1003
1004#
1005# Local Variables:
1006# fill-column: 131
1007# End:
1008#
1009
1010# end of configure
Note: See TracBrowser for help on using the repository browser.