A C standard library for sh3eb-elf.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1596 lines
48KB

  1. #!/bin/sh
  2. ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
  3. # Configuration script
  4. # Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
  5. # Free Software Foundation, Inc.
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. # This file was originally written by K. Richard Pixley.
  20. #
  21. # Shell script to create proper links to machine-dependent files in
  22. # preparation for compilation.
  23. #
  24. # If configure succeeds, it leaves its status in config.status.
  25. # If configure fails after disturbing the status quo,
  26. # config.status is removed.
  27. #
  28. export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
  29. remove=rm
  30. hard_link=ln
  31. symbolic_link='ln -s'
  32. #for Test
  33. #remove="echo rm"
  34. #hard_link="echo ln"
  35. #symbolic_link="echo ln -s"
  36. # clear some things potentially inherited from environment.
  37. Makefile=Makefile
  38. Makefile_in=Makefile.in
  39. arguments=
  40. build_alias=
  41. cache_file=config.cache
  42. cache_file_option=
  43. configdirs=
  44. extraconfigdirs=
  45. diroptions=
  46. exec_prefix=
  47. exec_prefixoption=
  48. fatal=
  49. floating_point=default
  50. gas=default
  51. gcc_version=
  52. gcc_version_trigger=
  53. host_alias=NOHOST
  54. host_makefile_frag=
  55. moveifchange=
  56. norecursion=
  57. other_options=
  58. package_makefile_frag=
  59. package_makefile_rules_frag=
  60. prefix=/usr/local
  61. progname=
  62. program_prefix=
  63. program_prefixoption=
  64. program_suffix=
  65. program_suffixoption=
  66. program_transform_name=
  67. program_transform_nameoption=
  68. redirect=
  69. removing=
  70. site=
  71. site_makefile_frag=
  72. site_option=
  73. srcdir=
  74. srctrigger=
  75. subdirs=
  76. target_alias=NOTARGET
  77. target_makefile_frag=
  78. undefs=NOUNDEFS
  79. version="$Revision$"
  80. x11=default
  81. bindir='${exec_prefix}/bin'
  82. sbindir='${exec_prefix}/sbin'
  83. libexecdir='${exec_prefix}/libexec'
  84. datadir='${prefix}/share'
  85. sysconfdir='${prefix}/etc'
  86. sharedstatedir='${prefix}/com'
  87. localstatedir='${prefix}/var'
  88. libdir='${exec_prefix}/lib'
  89. includedir='${prefix}/include'
  90. oldincludedir='/usr/include'
  91. infodir='${prefix}/info'
  92. mandir='${prefix}/man'
  93. ### we might need to use some other shell than /bin/sh for running subshells
  94. ### If we are on Windows, search for the shell. This will permit people
  95. ### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
  96. ### without also having to set CONFIG_SHELL. This code will work when
  97. ### using bash, which sets OSTYPE.
  98. case "${OSTYPE}" in
  99. *win32*)
  100. if [ x${CONFIG_SHELL} = x ]; then
  101. if [ ! -f /bin/sh ]; then
  102. if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
  103. CONFIG_SHELL=${SHELL}
  104. export CONFIG_SHELL
  105. else
  106. for prog in sh sh.exe bash bash.exe; do
  107. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
  108. for dir in $PATH; do
  109. test -z "$dir" && dir=.
  110. if test -f $dir/$prog; then
  111. CONFIG_SHELL=$dir/$prog
  112. export CONFIG_SHELL
  113. break
  114. fi
  115. done
  116. IFS="$save_ifs"
  117. test -n "${CONFIG_SHELL}" && break
  118. done
  119. fi
  120. fi
  121. fi
  122. ;;
  123. esac
  124. config_shell=${CONFIG_SHELL-/bin/sh}
  125. NO_EDIT="This file was generated automatically by configure. Do not edit."
  126. ## this is a little touchy and won't always work, but...
  127. ##
  128. ## if the argv[0] starts with a slash then it is an absolute name that can (and
  129. ## must) be used as is.
  130. ##
  131. ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
  132. ## path. Since PATH might include "." we also add `pwd` to the end of PATH.
  133. ##
  134. progname=$0
  135. # if PWD already has a value, it is probably wrong.
  136. if [ -n "$PWD" ]; then PWD=`pwd`; fi
  137. case "${progname}" in
  138. /*) ;;
  139. */*) ;;
  140. *)
  141. PATH=$PATH:${PWD=`pwd`} ; export PATH
  142. ;;
  143. esac
  144. # Loop over all args
  145. while :
  146. do
  147. # Break out if there are no more args
  148. case $# in
  149. 0)
  150. break
  151. ;;
  152. esac
  153. # Get the first arg, and shuffle
  154. option=$1
  155. shift
  156. # Make all options have two hyphens
  157. orig_option=$option # Save original for error messages
  158. case $option in
  159. --*) ;;
  160. -*) option=-$option ;;
  161. esac
  162. # Split out the argument for options that take them
  163. case $option in
  164. --*=*)
  165. optarg=`echo $option | sed -e 's/^[^=]*=//'`
  166. arguments="$arguments $option"
  167. ;;
  168. # These options have mandatory values. Since we didn't find an = sign,
  169. # the value must be in the next argument
  170. --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
  171. optarg=$1
  172. shift
  173. arguments="$arguments $option=$optarg"
  174. ;;
  175. --v)
  176. arguments="$arguments -v"
  177. ;;
  178. --*)
  179. arguments="$arguments $option"
  180. ;;
  181. esac
  182. # Now, process the options
  183. case $option in
  184. --bi*)
  185. bindir=$optarg
  186. diroptions="$diroptions --bindir=$optarg"
  187. ;;
  188. --build* | --bu*)
  189. case "$build_alias" in
  190. "") build_alias=$optarg ;;
  191. *) echo '***' Can only configure for one build machine at a time. 1>&2
  192. fatal=yes
  193. ;;
  194. esac
  195. ;;
  196. --cache*)
  197. cache_file=$optarg
  198. ;;
  199. --da*)
  200. datadir=$optarg
  201. diroptions="$diroptions --datadir=$optarg"
  202. ;;
  203. --disable-*)
  204. enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  205. eval $enableopt=no
  206. disableoptions="$disableoptions $option"
  207. ;;
  208. --enable-*)
  209. case "$option" in
  210. *=*) ;;
  211. *) optarg=yes ;;
  212. esac
  213. enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  214. eval "$enableopt='$optarg'"
  215. enableoptions="$enableoptions '$option'"
  216. ;;
  217. --exec-prefix* | --ex*)
  218. exec_prefix=$optarg
  219. exec_prefixoption="--exec-prefix=$optarg"
  220. ;;
  221. --gas | --g*)
  222. gas=yes
  223. ;;
  224. --help | --he*)
  225. fatal=yes
  226. ;;
  227. --host* | --ho*)
  228. case $host_alias in
  229. NOHOST) host_alias=$optarg ;;
  230. *) echo '***' Can only configure for one host at a time. 1>&2
  231. fatal=yes
  232. ;;
  233. esac
  234. ;;
  235. --inc*)
  236. includedir=$optarg
  237. diroptions="$diroptions --includedir=$optarg"
  238. ;;
  239. --inf*)
  240. infodir=$optarg
  241. diroptions="$diroptions --infodir=$optarg"
  242. ;;
  243. --libd*)
  244. libdir=$optarg
  245. diroptions="$diroptions --libdir=$optarg"
  246. ;;
  247. --libe*)
  248. libexecdir=$optarg
  249. diroptions="$diroptions --libexecdir=$optarg"
  250. ;;
  251. --lo*)
  252. localstatedir=$optarg
  253. diroptions="$diroptions --localstatedir=$optarg"
  254. ;;
  255. --ma*)
  256. mandir=$optarg
  257. diroptions="$diroptions --mandir=$optarg"
  258. ;;
  259. --nfp | --nf*)
  260. floating_point=no
  261. floating_pointoption="--nfp"
  262. ;;
  263. --norecursion | --no*)
  264. norecursion=yes
  265. ;;
  266. --ol*)
  267. oldincludedir=$optarg
  268. diroptions="$diroptions --oldincludedir=$optarg"
  269. ;;
  270. --prefix* | --pre*)
  271. prefix=$optarg
  272. prefixoption="--prefix=$optarg"
  273. ;;
  274. --program-prefix* | --program-p*)
  275. program_prefix=$optarg
  276. program_prefixoption="--program-prefix=$optarg"
  277. ;;
  278. --program-suffix* | --program-s*)
  279. program_suffix=$optarg
  280. program_suffixoption="--program-suffix=$optarg"
  281. ;;
  282. --program-transform-name* | --program-t*)
  283. # Double any backslashes or dollar signs in the argument
  284. program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  285. program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
  286. ;;
  287. --rm)
  288. removing=--rm
  289. ;;
  290. --sb*)
  291. sbindir=$optarg
  292. diroptions="$diroptions --sbindir=$optarg"
  293. ;;
  294. --sh*)
  295. sharedstatedir=$optarg
  296. diroptions="$diroptions --sharedstatedir=$optarg"
  297. ;;
  298. --silent | --sil* | --quiet | --q*)
  299. redirect=">/dev/null"
  300. verbose=--silent
  301. ;;
  302. --site* | --sit*)
  303. site=$optarg
  304. site_option="--site=$optarg"
  305. ;;
  306. --srcdir*/ | --sr*/)
  307. # Remove trailing slashes. Otherwise, when the file name gets
  308. # bolted into an object file as debug info, it has two slashes
  309. # in it. Ordinarily this is ok, but emacs takes double slash
  310. # to mean "forget the first part".
  311. srcdir=`echo $optarg | sed -e 's:/$::'`
  312. ;;
  313. --srcdir* | --sr*)
  314. srcdir=$optarg
  315. ;;
  316. --sy*)
  317. sysconfdir=$optarg
  318. diroptions="$diroptions --sysconfdir=$optarg"
  319. ;;
  320. --target* | --ta*)
  321. case $target_alias in
  322. NOTARGET) target_alias=$optarg ;;
  323. *) echo '***' Can only configure for one target at a time. 1>&2
  324. fatal=yes
  325. ;;
  326. esac
  327. ;;
  328. --tmpdir* | --tm*)
  329. TMPDIR=$optarg
  330. tmpdiroption="--tmpdir=$optarg"
  331. ;;
  332. --verbose | --v | --verb*)
  333. redirect=
  334. verbose=--verbose
  335. ;;
  336. --version | --V | --vers*)
  337. echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
  338. exit 0
  339. ;;
  340. --with-*)
  341. case "$option" in
  342. *=*) ;;
  343. *) optarg=yes ;;
  344. esac
  345. withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  346. eval $withopt="$optarg"
  347. withoptions="$withoptions $option"
  348. ;;
  349. --without-*)
  350. withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  351. eval $withopt=no
  352. withoutoptions="$withoutoptions $option"
  353. ;;
  354. --x) with_x=yes
  355. withoptions="$withoptions --with-x"
  356. ;;
  357. --x-i* | --x-l*) other_options="$other_options $orig_option"
  358. ;;
  359. --*)
  360. echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
  361. exit 1
  362. ;;
  363. *)
  364. case $undefs in
  365. NOUNDEFS) undefs=$option ;;
  366. *) echo '***' Can only configure for one host and one target at a time. 1>&2
  367. fatal=yes
  368. ;;
  369. esac
  370. ;;
  371. esac
  372. done
  373. # process host and target
  374. # Do some error checking and defaulting for the host and target type.
  375. # The inputs are:
  376. # configure --host=HOST --target=TARGET UNDEFS
  377. #
  378. # The rules are:
  379. # 1. You aren't allowed to specify --host, --target, and undefs at the
  380. # same time.
  381. # 2. Host defaults to undefs.
  382. # 3. If undefs is not specified, then host defaults to the current host,
  383. # as determined by config.guess.
  384. # 4. Target defaults to undefs.
  385. # 5. If undefs is not specified, then target defaults to host.
  386. case "${fatal}" in
  387. "")
  388. # Make sure that host, target & undefs aren't all specified at the
  389. # same time.
  390. case $host_alias---$target_alias---$undefs in
  391. NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
  392. ;;
  393. *) echo '***' Can only configure for one host and one target at a time. 1>&2
  394. fatal=yes
  395. break 2
  396. ;;
  397. esac
  398. # Now, do defaulting for host.
  399. case $host_alias in
  400. NOHOST)
  401. case $undefs in
  402. NOUNDEFS)
  403. # Neither --host option nor undefs were present.
  404. # Call config.guess.
  405. guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
  406. if host_alias=`${config_shell} ${guesssys}`
  407. then
  408. # If the string we are going to use for
  409. # the target is a prefix of the string
  410. # we just guessed for the host, then
  411. # assume we are running native, and force
  412. # the same string for both target and host.
  413. case $target_alias in
  414. NOTARGET) ;;
  415. *)
  416. if expr $host_alias : $target_alias >/dev/null
  417. then
  418. host_alias=$target_alias
  419. fi
  420. ;;
  421. esac
  422. echo "Configuring for a ${host_alias} host." 1>&2
  423. arguments="--host=$host_alias $arguments"
  424. else
  425. echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
  426. fatal=yes
  427. fi
  428. ;;
  429. *)
  430. host_alias=$undefs
  431. arguments="--host=$host_alias $arguments"
  432. undefs=NOUNDEFS
  433. ;;
  434. esac
  435. esac
  436. # Do defaulting for target. If --target option isn't present, default
  437. # to undefs. If undefs isn't present, default to host.
  438. case $target_alias in
  439. NOTARGET)
  440. case $undefs in
  441. NOUNDEFS)
  442. target_alias=$host_alias
  443. ;;
  444. *)
  445. target_alias=$undefs
  446. arguments="--target=$target_alias $arguments"
  447. ;;
  448. esac
  449. esac
  450. ;;
  451. *) ;;
  452. esac
  453. if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
  454. exec 1>&2
  455. echo Usage: configure [OPTIONS] [HOST]
  456. echo
  457. echo Options: [defaults in brackets]
  458. echo ' --prefix=MYDIR install into MYDIR [/usr/local]'
  459. echo ' --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local]'
  460. echo ' --help print this message [normal config]'
  461. echo ' --build=BUILD configure for building on BUILD [BUILD=HOST]'
  462. echo ' --host=HOST configure for HOST [determined via config.guess]'
  463. echo ' --norecursion configure this directory only [recurse]'
  464. echo ' --program-prefix=FOO prepend FOO to installed program names [""]'
  465. echo ' --program-suffix=FOO append FOO to installed program names [""]'
  466. echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
  467. echo ' --site=SITE configure with site-specific makefile for SITE'
  468. echo ' --srcdir=DIR find the sources in DIR [. or ..]'
  469. echo ' --target=TARGET configure for TARGET [TARGET=HOST]'
  470. echo ' --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp]'
  471. echo ' --nfp configure for software floating point [hard float]'
  472. echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
  473. echo ' --without-FOO package FOO is NOT available'
  474. echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
  475. echo ' --disable-FOO do not include feature FOO'
  476. echo
  477. echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
  478. echo
  479. if [ -r config.status ] ; then
  480. cat config.status
  481. fi
  482. exit 1
  483. fi
  484. configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  485. moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
  486. topsrcdir=`cd \`dirname ${progname}\`; pwd`
  487. # this is a hack. sun4 must always be a valid host alias or this will fail.
  488. if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
  489. true
  490. else
  491. echo '***' cannot find config.sub. 1>&2
  492. exit 1
  493. fi
  494. touch config.junk
  495. if ${config_shell} ${moveifchange} config.junk config.trash ; then
  496. true
  497. else
  498. echo '***' cannot find move-if-change. 1>&2
  499. exit 1
  500. fi
  501. rm -f config.junk config.trash
  502. case "${srcdir}" in
  503. "")
  504. if [ -r configure.in ] ; then
  505. srcdir=.
  506. else
  507. if [ -r ${progname}.in ] ; then
  508. srcdir=`echo ${progname} | sed 's:/configure$::'`
  509. else
  510. echo '***' "Can't find configure.in. Try using --srcdir=some_dir" 1>&2
  511. exit 1
  512. fi
  513. fi
  514. ;;
  515. *)
  516. # Set srcdir to "." if that's what it is.
  517. # This is important for multilib support.
  518. if [ ! -d ${srcdir} ] ; then
  519. echo "Invalid source directory ${srcdir}" >&2
  520. exit 1
  521. fi
  522. pwd=`pwd`
  523. srcpwd=`cd ${srcdir} ; pwd`
  524. if [ "${pwd}" = "${srcpwd}" ] ; then
  525. srcdir=.
  526. fi
  527. esac
  528. ### warn about some conflicting configurations.
  529. case "${srcdir}" in
  530. ".") ;;
  531. *)
  532. if [ -f ${srcdir}/config.status ] ; then
  533. echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
  534. exit 1
  535. fi
  536. esac
  537. # default exec_prefix
  538. case "${exec_prefixoption}" in
  539. "") exec_prefix="\$(prefix)" ;;
  540. *) ;;
  541. esac
  542. # Define the trigger file to make sure configure will re-run whenever
  543. # the gcc version number changes.
  544. if [ "${with_gcc_version_trigger+set}" = set ]; then
  545. gcc_version_trigger="$with_gcc_version_trigger"
  546. gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${with_gcc_version_trigger}`
  547. else
  548. # If gcc's sources are available, define the trigger file.
  549. if [ -f ${topsrcdir}/gcc/version.c ] ; then
  550. gcc_version_trigger=${topsrcdir}/gcc/version.c
  551. gcc_version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < ${gcc_version_trigger}`
  552. case "$arguments" in
  553. *--with-gcc-version-trigger=$gcc_version_trigger* )
  554. ;;
  555. * )
  556. # Make sure configure.in knows about this.
  557. arguments="--with-gcc-version-trigger=$gcc_version_trigger $arguments"
  558. ;;
  559. esac
  560. withoptions="--with-gcc-version-trigger=$gcc_version_trigger $withoptions"
  561. fi
  562. fi
  563. ### break up ${srcdir}/configure.in.
  564. case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
  565. "")
  566. echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
  567. # Check for a directory that's been converted to use autoconf since
  568. # it was last configured.
  569. if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
  570. echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
  571. if [ -r ${srcdir}/configure ] ; then
  572. echo '***' Running the local configure script. 1>&2
  573. case "${cache_file}" in
  574. "") cache_file_option= ;;
  575. *) cache_file_option="--cache-file=${cache_file}" ;;
  576. esac
  577. srcdiroption="--srcdir=${srcdir}"
  578. case "${build_alias}" in
  579. "") buildopt= ;;
  580. *) buildopt="--build=${build_alias}" ;;
  581. esac
  582. eval exec ${config_shell} ${srcdir}/configure ${verbose} \
  583. ${buildopt} --host=${host_alias} --target=${target_alias} \
  584. ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  585. ${srcdiroption} ${diroptions} \
  586. ${program_prefixoption} ${program_suffixoption} \
  587. ${program_transform_nameoption} ${site_option} \
  588. ${withoptions} ${withoutoptions} \
  589. ${enableoptions} ${disableoptions} ${floating_pointoption} \
  590. ${cache_file_option} ${removing} ${other_options} ${redirect}
  591. else
  592. echo '***' There is no configure script present though. 1>&2
  593. fi
  594. fi
  595. exit 1
  596. ;;
  597. *) ;;
  598. esac
  599. case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
  600. "")
  601. echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
  602. exit 1
  603. ;;
  604. *) ;;
  605. esac
  606. case "${TMPDIR}" in
  607. "") TMPDIR=/tmp ; export TMPDIR ;;
  608. *) ;;
  609. esac
  610. # keep this filename short for &%*%$*# 14 char file names
  611. tmpfile=${TMPDIR}/cONf$$
  612. # Note that under many versions of sh a trap handler for 0 will *override* any
  613. # exit status you explicitly specify! At this point, the only non-error exit
  614. # is at the end of the script; these actions are duplicated there, minus
  615. # the "exit 1". Don't use "exit 0" anywhere after this without resetting the
  616. # trap handler, or you'll lose.
  617. trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
  618. # split ${srcdir}/configure.in into common, per-host, per-target,
  619. # and post-target parts. Post-target is optional.
  620. sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
  621. sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
  622. if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
  623. sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
  624. sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
  625. else
  626. sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
  627. echo >${tmpfile}.pos
  628. fi
  629. ### do common part of configure.in
  630. # If the language specific compiler does not exist, but the "gcc" directory does,
  631. # we will skip this directory; in this case the sub-directory's common part
  632. # of configure.in will create a small shell script "skip-this-dir" containing
  633. # commands to completely clean up any temporary or created files.
  634. . ${tmpfile}.com
  635. if test -f skip-this-dir; then
  636. # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
  637. # and reset the trap handler.
  638. trap 0
  639. rm -f Makefile* ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
  640. # Execute the final clean-up actions
  641. ${config_shell} skip-this-dir
  642. # and stop configuring this directory.
  643. exit 0
  644. fi
  645. # some sanity checks on configure.in
  646. case "${srctrigger}" in
  647. "")
  648. echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2
  649. exit 1
  650. ;;
  651. *) ;;
  652. esac
  653. case "${build_alias}" in
  654. "")
  655. if result=`${config_shell} ${configsub} ${host_alias}` ; then
  656. build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  657. build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  658. build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  659. build=${build_cpu}-${build_vendor}-${build_os}
  660. build_alias=${host_alias}
  661. fi
  662. ;;
  663. *)
  664. if result=`${config_shell} ${configsub} ${build_alias}` ; then
  665. buildopt="--build=${build_alias}"
  666. build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  667. build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  668. build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  669. build=${build_cpu}-${build_vendor}-${build_os}
  670. else
  671. echo "Unrecognized build system name ${build_alias}." 1>&2
  672. exit 1
  673. fi
  674. ;;
  675. esac
  676. if result=`${config_shell} ${configsub} ${host_alias}` ; then
  677. true
  678. else
  679. echo "Unrecognized host system name ${host_alias}." 1>&2
  680. exit 1
  681. fi
  682. host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  683. host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  684. host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  685. host=${host_cpu}-${host_vendor}-${host_os}
  686. . ${tmpfile}.hst
  687. if result=`${config_shell} ${configsub} ${target_alias}` ; then
  688. true
  689. else
  690. echo "Unrecognized target system name ${target_alias}." 1>&2
  691. exit 1
  692. fi
  693. target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
  694. target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
  695. target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
  696. target=${target_cpu}-${target_vendor}-${target_os}
  697. . ${tmpfile}.tgt
  698. # Find the source files, if location was not specified.
  699. case "${srcdir}" in
  700. "")
  701. srcdirdefaulted=1
  702. srcdir=.
  703. if [ ! -r ${srctrigger} ] ; then
  704. srcdir=..
  705. fi
  706. ;;
  707. *) ;;
  708. esac
  709. if [ ! -r ${srcdir}/${srctrigger} ] ; then
  710. case "${srcdirdefaulted}" in
  711. "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
  712. *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
  713. esac
  714. echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  715. exit 1
  716. fi
  717. # Some systems (e.g., one of the i386-aix systems the gas testers are
  718. # using) don't handle "\$" correctly, so don't use it here.
  719. tooldir='$(exec_prefix)'/${target_alias}
  720. if [ "${host_alias}" != "${target_alias}" ] ; then
  721. if [ "${program_prefixoption}" = "" ] ; then
  722. if [ "${program_suffixoption}" = "" ] ; then
  723. if [ "${program_transform_nameoption}" = "" ] ; then
  724. program_prefix=${target_alias}- ;
  725. fi
  726. fi
  727. fi
  728. fi
  729. # Merge program_prefix and program_suffix onto program_transform_name.
  730. # (program_suffix used to use $, but it's hard to preserve $ through both
  731. # make and sh.)
  732. if [ "${program_suffix}" != "" ] ; then
  733. program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
  734. fi
  735. if [ "${program_prefix}" != "" ] ; then
  736. program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
  737. fi
  738. # If CC and CXX are not set in the environment, and the Makefile
  739. # exists, try to extract them from it. This is to handle running
  740. # ./config.status by hand.
  741. if [ -z "${CC}" ] && [ -r Makefile ]; then
  742. sed -n -e ':loop
  743. /\\$/ N
  744. s/\\\n//g
  745. t loop
  746. /^CC[ ]*=/ s/CC[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
  747. CC=`tail -1 Makefile.cc`
  748. rm -f Makefile.cc
  749. fi
  750. if [ -z "${CFLAGS}" ] && [ -r Makefile ]; then
  751. sed -n -e ':loop
  752. /\\$/ N
  753. s/\\\n//g
  754. t loop
  755. /^CFLAGS[ ]*=/ s/CFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
  756. CFLAGS=`tail -1 Makefile.cc`
  757. rm -f Makefile.cc
  758. fi
  759. if [ -z "${CXX}" ] && [ -r Makefile ]; then
  760. sed -n -e ':loop
  761. /\\$/ N
  762. s/\\\n//g
  763. t loop
  764. /^CXX[ ]*=/ s/CXX[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
  765. CXX=`tail -1 Makefile.cc`
  766. rm -f Makefile.cc
  767. fi
  768. if [ -z "${CXXFLAGS}" ] && [ -r Makefile ]; then
  769. sed -n -e ':loop
  770. /\\$/ N
  771. s/\\\n//g
  772. t loop
  773. /^CXXFLAGS[ ]*=/ s/CXXFLAGS[ ]*=[ ]*\(.*\)/\1/p' < Makefile > Makefile.cc
  774. CXXFLAGS=`tail -1 Makefile.cc`
  775. rm -f Makefile.cc
  776. fi
  777. # Generate a default definition for YACC. This is used if the makefile can't
  778. # locate bison or byacc in objdir.
  779. for prog in 'bison -y' byacc yacc
  780. do
  781. set dummy $prog; tmp=$2
  782. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
  783. for dir in $PATH; do
  784. test -z "$dir" && dir=.
  785. if test -f $dir/$tmp; then
  786. DEFAULT_YACC="$prog"
  787. break
  788. fi
  789. done
  790. IFS="$save_ifs"
  791. test -n "$DEFAULT_YACC" && break
  792. done
  793. # Generate a default definition for M4. This is used if the makefile can't
  794. # locate m4 in objdir.
  795. for prog in gm4 gnum4 m4
  796. do
  797. set dummy $prog; tmp=$2
  798. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
  799. for dir in $PATH; do
  800. test -z "$dir" && dir=.
  801. if test -f $dir/$tmp; then
  802. DEFAULT_M4="$prog"
  803. break
  804. fi
  805. done
  806. IFS="$save_ifs"
  807. test -n "$DEFAULT_M4" && break
  808. done
  809. # Generate a default definition for LEX. This is used if the makefile can't
  810. # locate flex in objdir.
  811. for prog in flex lex
  812. do
  813. set dummy $prog; tmp=$2
  814. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
  815. for dir in $PATH; do
  816. test -z "$dir" && dir=.
  817. if test -f $dir/$tmp; then
  818. DEFAULT_LEX="$prog"
  819. break
  820. fi
  821. done
  822. IFS="$save_ifs"
  823. test -n "$DEFAULT_LEX" && break
  824. done
  825. if [ "${build}" != "${host}" ]; then
  826. # If we are doing a Canadian Cross, in which the host and build systems
  827. # are not the same, we set reasonable default values for the tools.
  828. tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
  829. tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
  830. tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
  831. tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
  832. tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
  833. tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
  834. for var in ${tools}; do
  835. if [ -z "`eval 'echo $'"${var}"`" ] && [ -r Makefile ]; then
  836. sed -n -e ':loop
  837. /\\$/ N
  838. s/\\\n//g
  839. t loop
  840. /^'"${var}"'[ ]*=/ s/'"${var}"'[ ]*=[ ]*\(.*\)/\1/p' \
  841. < Makefile > Makefile.v
  842. t=`tail -1 Makefile.v`
  843. if [ -n "${t}" ]; then
  844. eval "${var}='${t}'"
  845. fi
  846. rm -f Makefile.v
  847. fi
  848. done
  849. AR=${AR-${host_alias}-ar}
  850. AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
  851. AS=${AS-${host_alias}-as}
  852. AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
  853. BISON=${BISON-bison}
  854. CC=${CC-${host_alias}-gcc}
  855. CFLAGS=${CFLAGS-"-g -O2"}
  856. CXX=${CXX-${host_alias}-c++}
  857. CXXFLAGS=${CXXFLAGS-"-g -O2"}
  858. CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
  859. CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
  860. CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
  861. DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
  862. DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
  863. GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
  864. HOST_PREFIX=${build_alias}-
  865. HOST_PREFIX_1=${build_alias}-
  866. LD=${LD-${host_alias}-ld}
  867. LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
  868. MAKEINFO=${MAKEINFO-makeinfo}
  869. NM=${NM-${host_alias}-nm}
  870. NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
  871. RANLIB=${RANLIB-${host_alias}-ranlib}
  872. RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
  873. WINDRES=${WINDRES-${host_alias}-windres}
  874. WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
  875. if [ -z "${YACC}" ]; then
  876. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
  877. for dir in $PATH; do
  878. test -z "$dir" && dir=.
  879. if test -f $dir/bison; then
  880. YACC="bison -y"
  881. break
  882. fi
  883. if test -f $dir/byacc; then
  884. YACC=byacc
  885. break
  886. fi
  887. if test -f $dir/yacc; then
  888. YACC=yacc
  889. break
  890. fi
  891. done
  892. IFS="$save_ifs"
  893. if [ -z "${YACC}" ]; then
  894. YACC="bison -y"
  895. fi
  896. fi
  897. if [ -z "${LEX}" ]; then
  898. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
  899. for dir in $PATH; do
  900. test -z "$dir" && dir=.
  901. if test -f $dir/flex; then
  902. LEX=flex
  903. break
  904. fi
  905. if test -f $dir/lex; then
  906. LEX=lex
  907. break
  908. fi
  909. done
  910. IFS="$save_ifs"
  911. LEX=${LEX-flex}
  912. fi
  913. # Export variables which autoconf might try to set.
  914. export AS
  915. export AR
  916. export CC_FOR_BUILD
  917. export DLLTOOL
  918. export LD
  919. export NM
  920. export RANLIB
  921. export WINDRES
  922. else
  923. # If CC is still not set, try to get gcc.
  924. if [ -z "${CC}" ]; then
  925. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
  926. for dir in $PATH; do
  927. test -z "$dir" && dir=.
  928. if test -f $dir/gcc; then
  929. CC="gcc"
  930. echo 'void f(){}' > conftest.c
  931. if test -z "`${CC} -g -c conftest.c 2>&1`"; then
  932. CFLAGS=${CFLAGS-"-g -O2"}
  933. CXXFLAGS=${CXXFLAGS-"-g -O2"}
  934. else
  935. CFLAGS=${CFLAGS-"-O2"}
  936. CXXFLAGS=${CXXFLAGS-"-O2"}
  937. fi
  938. rm -f conftest*
  939. break
  940. fi
  941. done
  942. IFS="$save_ifs"
  943. CC=${CC-cc}
  944. else
  945. if test -z "${CFLAGS}"; then
  946. # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
  947. # is set to a version of gcc.
  948. case "${CC}" in
  949. *gcc)
  950. echo 'void f(){}' > conftest.c
  951. if test -z "`${CC} -g -c conftest.c 2>&1`"; then
  952. CFLAGS=${CFLAGS-"-g -O2"}
  953. CXXFLAGS=${CXXFLAGS-"-g -O2"}
  954. else
  955. CFLAGS=${CFLAGS-"-O2"}
  956. CXXFLAGS=${CXXFLAGS-"-O2"}
  957. fi
  958. rm -f conftest*
  959. ;;
  960. esac
  961. fi
  962. fi
  963. CXX=${CXX-"c++"}
  964. CFLAGS=${CFLAGS-"-g"}
  965. CXXFLAGS=${CXXFLAGS-"-g -O2"}
  966. fi
  967. export CC
  968. export CXX
  969. export CFLAGS
  970. export CXXFLAGS
  971. for subdir in . ${subdirs} ; do
  972. # ${subdir} is relative path from . to the directory we're currently
  973. # configuring.
  974. # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  975. invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  976. ### figure out what to do with srcdir
  977. case "${srcdir}" in
  978. ".") # no -srcdir option. We're building in place.
  979. makesrcdir=. ;;
  980. /*) # absolute path
  981. makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  982. ;;
  983. *) # otherwise relative
  984. case "${subdir}" in
  985. .) makesrcdir=${srcdir} ;;
  986. *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
  987. esac
  988. ;;
  989. esac
  990. if [ "${subdir}/" != "./" ] ; then
  991. Makefile=${subdir}/Makefile
  992. fi
  993. if [ ! -d ${subdir} ] ; then
  994. if mkdir ${subdir} ; then
  995. true
  996. else
  997. echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
  998. exit 1
  999. fi
  1000. fi
  1001. case "${removing}" in
  1002. "")
  1003. case "${subdir}" in
  1004. .) ;;
  1005. *) eval echo Building in ${subdir} ${redirect} ;;
  1006. esac
  1007. # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
  1008. # Set up the list of links to be made.
  1009. # ${links} is the list of link names, and ${files} is the list of names to link to.
  1010. # Make the links.
  1011. configlinks="${links}"
  1012. if [ -r ${subdir}/config.status ] ; then
  1013. mv -f ${subdir}/config.status ${subdir}/config.back
  1014. fi
  1015. while [ -n "${files}" ] ; do
  1016. # set file to car of files, files to cdr of files
  1017. set ${files}; file=$1; shift; files=$*
  1018. set ${links}; link=$1; shift; links=$*
  1019. if [ ! -r ${srcdir}/${file} ] ; then
  1020. if [ ! -r ${file} ] ; then
  1021. echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  1022. echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
  1023. exit 1
  1024. else
  1025. srcfile=${file}
  1026. fi
  1027. else
  1028. srcfile=${srcdir}/${file}
  1029. fi
  1030. ${remove} -f ${link}
  1031. # Make a symlink if possible, otherwise try a hard link
  1032. if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
  1033. true
  1034. else
  1035. # We need to re-remove the file because Lynx leaves a
  1036. # very strange directory there when it fails an NFS symlink.
  1037. ${remove} -r -f ${link}
  1038. ${hard_link} ${srcfile} ${link}
  1039. fi
  1040. if [ ! -r ${link} ] ; then
  1041. echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
  1042. exit 1
  1043. fi
  1044. echo "Linked \"${link}\" to \"${srcfile}\"."
  1045. done
  1046. # Create a .gdbinit file which runs the one in srcdir
  1047. # and tells GDB to look there for source files.
  1048. if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
  1049. case ${srcdir} in
  1050. .) ;;
  1051. *) cat > ${subdir}/.gdbinit <<EOF
  1052. # ${NO_EDIT}
  1053. dir ${makesrcdir}
  1054. dir .
  1055. source ${makesrcdir}/.gdbinit
  1056. EOF
  1057. ;;
  1058. esac
  1059. fi
  1060. # Install a makefile, and make it set VPATH
  1061. # if necessary so that the sources are found.
  1062. # Also change its value of srcdir.
  1063. # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has
  1064. # been somewhat optimized and is perhaps a bit twisty.
  1065. # code is order so as to try to sed the smallest input files we know.
  1066. # so do these separately because I don't trust the order of sed -e expressions.
  1067. # the five makefile fragments MUST end up in the resulting Makefile in this order:
  1068. # package macros, target, host, site, and package rules.
  1069. if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
  1070. # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
  1071. rm -f ${subdir}/${Makefile}.tem
  1072. case "${package_makefile_rules_frag}" in
  1073. "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
  1074. *)
  1075. if [ ! -f ${package_makefile_rules_frag} ] ; then
  1076. package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
  1077. fi
  1078. if [ -f ${package_makefile_rules_frag} ] ; then
  1079. sed -e "/^####/ r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
  1080. else
  1081. echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
  1082. echo '***' is missing in ${PWD=`pwd`}. 1>&2
  1083. cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
  1084. fi
  1085. esac
  1086. # working copy now in ${Makefile}.tem
  1087. # Conditionalize for this site.
  1088. rm -f ${Makefile}
  1089. case "${site}" in
  1090. "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  1091. *)
  1092. site_makefile_frag=${srcdir}/config/ms-${site}
  1093. if [ -f ${site_makefile_frag} ] ; then
  1094. sed -e "/^####/ r ${site_makefile_frag}" ${subdir}/Makefile.tem \
  1095. > ${Makefile}
  1096. else
  1097. mv ${subdir}/Makefile.tem ${Makefile}
  1098. site_makefile_frag=
  1099. fi
  1100. ;;
  1101. esac
  1102. # working copy now in ${Makefile}
  1103. # Conditionalize the makefile for this host.
  1104. rm -f ${subdir}/Makefile.tem
  1105. case "${host_makefile_frag}" in
  1106. "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  1107. *)
  1108. if [ ! -f ${host_makefile_frag} ] ; then
  1109. host_makefile_frag=${srcdir}/${host_makefile_frag}
  1110. fi
  1111. if [ -f ${host_makefile_frag} ] ; then
  1112. sed -e "/^####/ r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  1113. else
  1114. echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
  1115. echo '***' is missing in ${PWD=`pwd`}. 1>&2
  1116. mv ${Makefile} ${subdir}/Makefile.tem
  1117. fi
  1118. esac
  1119. # working copy now in ${subdir)/Makefile.tem
  1120. # Conditionalize the makefile for this target.
  1121. rm -f ${Makefile}
  1122. case "${target_makefile_frag}" in
  1123. "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  1124. *)
  1125. if [ ! -f ${target_makefile_frag} ] ; then
  1126. target_makefile_frag=${srcdir}/${target_makefile_frag}
  1127. fi
  1128. if [ -f ${target_makefile_frag} ] ; then
  1129. sed -e "/^####/ r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  1130. else
  1131. mv ${subdir}/Makefile.tem ${Makefile}
  1132. target_makefile_frag=
  1133. fi
  1134. ;;
  1135. esac
  1136. # working copy now in ${Makefile}
  1137. # Emit the default values of this package's macros.
  1138. rm -f ${subdir}/Makefile.tem
  1139. case "${package_makefile_frag}" in
  1140. "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  1141. *)
  1142. if [ ! -f ${package_makefile_frag} ] ; then
  1143. package_makefile_frag=${srcdir}/${package_makefile_frag}
  1144. fi
  1145. if [ -f ${package_makefile_frag} ] ; then
  1146. sed -e "/^####/ r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  1147. else
  1148. echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
  1149. echo '***' is missing in ${PWD=`pwd`}. 1>&2
  1150. mv ${Makefile} ${subdir}/Makefile.tem
  1151. fi
  1152. esac
  1153. # real copy now in ${subdir}/Makefile.tem
  1154. # prepend warning about editting, and a bunch of variables.
  1155. rm -f ${Makefile}
  1156. cat > ${Makefile} <<EOF
  1157. # ${NO_EDIT}
  1158. VPATH = ${makesrcdir}
  1159. links = ${configlinks}
  1160. host_alias = ${host_alias}
  1161. host_cpu = ${host_cpu}
  1162. host_vendor = ${host_vendor}
  1163. host_os = ${host_os}
  1164. host_canonical = ${host_cpu}-${host_vendor}-${host_os}
  1165. target_alias = ${target_alias}
  1166. target_cpu = ${target_cpu}
  1167. target_vendor = ${target_vendor}
  1168. target_os = ${target_os}
  1169. target_canonical = ${target_cpu}-${target_vendor}-${target_os}
  1170. EOF
  1171. case "${build}" in
  1172. "") ;;
  1173. *) cat >> ${Makefile} << EOF
  1174. build_alias = ${build_alias}
  1175. build_cpu = ${build_cpu}
  1176. build_vendor = ${build_vendor}
  1177. build_os = ${build_os}
  1178. build_canonical = ${build_cpu}-${build_vendor}-${build_os}
  1179. EOF
  1180. esac
  1181. case "${package_makefile_frag}" in
  1182. "") ;;
  1183. /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
  1184. *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
  1185. esac
  1186. case "${target_makefile_frag}" in
  1187. "") ;;
  1188. /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
  1189. *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
  1190. esac
  1191. case "${host_makefile_frag}" in
  1192. "") ;;
  1193. /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
  1194. *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
  1195. esac
  1196. if [ "${site_makefile_frag}" != "" ] ; then
  1197. echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
  1198. fi
  1199. # record if we want to build shared libs.
  1200. if test -z "${enable_shared}"; then
  1201. echo enable_shared = no >> ${Makefile}
  1202. else
  1203. echo enable_shared = ${enable_shared} >> ${Makefile}
  1204. fi
  1205. # record if we want to rumtime library stuff installed in libsubdir.
  1206. if test -z "${enable_version_specific_runtime_libs}"; then
  1207. echo enable_version_specific_runtime_libs = no >> ${Makefile}
  1208. else
  1209. echo enable_version_specific_runtime_libs = ${enable_version_specific_runtime_libs} >> ${Makefile}
  1210. fi
  1211. # Emit a macro which describes the file containing gcc's
  1212. # version number.
  1213. echo gcc_version_trigger = ${gcc_version_trigger} >> ${Makefile}
  1214. # And emit a macro defining gcc's version number.
  1215. echo gcc_version = ${gcc_version} >> ${Makefile}
  1216. # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  1217. # remove any form feeds.
  1218. if [ -z "${subdirs}" ]; then
  1219. rm -f ${subdir}/Makefile.tm2
  1220. sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \
  1221. -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
  1222. ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
  1223. rm -f ${subdir}/Makefile.tem
  1224. mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
  1225. fi
  1226. sed -e "s|^prefix[ ]*=.*$|prefix = ${prefix}|" \
  1227. -e "s|^exec_prefix[ ]*=.*$|exec_prefix = ${exec_prefix}|" \
  1228. -e "s|^bindir[ ]*=.*$|bindir = ${bindir}|" \
  1229. -e "s|^sbindir[ ]*=.*$|sbindir = ${sbindir}|" \
  1230. -e "s|^libexecdir[ ]*=.*$|libexecdir = ${libexecdir}|" \
  1231. -e "s|^datadir[ ]*=.*$|datadir = ${datadir}|" \
  1232. -e "s|^sysconfdir[ ]*=.*$|sysconfdir = ${sysconfdir}|" \
  1233. -e "s|^sharedstatedir[ ]*=.*$|sharedstatedir = ${sharedstatedir}|" \
  1234. -e "s|^localstatedir[ ]*=.*$|localstatedir = ${localstatedir}|" \
  1235. -e "s|^libdir[ ]*=.*$|libdir = ${libdir}|" \
  1236. -e "s|^includedir[ ]*=.*$|includedir = ${includedir}|" \
  1237. -e "s|^oldincludedir[ ]*=.*$|oldincludedir = ${oldincludedir}|" \
  1238. -e "s|^infodir[ ]*=.*$|infodir = ${infodir}|" \
  1239. -e "s|^mandir[ ]*=.*$|mandir = ${mandir}|" \
  1240. -e "/^CC[ ]*=/{
  1241. :loop1
  1242. /\\\\$/ N
  1243. s/\\\\\\n//g
  1244. t loop1
  1245. s%^CC[ ]*=.*$%CC = ${CC}%
  1246. }" \
  1247. -e "/^CXX[ ]*=/{
  1248. :loop2
  1249. /\\\\$/ N
  1250. s/\\\\\\n//g
  1251. t loop2
  1252. s%^CXX[ ]*=.*$%CXX = ${CXX}%
  1253. }" \
  1254. -e "/^CFLAGS[ ]*=/{
  1255. :loop3
  1256. /\\\\$/ N
  1257. s/\\\\\\n//g
  1258. t loop3
  1259. s%^CFLAGS[ ]*=.*$%CFLAGS = ${CFLAGS}%
  1260. }" \
  1261. -e "/^CXXFLAGS[ ]*=/{
  1262. :loop4
  1263. /\\\\$/ N
  1264. s/\\\\\\n//g
  1265. t loop4
  1266. s%^CXXFLAGS[ ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
  1267. }" \
  1268. -e "s|^SHELL[ ]*=.*$|SHELL = ${config_shell}|" \
  1269. -e "s|^srcdir[ ]*=.*$|srcdir = ${makesrcdir}|" \
  1270. -e "s/ //" \
  1271. -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \
  1272. -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \
  1273. -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \
  1274. -e "s|^tooldir[ ]*=.*$|tooldir = ${tooldir}|" \
  1275. -e "s:^DEFAULT_YACC[ ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
  1276. -e "s:^DEFAULT_LEX[ ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
  1277. -e "s:^DEFAULT_M4[ ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
  1278. ${subdir}/Makefile.tem >> ${Makefile}
  1279. # If this is a Canadian Cross, preset the values of many more
  1280. # tools.
  1281. if [ "${build}" != "${host}" ]; then
  1282. for var in ${tools}; do
  1283. val=`eval 'echo $'"${var}"`
  1284. sed -e "/^${var}[ ]*=/{
  1285. :loop1
  1286. /\\\\$/ N
  1287. /\\\\$/ b loop1
  1288. s/\\\\\\n//g
  1289. s%^${var}[ ]*=.*$%${var} = ${val}%
  1290. }" ${Makefile} > ${Makefile}.tem
  1291. mv -f ${Makefile}.tem ${Makefile}
  1292. done
  1293. fi
  1294. # final copy now in ${Makefile}
  1295. else
  1296. echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
  1297. fi
  1298. rm -f ${subdir}/Makefile.tem
  1299. case "${host_makefile_frag}" in
  1300. "") using= ;;
  1301. *) using="and \"${host_makefile_frag}\"" ;;
  1302. esac
  1303. case "${target_makefile_frag}" in
  1304. "") ;;
  1305. *) using="${using} and \"${target_makefile_frag}\"" ;;
  1306. esac
  1307. case "${site_makefile_frag}" in
  1308. "") ;;
  1309. *) using="${using} and \"${site_makefile_frag}\"" ;;
  1310. esac
  1311. newusing=`echo "${using}" | sed 's/and/using/'`
  1312. using=${newusing}
  1313. echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  1314. . ${tmpfile}.pos
  1315. # describe the chosen configuration in config.status.
  1316. # Make that file a shellscript which will reestablish
  1317. # the same configuration. Used in Makefiles to rebuild
  1318. # Makefiles.
  1319. case "${norecursion}" in
  1320. "") arguments="${arguments} --norecursion" ;;
  1321. *) ;;
  1322. esac
  1323. if [ ${subdir} = . ] ; then
  1324. echo "#!/bin/sh
  1325. # ${NO_EDIT}
  1326. # This directory was configured as follows:
  1327. ${progname}" ${arguments} "
  1328. # ${using}" > ${subdir}/config.new
  1329. else
  1330. echo "#!/bin/sh
  1331. # ${NO_EDIT}
  1332. # This directory was configured as follows:
  1333. cd ${invsubdir}
  1334. ${progname}" ${arguments} "
  1335. # ${using}" > ${subdir}/config.new
  1336. fi
  1337. chmod a+x ${subdir}/config.new
  1338. if [ -r ${subdir}/config.back ] ; then
  1339. mv -f ${subdir}/config.back ${subdir}/config.status
  1340. fi
  1341. ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
  1342. ;;
  1343. *) rm -f ${Makefile} ${subdir}/config.status ${links} ;;
  1344. esac
  1345. done
  1346. # If there are subdirectories, then recur.
  1347. if [ -z "${norecursion}" ] && [ -n "${configdirs}" ] ; then
  1348. for configdir in ${configdirs} ${extraconfigdirs} ; do
  1349. # If configdir contains ',' it is
  1350. # srcdir,builddir,target_alias
  1351. # These come from extraconfigdirs.
  1352. case ${configdir} in
  1353. *,*)
  1354. eval `echo ${configdir} | sed -e 's/\([^,]*\),\([^,]*\),\(.*\)/cfg_dir=\1 bld_dir=\2 tgt_alias=\3/'`
  1355. ;;
  1356. *)
  1357. cfg_dir=${configdir}
  1358. bld_dir=${configdir}
  1359. tgt_alias=${target_alias}
  1360. ;;
  1361. esac
  1362. if [ -d ${srcdir}/${cfg_dir} ] ; then
  1363. eval echo Configuring ${configdir}... ${redirect}
  1364. case "${srcdir}" in
  1365. ".") ;;
  1366. *)
  1367. if [ ! -d ./${bld_dir} ] ; then
  1368. if mkdir ./${bld_dir} ; then
  1369. true
  1370. else
  1371. echo '***' "${progname}: could not make ${PWD=`pwd`}/${bld_dir}" 1>&2
  1372. exit 1
  1373. fi
  1374. fi
  1375. ;;
  1376. esac
  1377. POPDIR=${PWD=`pwd`}
  1378. cd ${bld_dir}
  1379. ### figure out what to do with srcdir
  1380. case "${srcdir}" in
  1381. ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place.
  1382. /*) # absolute path
  1383. newsrcdir=${srcdir}/${cfg_dir}
  1384. srcdiroption="--srcdir=${newsrcdir}"
  1385. ;;
  1386. ?:*) # absolute path on win32
  1387. newsrcdir=${srcdir}/${cfg_dir}
  1388. srcdiroption="--srcdir=${newsrcdir}"
  1389. ;;
  1390. *) # otherwise relative
  1391. newsrcdir=../${srcdir}/${cfg_dir}
  1392. srcdiroption="--srcdir=${newsrcdir}"
  1393. ;;
  1394. esac
  1395. # Handle --cache-file=../XXX
  1396. case "${cache_file}" in
  1397. "") # empty
  1398. ;;
  1399. /*) # absolute path
  1400. cache_file_option="--cache-file=${cache_file}"
  1401. ;;
  1402. ?:*) # absolute path on win32
  1403. cache_file_option="--cache-file=${cache_file}"
  1404. ;;
  1405. *) # relative path
  1406. cache_file_option="--cache-file=../${cache_file}"
  1407. ;;
  1408. esac
  1409. ### check for guested configure, otherwise fix possibly relative progname
  1410. if [ -f ${newsrcdir}/configure ] ; then
  1411. recprog=${newsrcdir}/configure
  1412. elif [ -f ${newsrcdir}/configure.in ] ; then
  1413. case "${progname}" in
  1414. /*) recprog=${progname} ;;
  1415. ?:*) recprog=${progname} ;;
  1416. *) recprog=../${progname} ;;
  1417. esac
  1418. else
  1419. eval echo No configuration information in ${cfg_dir} ${redirect}
  1420. recprog=
  1421. fi
  1422. ### The recursion line is here.
  1423. if [ ! -z "${recprog}" ] ; then
  1424. if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${tgt_alias} \
  1425. ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  1426. ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
  1427. true
  1428. else
  1429. echo Configure in `pwd` failed, exiting. 1>&2
  1430. exit 1
  1431. fi
  1432. fi
  1433. cd ${POPDIR}
  1434. fi
  1435. done
  1436. fi
  1437. # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
  1438. # and reset the trap handler.
  1439. rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
  1440. trap 0
  1441. exit 0
  1442. #
  1443. # Local Variables:
  1444. # fill-column: 131
  1445. # End:
  1446. #
  1447. # end of configure