This file is indexed.

/usr/bin/mkoctfile-3.2.4 is in octave3.2-headers 3.2.4-12.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
#! /bin/sh
##
## mkoctfile -- create a .oct file suitable for dynamic linking by
## Octave.
##
## Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
##               2006, 2007, 2009 John W. Eaton
##
## This file is part of Octave.
##
## Octave is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 3 of the License, or (at
## your option) any later version.
##
## Octave is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License
## along with Octave; see the file COPYING.  If not, see
## <http://www.gnu.org/licenses/>.

# Exit immediately on any error.

set -e

: ${SED="/bin/sed"}

OCTAVE_VERSION="3.2.4"
OCTAVE_PREFIX="/usr"

DEFAULT_BINDIR="/usr/bin"
DEFAULT_INCLUDEDIR="/usr/include"
DEFAULT_LIBDIR="/usr/lib"
DEFAULT_OCTINCLUDEDIR="/usr/include/octave-3.2.4"
DEFAULT_OCTLIBDIR="/usr/lib/octave-3.2.4"

if [ -n "$OCTAVE_HOME" ]; then
  DEFAULT_BINDIR="`echo $DEFAULT_BINDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`"
  DEFAULT_INCLUDEDIR="`echo $DEFAULT_INCLUDEDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`"
  DEFAULT_LIBDIR="`echo $DEFAULT_LIBDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`"
  DEFAULT_OCTINCLUDEDIR="`echo $DEFAULT_OCTINCLUDEDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`"
  DEFAULT_OCTLIBDIR="`echo $DEFAULT_OCTLIBDIR | $SED "s,^$OCTAVE_PREFIX,$OCTAVE_HOME,"`"
fi

: ${BINDIR=$DEFAULT_BINDIR}
: ${INCLUDEDIR=$DEFAULT_INCLUDEDIR}
: ${LIBDIR=$DEFAULT_LIBDIR}
: ${OCTINCLUDEDIR=$DEFAULT_OCTINCLUDEDIR}
: ${OCTLIBDIR=$DEFAULT_OCTLIBDIR}

DEFAULT_INCFLAGS="-I$OCTINCLUDEDIR -I$OCTINCLUDEDIR/octave"
if [ "$INCLUDEDIR" != /usr/include ]; then
  DEFAULT_INCFLAGS="$DEFAULT_INCFLAGS -I$INCLUDEDIR"
fi

DEFAULT_LFLAGS="-L$OCTLIBDIR"
if [ "$LIBDIR" != /usr/lib ]; then
  DEFAULT_LFLAGS="$DEFAULT_LFLAGS -L$LIBDIR"
fi

# Default values for these variables are filled in when Octave is
# compiled.

: ${EXEEXT=""}

: ${CPPFLAGS=""}
: ${INCFLAGS=$DEFAULT_INCFLAGS}
: ${F77="gfortran"}
: ${FFLAGS="-O2 -g"}
: ${FPICFLAG="-fPIC"}
: ${CC="gcc"}
: ${CFLAGS="-O2 -g"}
: ${CPICFLAG="-fPIC"}
: ${CXX="g++"}
: ${CXXFLAGS="-O2 -g"}
: ${CXXPICFLAG="-fPIC"}
: ${XTRA_CFLAGS=""}
: ${XTRA_CXXFLAGS=-I/usr/include/mpi "-I/usr/include/freetype2"}

: ${DEPEND_FLAGS="-M"}
: ${DEPEND_EXTRA_SED_PATTERN=""}

: ${DL_LD="g++"}
: ${DL_LDFLAGS="-shared -Wl,-Bsymbolic"}

