annotate fft/fftw/fftw-3.3.4/compile @ 40:223f770b5341 kissfft-double tip

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