annotate src/fftw-3.3.3/compile @ 169:223a55898ab9 tip default

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