: ${RLD_FLAG="-Wl,-rpath -Wl,/usr/lib/octave-3.2.4"}
: ${RDYNAMIC_FLAG="-rdynamic"}
: ${LIBOCTAVE=-loctave}
: ${LIBOCTINTERP=-loctinterp}
: ${LIBREADLINE=-lreadline}
: ${LIBCRUFT=-lcruft}
: ${BLAS_LIBS="-llapack -lblas"}
: ${FFTW_LIBS="-lfftw3 -lfftw3f"}
: ${LIBS="-lreadline  -lncurses -ldl -lhdf5 -lz -lm "}
: ${FLIBS="-lgfortranbegin -lgfortran"}
: ${LD_CXX="g++"}
: ${LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro"}
: ${LD_STATIC_FLAG=""}
: ${LFLAGS=$DEFAULT_LFLAGS}

: ${ALL_FFLAGS="$FFLAGS"}

: ${ALL_CFLAGS="$INCFLAGS $XTRA_CFLAGS $CFLAGS"}

: ${ALL_CXXFLAGS="$INCFLAGS $XTRA_CXXFLAGS $CXXFLAGS"}

: ${ALL_LDFLAGS="$LD_STATIC_FLAG $CPICFLAG $LDFLAGS"}

: ${OCTAVE_LIBS="$LIBOCTINTERP $LIBOCTAVE $SPECIAL_MATH_LIB $LIBCRUFT"}

# Local variables.

usage_msg="usage: mkoctfile [options] file ..."

version_msg="mkoctfile, version $OCTAVE_VERSION"

cfiles=
ccfiles=
f77files=
objfiles=
libfiles=
octfiles=
octfile=
outputfile=
incflags=
defs=
ldflags=
dbg=:
pass_on_options=
strip=false
no_oct_file_strip_on_this_platform=false
link=true
link_stand_alone=false
output_ext=".oct"
depend=false
compile=true

if [ $# -eq 0 ]; then
  echo $usage_msg 1>&2
  exit 1
fi

if [ $# -eq 1 ]; then
  case "$1" in
    -v | --version)
      echo $version_msg 1>&2
      exit 0
    ;;
  esac
fi

while [ $# -gt 0 ]; do
  file=
  case "$1" in
    *.c)
      file=$1
      cfiles="$cfiles $file"
    ;;
    *.cc | *.C | *.cpp)
      file=$1
      ccfiles="$ccfiles $file"
    ;;
    *.f | *.F | *.f90 | *.F90)
      file=$1
      f77files="$f77files $file"
    ;;
    *.o)
      file=$1
      objfiles="$objfiles $file"
    ;;
    *.a)
      file=$1
      libfiles="$libfiles $file"
    ;;
    -d | --debug | -v | --verbose)
      dbg=echo
    ;;
    -h | -\? | --help)
      echo $usage_msg 1>&2
      cat << EOF

Options:

  -h, -?, --help          Print this message.

  -IDIR                   Add -IDIR to compile commands.

  -idirafter DIR          Add -idirafter DIR to compile commands.

  -DDEF                   Add -DDEF to compile commands.

  -lLIB                   Add library LIB to link command.

  -LDIR                   Add -LDIR to link command.

  -M, --depend            Generate dependency files (.d) for C and C++
                          source files.

  -RDIR                   Add -RDIR to link command.

  -Wl,...                 Pass flags though the linker like -Wl,-rpath=...

  -W...                   Pass flags though the compiler like -Wa,OPTION.

  -c, --compile           Compile, but do not link.

  -o FILE, --output FILE  Output file name.  Default extension is .oct
                          (or .mex if --mex is specified) unless linking
                          a stand-alone executable.

  -g                      Enable debugging options for compilers.

  -p VAR, --print VAR     Print configuration variable VAR.  Recognized
                          variables are:

			    ALL_CFLAGS                FLIBS
			    ALL_CXXFLAGS              FPICFLAG
			    ALL_FFLAGS                INCFLAGS
			    ALL_LDFLAGS               LDFLAGS
			    BLAS_LIBS                 LD_CXX
			    CC                        LD_STATIC_FLAG
			    CFLAGS                    LFLAGS
			    CPICFLAG                  LIBCRUFT
			    CPPFLAGS                  LIBOCTAVE
			    CXX                       LIBOCTINTERP
			    CXXFLAGS                  LIBREADLINE
			    CXXPICFLAG                LIBS
			    DEPEND_EXTRA_SED_PATTERN  OCTAVE_LIBS
			    DEPEND_FLAGS              RDYNAMIC_FLAG
			    DL_LD                     RLD_FLAG
			    DL_LDFLAGS                SED
			    F77                       XTRA_CFLAGS
			    FFLAGS                    XTRA_CXXFLAGS
			    FFTW_LIBS

  --link-stand-alone      Link a stand-alone executable file.

  --mex                   Assume we are creating a MEX file.  Set the
                          default output extension to ".mex".

  -s, --strip             Strip output file.

  -v, --verbose           Echo commands as they are executed.

  FILE                    Compile or link FILE.  Recognized file types are:

                            .c    C source
                            .cc   C++ source
                            .C    C++ source
                            .cpp  C++ source
                            .f    Fortran source (fixed form)
                            .F    Fortran source (fixed form)
                            .f90  Fortran source (free form)
                            .F90  Fortran source (free form)
                            .o    object file
                            .a    library file

