annotate src/fftw-3.3.3/compile @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 37bf6b4a2645
children
rev   line source
Chris@10 1 #! /bin/sh
Chris@10 2 # Wrapper for compilers which do not understand '-c -o'.
Chris@10 3
Chris@10 4 scriptversion=2012-03-05.13; # UTC
Chris@10 5
Chris@10 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
Chris@10 7 # Software Foundation, Inc.
Chris@10 8 # Written by Tom Tromey <tromey@cygnus.com>.
Chris@10 9 #
Chris@10 10 # This program is free software; you can redistribute it and/or modify
Chris@10 11 # it under the terms of the GNU General Public License as published by
Chris@10 12 # the Free Software Foundation; either version 2, or (at your option)
Chris@10 13 # any later version.
Chris@10 14 #
Chris@10 15 # This program is distributed in the hope that it will be useful,
Chris@10 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@10 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@10 18 # GNU General Public License for more details.
Chris@10 19 #
Chris@10 20 # You should have received a copy of the GNU General Public License
Chris@10 21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
Chris@10 22
Chris@10 23 # As a special exception to the GNU General Public License, if you
Chris@10 24 # distribute this file as part of a program that contains a
Chris@10 25 # configuration script generated by Autoconf, you may include it under
Chris@10 26 # the same distribution terms that you use for the rest of that program.
Chris@10 27
Chris@10 28 # This file is maintained in Automake, please report
Chris@10 29 # bugs to <bug-automake@gnu.org> or send patches to
Chris@10 30 # <automake-patches@gnu.org>.
Chris@10 31
Chris@10 32 nl='
Chris@10 33 '
Chris@10 34
Chris@10 35 # We need space, tab and new line, in precisely that order. Quoting is
Chris@10 36 # there to prevent tools from complaining about whitespace usage.
Chris@10 37 IFS=" "" $nl"
Chris@10 38
Chris@10 39 file_conv=
Chris@10 40
Chris@10 41 # func_file_conv build_file lazy
Chris@10 42 # Convert a $build file to $host form and store it in $file
Chris@10 43 # Currently only supports Windows hosts. If the determined conversion
Chris@10 44 # type is listed in (the comma separated) LAZY, no conversion will
Chris@10 45 # take place.
Chris@10 46 func_file_conv ()
Chris@10 47 {
Chris@10 48 file=$1
Chris@10 49 case $file in
Chris@10 50 / | /[!/]*) # absolute file, and not a UNC file
Chris@10 51 if test -z "$file_conv"; then
Chris@10 52 # lazily determine how to convert abs files
Chris@10 53 case `uname -s` in
Chris@10 54 MINGW*)
Chris@10 55 file_conv=mingw
Chris@10 56 ;;
Chris@10 57 CYGWIN*)
Chris@10 58 file_conv=cygwin
Chris@10 59 ;;
Chris@10 60 *)
Chris@10 61 file_conv=wine
Chris@10 62 ;;
Chris@10 63 esac
Chris@10 64 fi
Chris@10 65 case $file_conv/,$2, in
Chris@10 66 *,$file_conv,*)
Chris@10 67 ;;
Chris@10 68 mingw/*)
Chris@10 69 file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
Chris@10 70 ;;
Chris@10 71 cygwin/*)
Chris@10 72 file=`cygpath -m "$file" || echo "$file"`
Chris@10 73 ;;
Chris@10 74 wine/*)
Chris@10 75 file=`winepath -w "$file" || echo "$file"`
Chris@10 76 ;;
Chris@10 77 esac
Chris@10 78 ;;
Chris@10 79 esac
Chris@10 80 }
Chris@10 81
Chris@10 82 # func_cl_dashL linkdir
Chris@10 83 # Make cl look for libraries in LINKDIR
Chris@10 84 func_cl_dashL ()
Chris@10 85 {
Chris@10 86 func_file_conv "$1"
Chris@10 87 if test -z "$lib_path"; then
Chris@10 88 lib_path=$file
Chris@10 89 else
Chris@10 90 lib_path="$lib_path;$file"
Chris@10 91 fi
Chris@10 92 linker_opts="$linker_opts -LIBPATH:$file"
Chris@10 93 }
Chris@10 94
Chris@10 95 # func_cl_dashl library
Chris@10 96 # Do a library search-path lookup for cl
Chris@10 97 func_cl_dashl ()
Chris@10 98 {
Chris@10 99 lib=$1
Chris@10 100 found=no
Chris@10 101 save_IFS=$IFS
Chris@10 102 IFS=';'
Chris@10 103 for dir in $lib_path $LIB
Chris@10 104 do
Chris@10 105 IFS=$save_IFS
Chris@10 106 if $shared && test -f "$dir/$lib.dll.lib"; then
Chris@10 107 found=yes
Chris@10 108 lib=$dir/$lib.dll.lib
Chris@10 109 break
Chris@10 110 fi
Chris@10 111 if test -f "$dir/$lib.lib"; then
Chris@10 112 found=yes
Chris@10 113 lib=$dir/$lib.lib
Chris@10 114 break
Chris@10 115 fi
Chris@10 116 done
Chris@10 117 IFS=$save_IFS
Chris@10 118
Chris@10 119 if test "$found" != yes; then
Chris@10 120 lib=$lib.lib
Chris@10 121 fi
Chris@10 122 }
Chris@10 123
Chris@10 124 # func_cl_wrapper cl arg...
Chris@10 125 # Adjust compile command to suit cl
Chris@10 126 func_cl_wrapper ()
Chris@10 127 {
Chris@10 128 # Assume a capable shell
Chris@10 129 lib_path=
Chris@10 130 shared=:
Chris@10 131 linker_opts=
Chris@10 132 for arg
Chris@10 133 do
Chris@10 134 if test -n "$eat"; then
Chris@10 135 eat=
Chris@10 136 else
Chris@10 137 case $1 in
Chris@10 138 -o)
Chris@10 139 # configure might choose to run compile as 'compile cc -o foo foo.c'.
Chris@10 140 eat=1
Chris@10 141 case $2 in
Chris@10 142 *.o | *.[oO][bB][jJ])
Chris@10 143 func_file_conv "$2"
Chris@10 144 set x "$@" -Fo"$file"
Chris@10 145 shift
Chris@10 146 ;;
Chris@10 147 *)
Chris@10 148 func_file_conv "$2"
Chris@10 149 set x "$@" -Fe"$file"
Chris@10 150 shift
Chris@10 151 ;;
Chris@10 152 esac
Chris@10 153 ;;
Chris@10 154 -I)
Chris@10 155 eat=1
Chris@10 156 func_file_conv "$2" mingw
Chris@10 157 set x "$@" -I"$file"
Chris@10 158 shift
Chris@10 159 ;;
Chris@10 160 -I*)
Chris@10 161 func_file_conv "${1#-I}" mingw
Chris@10 162 set x "$@" -I"$file"
Chris@10 163 shift
Chris@10 164 ;;
Chris@10 165 -l)
Chris@10 166 eat=1
Chris@10 167 func_cl_dashl "$2"
Chris@10 168 set x "$@" "$lib"
Chris@10 169 shift
Chris@10 170 ;;
Chris@10 171 -l*)
Chris@10 172 func_cl_dashl "${1#-l}"
Chris@10 173 set x "$@" "$lib"
Chris@10 174 shift
Chris@10 175 ;;
Chris@10 176 -L)
Chris@10 177 eat=1
Chris@10 178 func_cl_dashL "$2"
Chris@10 179 ;;
Chris@10 180 -L*)
Chris@10 181 func_cl_dashL "${1#-L}"
Chris@10 182 ;;
Chris@10 183 -static)
Chris@10 184 shared=false
Chris@10 185 ;;
Chris@10 186 -Wl,*)
Chris@10 187 arg=${1#-Wl,}
Chris@10 188 save_ifs="$IFS"; IFS=','
Chris@10 189 for flag in $arg; do
Chris@10 190 IFS="$save_ifs"
Chris@10 191 linker_opts="$linker_opts $flag"
Chris@10 192 done
Chris@10 193 IFS="$save_ifs"
Chris@10 194 ;;
Chris@10 195 -Xlinker)
Chris@10 196 eat=1
Chris@10 197 linker_opts="$linker_opts $2"
Chris@10 198 ;;
Chris@10 199 -*)
Chris@10 200 set x "$@" "$1"
Chris@10 201 shift
Chris@10 202 ;;
Chris@10 203 *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
Chris@10 204 func_file_conv "$1"
Chris@10 205 set x "$@" -Tp"$file"
Chris@10 206 shift
Chris@10 207 ;;
Chris@10 208 *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
Chris@10 209 func_file_conv "$1" mingw
Chris@10 210 set x "$@" "$file"
Chris@10 211 shift
Chris@10 212 ;;
Chris@10 213 *)
Chris@10 214 set x "$@" "$1"
Chris@10 215 shift
Chris@10 216 ;;
Chris@10 217 esac
Chris@10 218 fi
Chris@10 219 shift
Chris@10 220 done
Chris@10 221 if test -n "$linker_opts"; then
Chris@10 222 linker_opts="-link$linker_opts"
Chris@10 223 fi
Chris@10 224 exec "$@" $linker_opts
Chris@10 225 exit 1
Chris@10 226 }
Chris@10 227
Chris@10 228 eat=
Chris@10 229
Chris@10 230 case $1 in
Chris@10 231 '')
Chris@10 232 echo "$0: No command. Try '$0 --help' for more information." 1>&2
Chris@10 233 exit 1;
Chris@10 234 ;;
Chris@10 235 -h | --h*)
Chris@10 236 cat <<\EOF
Chris@10 237 Usage: compile [--help] [--version] PROGRAM [ARGS]
Chris@10 238
Chris@10 239 Wrapper for compilers which do not understand '-c -o'.
Chris@10 240 Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
Chris@10 241 arguments, and rename the output as expected.
Chris@10 242
Chris@10 243 If you are trying to build a whole package this is not the
Chris@10 244 right script to run: please start by reading the file 'INSTALL'.
Chris@10 245
Chris@10 246 Report bugs to <bug-automake@gnu.org>.
Chris@10 247 EOF
Chris@10 248 exit $?
Chris@10 249 ;;
Chris@10 250 -v | --v*)
Chris@10 251 echo "compile $scriptversion"
Chris@10 252 exit $?
Chris@10 253 ;;
Chris@10 254 cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
Chris@10 255 func_cl_wrapper "$@" # Doesn't return...
Chris@10 256 ;;
Chris@10 257 esac
Chris@10 258
Chris@10 259 ofile=
Chris@10 260 cfile=
Chris@10 261
Chris@10 262 for arg
Chris@10 263 do
Chris@10 264 if test -n "$eat"; then
Chris@10 265 eat=
Chris@10 266 else
Chris@10 267 case $1 in
Chris@10 268 -o)
Chris@10 269 # configure might choose to run compile as 'compile cc -o foo foo.c'.
Chris@10 270 # So we strip '-o arg' only if arg is an object.
Chris@10 271 eat=1
Chris@10 272 case $2 in
Chris@10 273 *.o | *.obj)
Chris@10 274 ofile=$2
Chris@10 275 ;;
Chris@10 276 *)
Chris@10 277 set x "$@" -o "$2"
Chris@10 278 shift
Chris@10 279 ;;
Chris@10 280 esac
Chris@10 281 ;;
Chris@10 282 *.c)
Chris@10 283 cfile=$1
Chris@10 284 set x "$@" "$1"
Chris@10 285 shift
Chris@10 286 ;;
Chris@10 287 *)
Chris@10 288 set x "$@" "$1"
Chris@10 289 shift
Chris@10 290 ;;
Chris@10 291 esac
Chris@10 292 fi
Chris@10 293 shift
Chris@10 294 done
Chris@10 295
Chris@10 296 if test -z "$ofile" || test -z "$cfile"; then
Chris@10 297 # If no '-o' option was seen then we might have been invoked from a
Chris@10 298 # pattern rule where we don't need one. That is ok -- this is a
Chris@10 299 # normal compilation that the losing compiler can handle. If no
Chris@10 300 # '.c' file was seen then we are probably linking. That is also
Chris@10 301 # ok.
Chris@10 302 exec "$@"
Chris@10 303 fi
Chris@10 304
Chris@10 305 # Name of file we expect compiler to create.
Chris@10 306 cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
Chris@10 307
Chris@10 308 # Create the lock directory.
Chris@10 309 # Note: use '[/\\:.-]' here to ensure that we don't use the same name
Chris@10 310 # that we are using for the .o file. Also, base the name on the expected
Chris@10 311 # object file name, since that is what matters with a parallel build.
Chris@10 312 lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
Chris@10 313 while true; do
Chris@10 314 if mkdir "$lockdir" >/dev/null 2>&1; then
Chris@10 315 break
Chris@10 316 fi
Chris@10 317 sleep 1
Chris@10 318 done
Chris@10 319 # FIXME: race condition here if user kills between mkdir and trap.
Chris@10 320 trap "rmdir '$lockdir'; exit 1" 1 2 15
Chris@10 321
Chris@10 322 # Run the compile.
Chris@10 323 "$@"
Chris@10 324 ret=$?
Chris@10 325
Chris@10 326 if test -f "$cofile"; then
Chris@10 327 test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
Chris@10 328 elif test -f "${cofile}bj"; then
Chris@10 329 test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
Chris@10 330 fi
Chris@10 331
Chris@10 332 rmdir "$lockdir"
Chris@10 333 exit $ret
Chris@10 334
Chris@10 335 # Local Variables:
Chris@10 336 # mode: shell-script
Chris@10 337 # sh-indentation: 2
Chris@10 338 # eval: (add-hook 'write-file-hooks 'time-stamp)
Chris@10 339 # time-stamp-start: "scriptversion="
Chris@10 340 # time-stamp-format: "%:y-%02m-%02d.%02H"
Chris@10 341 # time-stamp-time-zone: "UTC"
Chris@10 342 # time-stamp-end: "; # UTC"
Chris@10 343 # End: