gdb/config/djgpp/djconfig.sh - gdb

  1. #!/bin/sh
  2. #
  3. # This shell script is a wrapper to the main configure script when
  4. # configuring GDB for DJGPP.  99% of it can also be used when
  5. # configuring other GNU programs for DJGPP.
  6. #
  7. #=====================================================================
  8. # Copyright (C) 1997-2015 Free Software Foundation, Inc.
  9. #
  10. # Originally written by Robert Hoehne, revised by Eli Zaretskii.
  11. # This file is part of GDB.
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 3 of the License, or
  16. # (at your option) any later version.
  17. #
  18. # This program is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  25. #=====================================================================
  26. #
  27. # Call this script like the main configure script with one exception.  If you
  28. # want to pass parameters to configure, you have to pass as the first
  29. # argument the srcdir, even when it is `.' !!!!!
  30. #
  31. # First, undo any CDPATH settings; they will get in our way when we
  32. # chdir to directories.
  33. unset CDPATH

  34. # Where are the sources? If you are used to having the sources
  35. # in a separate directory and the objects in another, then set
  36. # here the full path to the source directory and run this script
  37. # in the directory where you want to build gdb!!
  38. # You might give the source directory on commandline, but use
  39. # then only forward slashes (/) in the directories. It should be
  40. # an absolute path.

  41. if [ x$1 = x ]; then
  42.   srcdir=`pwd`
  43. else
  44.   srcdir=`cd $1 && pwd`
  45.   shift
  46. fi

  47. # Make sure they don't have some file names mangled by untarring.
  48. echo -n "Checking the unpacked distribution..."
  49. if ( ! test -f ${srcdir}/bfd/ChangeLog.0203      || \
  50.      ! test -f ${srcdir}/gdb/ChangeLog.002       || \
  51.      ! test -f ${srcdir}/opcodes/ChangeLog.0203  || \
  52.      ! test -f ${srcdir}/readline/config.h-in ) ; then
  53.   if ( ! test -f ${srcdir}/bfd/ChangeLog.0203 ) ; then
  54.     notfound=${srcdir}/bfd/ChangeLog.0203
  55.   else
  56.     if ( ! test -f ${srcdir}/gdb/ChangeLog.002) ; then
  57.       notfound=${srcdir}/gdb/ChangeLog.002
  58.     else
  59.       if ( ! test -f ${srcdir}/readline/config.h-in ) ; then
  60.         notfound=${srcdir}/readline/config.h-in
  61.       else
  62.         if ( ! test -f ${srcdir}/opcodes/ChangeLog.0203 ) ; then
  63.           notfound=${srcdir}/opcodes/ChangeLog.0203
  64.         fi
  65.       fi
  66.     fi
  67.   fi
  68.   echo " FAILED."
  69.   echo "(File $notfound was not found.)"
  70.   echo ""
  71.   echo "You MUST unpack the sources with the DJTAR command, like this:"
  72.   echo ""
  73.   echo "         djtar -x -n fnchange.lst gdb-X.YZ.tar.gz"
  74.   echo ""
  75.   echo "where X.YZ is the GDB version, and fnchange.lst can be found"
  76.   echo "in the gdb/config/djgpp/ directory in the GDB distribution."
  77.   echo ""
  78.   echo "configure FAILED!"
  79.   exit 1
  80. else
  81.   echo " ok."
  82. fi

  83. # Where is the directory with DJGPP-specific scripts?
  84. DJGPPDIR=${srcdir}/gdb/config/djgpp

  85. echo "Editing configure scripts for DJGPP..."
  86. TMPFILE="${TMPDIR-.}/cfg.tmp"

  87. # We need to skip the build directory if it is a subdirectory of $srcdir,
  88. # otherwise we will have an infinite recursion on our hands...
  89. if test "`pwd`" == "${srcdir}" ; then
  90.   SKIPDIR=""
  91.   SKIPFILES=""
  92. else
  93.   SKIPDIR=`pwd | sed -e "s|${srcdir}|.|"`
  94.   SKIPFILES="${SKIPDIR}/*"
  95. fi

  96. # We use explicit /dev/env/DJDIR/bin/find to avoid catching
  97. # an incompatible DOS/Windows version that might be on their PATH.
  98. for fix_dir in \
  99.   `cd $srcdir && /dev/env/DJDIR/bin/find . -type d ! -ipath "${SKIPDIR}" ! -ipath "${SKIPFILES}"`
  100. do
  101.   if test ! -f ${fix_dir}/configure.orig ; then
  102.     if test -f ${srcdir}/${fix_dir}/configure ; then
  103.       mkdir -p ${fix_dir}
  104.       cp -p ${srcdir}/${fix_dir}/configure ${fix_dir}/configure.orig
  105.     fi
  106.   fi
  107.   if test -f ${fix_dir}/configure.orig ; then
  108.     sed -f ${DJGPPDIR}/config.sed ${fix_dir}/configure.orig > $TMPFILE
  109.     update $TMPFILE ${fix_dir}/configure
  110.     touch ./${fix_dir}/configure -r ${fix_dir}/configure.orig
  111.     rm -f $TMPFILE
  112.   fi
  113.   if test -f ${fix_dir}/INSTALL ; then
  114.     mv ${fix_dir}/INSTALL ${fix_dir}/INSTALL.txt
  115.   fi
  116. done

  117. # Now set the config shell. It is really needed, that the shell
  118. # points to a shell with full path and also it must conatain the
  119. # .exe suffix. I assume here, that bash is installed. If not,
  120. # install it. Additionally, the pathname must not contain a
  121. # drive letter, so use the /dev/x/foo format supported by versions
  122. # of Bash 2.03 and later, and by all DJGPP programs compiled with
  123. # v2.03 (or later) library.
  124. export CONFIG_SHELL=/dev/env/DJDIR/bin/sh.exe

  125. # force to have the ltmain.sh script to be in DOS text format,
  126. # otherwise the resulting ltconfig script will have mixed
  127. # (UNIX/DOS) format and is unusable with Bash ports before v2.03.
  128. utod $srcdir/ltmain.sh

  129. # Give the configure script some hints:
  130. export LD=ld
  131. export NM=nm
  132. export CC=gcc
  133. export CXX=gpp
  134. export CFLAGS="-O2 -ggdb -g3"
  135. export RANLIB=ranlib
  136. export DEFAULT_YACC="bison -y"
  137. export YACC="bison -y"
  138. export DEFAULT_LEX=flex
  139. export PATH_SEPARATOR=';'
  140. # Define explicitly the .exe extension because on W95 with LFN=y
  141. # the check might fail
  142. export am_cv_exeext=.exe
  143. # ltconfig wants to compute the maximum command-line length, but
  144. # Bash 2.04 doesn't like that (it doesn't have any limit ;-), and
  145. # reboots the system.  We know our limit in advance, so we don't
  146. # need all that crap.  Assuming that the environment size is less
  147. # than 4KB, we can afford 12KB of command-line arguments.
  148. export lt_cv_sys_max_cmd_len=12288
  149. # Force depcomp to use _deps rather than .deps as the name of the
  150. # subdirectory where the *.Po dependency files are put.  File names
  151. # with leading dots are invalid on DOS 8+3 filesystems.
  152. export DEPDIR=${DEPDIR:-_deps}

  153. # The configure script needs to see the `install-sh' script, otherwise
  154. # it decides the source installation is broken.  But "make install" will
  155. # fail on 8+3 filesystems if it finds a file `install-', since there
  156. # are numerous "install-foo" targets in Makefile's.  So we rename the
  157. # offending file after the configure step is done.
  158. if test ! -f ${srcdir}/install-sh ; then
  159.   if test -f ${srcdir}/install-.sh ; then
  160.     mv ${srcdir}/install-.sh ${srcdir}/install-sh
  161.   fi
  162. fi

  163. # Now run the configure script while disabling some things like the NLS
  164. # support, which is nearly impossible to be supported in the current way,
  165. # since it relies on file names which will never work on DOS.
  166. echo "Running the configure script..."
  167. $srcdir/configure --srcdir="$srcdir" --prefix='${DJDIR}' \
  168.   --disable-shared --disable-nls --verbose --enable-build-warnings=\
  169. -Wimplicit,-Wcomment,-Wformat,-Wparentheses,-Wpointer-arith,-Wuninitialized $*

  170. if test -f ${srcdir}/install- ; then
  171.   mv ${srcdir}/install- ${srcdir}/install-.sh
  172. fi