EOF
      exit 0
    ;;
    -I*)
      incflags="$incflags $1"
    ;;
    -idirafter)
      shift
      if [ $# -gt 0 ]; then
        incflags="$incflags -idirafter $1"
      else
        echo "mkoctfile: include directory name missing" 1>&2
      fi
    ;;
    -D*)
      defs="$defs $1"
    ;;
    -[lLR]* | -Wl,*)
      ldflags="$ldflags $1"
    ;;
    -M | --depend)
      depend=true
      compile=false
    ;;
    -o | --output)
      shift
      if [ $# -gt 0 ]; then
        outputfile="$1"
      else
        echo "mkoctfile: output file name missing" 1>&2
      fi
    ;;
    -p | --print)
      shift
      if [ $# -gt 0 ]; then
        eval echo \${$1}
        exit 0
      else
        echo "mkoctfile: --print requires argument" 1>&2
        exit 1
      fi
    ;;
    -s | --strip)
      if $no_oct_file_strip_on_this_platform; then
        echo "mkoctfile: stripping disabled on this platform" 1>&2
      else
        strip=true
      fi
    ;;
    -c | --compile)
      link=false
    ;;
    -g)
      ALL_CFLAGS="$ALL_CFLAGS -g"
      ALL_CXXFLAGS="$ALL_CXXFLAGS -g"
      ALL_FFLAGS="$ALL_FFLAGS -g"
    ;;
    --link-stand-alone)
      link_stand_alone=true
    ;;
    --mex)
      incflags="$incflags -I."
      output_ext=".mex"
    ;;
    -W*)
      pass_on_options="$pass_on_options $1"
    ;;
    *)
      echo "mkoctfile: unrecognized argument $1" 1>&2
      exit 1
    ;;
  esac
  if [ -n "$file" ]; then
    if [ -z "$octfile" ]; then
      octfile="$file"
    fi
  fi
  shift
done

if $link_stand_alone; then
  if [ -n "$outputfile" ]; then
    output_option="-o $outputfile"
  fi
else
  if [ -n "$outputfile" ]; then
    octfile="$outputfile"
  else
    octfile=`basename $octfile`
    octfile=`echo $octfile | $SED 's,\.[^.]*$,,'`$output_ext
  fi
fi

# Generate dependency files for C and C++ files.

if $depend; then
  if [ -n "$cfiles" ]; then
    for f in $cfiles; do
      b=`echo $f | $SED 's,\.c$,,'`
      d=$b.d
      cmd="rm -f $d"
      $dbg $cmd
      eval $cmd
      cmd="$CC $DEPEND_FLAGS $CPPFLAGS $ALL_CFLAGS $incflags $def $f | $SED $DEPEND_EXTRA_SED_PATTERN -e 's,^[^:]*/\(.*\.o\):,\1:,' -e 's,$b\.o,pic/& & $d,g' > $d-t && mv $d-t $d"
      $dbg $cmd
      eval $cmd
    done
  fi

  if [ -n "$ccfiles" ]; then
    for f in $ccfiles; do
      case $f in
        *.cc)
          b=`echo $f | $SED 's,\.cc$,,'`
        ;;
        *.C)
          b=`echo $f | $SED 's,\.C$,,'`
        ;;
        *.cpp)
          b=`echo $f | $SED 's,\.cpp$,,'`
        ;;
      esac
      d=$b.d
      cmd="rm -f $d"
      $dbg $cmd
      eval $cmd
      cmd="$CXX $DEPEND_FLAGS $CPPFLAGS $ALL_CXXFLAGS $incflags $defs $f | $SED $DEPEND_EXTRA_SED_PATTERN -e 's,^[^:]*/\(.*\.o\):,\1:,' -e 's,$b\.o,pic/& & $d,g' > $d-t && mv $d-t $d"
      $dbg $cmd
      eval $cmd
    done
  fi
  # If generating dependencies, that's all we do.
  exit 0
fi

