# sed script for additional DJGPP specific editing
# of configure script generated by autoconf 2.59

# Additional editing of Makefiles
/^:t$/ i\
# DJGPP specific Makefile changes.\
  s,\\.deps,_deps,g\
  s,\\.new\\.,_new.,g\
  s,\\.old\\.,_old.,g\
  s,jas_config\\.h\\.in,jas_config.h-in,g\
  s,jas_config2\\.h,jasconfig2.h,g\
  s,jasper\\.spec\\.in,jasper_spec.in,g\
  s,Makefile\\.in\\.in,Makefile.in-in,g\
  s,Makefile\\.am\\.in,Makefile.am-in,g\
  s,(MAKEINFOFLAGS),& --no-split,\
  /^install-info-am:/,/^$/ {\
    /@list=/ s,\\\$(INFO_DEPS),& jasper.i,\
    /@for *file/ s,\\\$(INFO_DEPS),& jasper.i,\
    s,file-\\[0-9\\]\\[0-9\\],& \\$\\$file[0-9] \\$\\$file[0-9][0-9],\
  }

# jasper.spec.in and jas_config.h.in are renamed to jasper_spec.in and jas_config.h-in
/ac_config_headers=/,/^$/ {
  s|src/libjasper/include/jasper/jas_config\.h|&:src/libjasper/include/jasper/jas_config.h-in|
}
/CONFIG_HEADERS=/ {
  s|src/libjasper/include/jasper/jas_config\.h|&:src/libjasper/include/jasper/jas_config.h-in|2
}

# Makefile.in.in is renamed to Makefile.in-in.
/ac_config_files=/,/^$/ {
  s|jasper\.spec|&:jasper_spec.in|
  s|po/Makefile\.in|&:po/Makefile.in-in|
}
/CONFIG_FILES=/ {
  s|po/Makefile\.in|&:po/Makefile.in-in|2
  s|jasper\.spec|&:jasper_spec.in|2
}

# We always use _deps and _libs instead of .deps and .libs, because
# the latter is an invalid name on 8+3 MS-DOS filesystem.  This makes
# the generated Makefiles good for every DJGPP installation, not only
# the one where the package was configured (which could happen to be
# a Windows box, where leading dots in file names are allowed).
/^rmdir[ 	]*\.tst/ i\
am__leading_dot=_
/^rmdir[ 	]*\.libs/ i\
lt_cv_objdir=_libs

# Replace (command) > /dev/null with `command > /dev/null`, since
# parenthesized commands always return zero status in the ported Bash,
# even if the named command doesn't exist
/if ([^|;`]*null/{
  s,(,`,
  s,),,
  /null[ 	]*2>&1/ s,2>&1,&`,
  /null.*null/ s,null.*null,&`,
  /null.*null/ !{
    /null[ 	]*2>&1/ !s,null,&`,
  }
}

# The following two items are changes needed for configuring
# and compiling across partitions.
# 1) The given srcdir value is always translated from the
#    "x:" syntax into "/dev/x" syntax while we run configure.
/^[ 	]*-srcdir=\*.*$/ a\
    ac_optarg=`echo "$ac_optarg" | sed "s,^\\([A-Za-z]\\):,/dev/\\1,"`
/set X `ls -Lt \$srcdir/ i\
   if `echo $srcdir | grep "^/dev/" - > /dev/null`; then\
     srcdir=`echo "$srcdir" | sed -e "s%^/dev/%%" -e "s%/%:/%"`\
   fi

# Autoconf 2.52e generated configure scripts
# write absolute paths into Makefiles making
# them useless for DJGPP installations for
# which the package has not been configured for.
/MISSING=/,/^$/ {
  /^fi$/ a\
am_missing_run=`echo "$am_missing_run" | sed 's%/dev.*/jasper[-_.0-9A-z]*%${top_srcdir}%;s%.:.*/jasper[-_.0-9A-z]*%${top_srcdir}%'`
}
/^install_sh=/a\
install_sh=`echo "$install_sh" | sed 's%/dev.*/jasper[-_.0-9A-z]*%${top_srcdir}%;s%.:.*/jasper[-_.0-9A-z]*%${top_srcdir}%'`

# This will only work if the assumption that the
# testsuite is ran from the following path:
#   ${top_srcdir}/tests/testsuite.dir
# holds. The explicit names are of no importance.
#   ../../. == ${top_srcdir}
/\.)[ 	]*ac_abs_builddir=/,/^esac$/ {
 /^esac$/ a\
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev.*/jasper[-_.0-9A-z]*/[^/]*%../../.%;s%.:.*/jasper[-_.0-9A-z]*/[^/]*%../../.%"`
}
/\.)[ 	]*ac_abs_top_builddir=/,/^esac$/ {
 /^esac$/ a\
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev.*/jasper[-_.0-9A-z]*/[^/]*%../../../%;s%.:.*/jasper[-_.0-9A-z]*/[^/]*%../../../%"`
}
/\.)[ 	]*ac_abs_srcdir=/,/^esac$/ {
 /^esac$/ a\
ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev.*/jasper[-_.0-9A-z]*/[^/]*%../../.%;s%.:.*/jasper[-_.0-9A-z]*/[^/]*%../../.%"`
}
/\.)[ 	]*ac_abs_top_srcdir=/,/^esac$/ {
 /^esac$/ a\
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev.*/jasper[-_.0-9A-z]*/[^/]*%../../../%;s%.:.*/jasper[-_.0-9A-z]*/[^/]*%../../../%"`
}
 
# Add DJGPP version information.
/^#define VERSION/ s/\$VERSION/&  (DJGPP port (r2))/

# We need makeinfo to make the html formated docs.
/\$am_missing_run[ 	]*makeinfo/ s,\$am_missing_run,,

# The path to the FORTRAN compiler and libraries
# shall contain no absolute path reference so it
# will be good for all djgpp installations.
/^FLIBS="\$ac_cv_flibs"/ i\
ac_djgpp_path=`echo "$DJDIR" | sed 's%\\\\\\%/%g' | tr $as_cr_LETTERS $as_cr_letters`\
ac_cv_flibs=`echo "$ac_cv_flibs" | sed "s%-L$ac_djgpp_path%-L/dev/env/DJDIR%g"`

# Replace absolute prefix (like c:/djgpp) of sys_lib_search_path_spec with
# generic /dev/env/DJDIR string so it will be good for all djgpp installations.
/^if test "\$withGCC"/,/^else$/ {
  /^else$/ i\
  sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s|$DJDIR|/dev/env/DJDIR|g"`
}

# Force the test for 'ln -s' to report 'cp -pf'.
/^LN_S=\$as_ln_s$/ i\
as_ln_s='cp -pf'