# Compile Fortran, C, and C++ files.  Add the name of each object file
# that is produced to the overall list of object files.

if [ -n "$f77files" ]; then
  for f in $f77files; do
    case $f in
      *.f)
        b=`echo $f | $SED 's,\.f$,,'`
      ;;
      *.F)
        b=`echo $f | $SED 's,\.F$,,'`
      ;;
      *.f90)
        b=`echo $f | $SED 's,\.f90$,,'`
      ;;
      *.F90)
        b=`echo $f | $SED 's,\.F90$,,'`
      ;;
    esac
    if [ -n "$F77" ]; then
      if [ -n "$outputfile" ]; then
	if $link; then
	  o=$b.o
	else
	  o=$outputfile
	fi
      else
        o=$b.o
      fi
      objfiles="$objfiles $o"
      cmd="$F77 -c $FPICFLAG $ALL_FFLAGS $incflags $defs $pass_on_options $f -o $o"
      $dbg $cmd
      eval $cmd
    else
      echo "mkoctfile: no way to compile Fortran file $f" 1>&2
    fi
  done
fi

if [ -n "$cfiles" ]; then
  for f in $cfiles; do
    if [ -n  "$CC" ]; then
      b=`echo $f | $SED 's,\.c$,,'`
      if [ -n "$outputfile" ]; then
	if $link; then
	  o=$b.o
	else
	  o=$outputfile
	fi
      else
	o=$b.o
      fi
      objfiles="$objfiles $o"
      cmd="$CC -c $CPPFLAGS $CPICFLAG $ALL_CFLAGS $pass_on_options $incflags $defs $f -o $o"
      $dbg $cmd
      eval $cmd
    else
      echo "mkoctfile: no way to compile C++ file $f" 1>&2
    fi
  done
fi

if [ -n "$ccfiles" ]; then
  for f in $ccfiles; do
    if [ -n "$CXX" ]; then
      case $f in
	*.cc)
	  b=`echo $f | $SED 's,\.cc$,,'`
	;;
	*.C)
	  b=`echo $f | $SED 's,\.C$,,'`
	;;
	*.cpp)
	  b=`echo $f | $SED 's,\.cpp$,,'`
	;;
      esac
      if [ -n "$outputfile" ]; then
	if $link; then
	  o=$b.o
	else
	  o=$outputfile
	fi
      else
	o=$b.o
      fi
      objfiles="$objfiles $o"
      cmd="$CXX -c $CPPFLAGS $CXXPICFLAG $ALL_CXXFLAGS $pass_on_options $incflags $defs $f -o $o"
      $dbg $cmd
      eval $cmd
    else
      echo "mkoctfile: no way to compile C++ file $f" 1>&2
    fi
  done
fi

## Uncomment the following group of lines if you get `Text file busy'
## errors from ld.  This may happen if the .oct file is currently
## running while you are trying to recompile it.  We try moving first,
## since on some systems (HP-UX, maybe others) it is possible to
## rename running programs but not remove them.

## if [ -f "$octfile" ]; then
##   cmd="mv $octfile $octfile.bak"
##   $dbg $cmd
##   eval $cmd
##   cmd="rm -f $octfile.bak"
##   $dbg $cmd
##   eval $cmd
## fi

# Link all the object files.

if $link && [ -n "$objfiles" ]; then
  if $link_stand_alone; then
    if [ -n "$LD_CXX" ]; then
      cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $pass_on_options $output_option $objfiles $libfiles $ldflags $LFLAGS $RLD_FLAG $OCTAVE_LIBS $BLAS_LIBS $FFTW_LIBS $LIBREADLINE $LIBS $FLIBS"
      $dbg $cmd
      eval $cmd
    else
      echo "mkoctfile: no way to link stand-alone executable file" 1>&2
      exit 1
    fi
  else
    LINK_DEPS="$LFLAGS $OCTAVE_LIBS $LDFLAGS $BLAS_LIBS $FFTW_LIBS $LIBS $FLIBS"
    cmd="$DL_LD $DL_LDFLAGS $pass_on_options -o $octfile $objfiles $libfiles $ldflags $LINK_DEPS"
    $dbg $cmd
    eval $cmd
  fi

# Maybe strip it.

  if $strip; then
    cmd="strip $octfile"
    $dbg $cmd
    eval $cmd
  fi
fi

exit 0