# DJGPP specific configuration file.
# Sed script for additional DJGPP specific editing
# of the configure script generated by autoconf 2.61.


# Copyright (C) 2005, 2006 Free Software Foundation, Inc.

# This program 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 2 of the License, or
# (at your option) any later version.

# This program 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 this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


# Additional editing of Makefiles
/^".*ac_file_inputs.*tmp\/out$/ a\
cat > "$tmp/subs-djgpp.sed" << eof_djgpp\
# DJGPP specific Makefile changes.\
s,\\.deps,_deps,g\
s,\\.libs,_libs,g\
s,\\.new\\.,_new.,g\
s,\\.old\\.,_old.,g\
s,\\.tab\\.,_tab.,g\
s,config\\.h\\.in,config.h-in,g\
s,libpng\\.pc\\.in,pc-in,g\
s,libpng\\.pc-configure\\.in,pc-configure.in,g\
s,libpng-config-head\\.in,config-head.in,g\
s,libpng-config-body\\.in,config-body.in,g\
s,Makefile\\.am\\.in,Makefile.am-in,g\
s,Makefile\\.in\\.in,Makefile.in-in,g\
/^\\.y\\.c:/,/^$/ {\
  /\\\$(YACCCOMPILE)/ {\
    a\\\\\
	-@test -f y.tab.c && mv -f y.tab.c y_tab.c\\\\\
	-@test -f y.tab.h && mv -f y.tab.h y_tab.h\
  }\
}\
/for ext in a la so/ s, so,,\
s,libpng_la-,,g\
s,libpng12_la-,12,g\
/^libpng.sym:/,/^$/ s,\\\$@\\.new,new-\\\$@,g\
/^libpng.vers:/,/^$/ s,\\\$@\\.new,new-\\\$@,g\
/^libpng.*_la_OBJECTS =/ s,=,= snprintf.lo,\
/^png\\.lo:/ i\\\\\
snprintf.lo: \\\$(srcdir)/djgpp/snprintf.c\\\\\
	\\\$(LIBTOOL) --mode=compile --tag=CC \\\$(CC) \\\$(DEFS) \\\$(DEFAULT_INCLUDES) \\\$(INCLUDES) \\\$(libpng_la_CPPFLAGS) \\\$(CPPFLAGS) \\\$(AM_CFLAGS) \\\$(CFLAGS) -c -o snprintf.lo `test -f 'snprintf.c' || echo '\\\$(srcdir)/'`djgpp/snprintf.c\\\\\
\
eof_djgpp\
sed -f "\$tmp/subs-djgpp.sed" \$tmp/out > \$tmp/out.djgpp\
mv -f \$tmp/out.djgpp \$tmp/out



# Rename config.h.in into config.h-in
/^[ 	]*ac_config_headers=/,/^_ACEOF/ {
  s|config\.h|&:config.h-in|g
}
/CONFIG_HEADERS=/ s|config\.h|&:config.h-in|

# Makefile.in.in is renamed to Makefile.in-in.
/ac_config_files=/ {
  s|po/Makefile\.in|&:po/Makefile.in-in|
}
/CONFIG_FILES=/ s|po/Makefile\.in|&:po/Makefile.in-in|2

# libpng.pc.in is renamed to libpng.pc-in.
/libpng\.pc\.in/ s|pc\.in|pc-in|

# libpng.pc-configure.in is renamed to libpng_pc-configure.in.
/libpng\.pc-configure\.in/ s|libpng\.pc-configure|pc-configure|

# libpng-config-body.in is renamed to config-body.in.
/libpng-config-body\.in/ s|libpng-||

# libpng-config-head.in is renamed to config-head.in.
/libpng-config-head\.in/ s|libpng-||

# We always use _deps and _libs instead of .deps and .libs, because
# the latter is an invalid name on 8+3 MS-DOS file system.  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,&`,
  }
}

# DOS-style absolute file names should be supported as well
/\*) top_srcdir=/s,/\*,[\\\\/]* | ?:[\\\\/]*,

# 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 and bison.in
# 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/.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%'`
}
/^install_sh=/a\
install_sh=`echo "$install_sh" | sed 's%/dev/.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%${top_srcdir}%;s%.:.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-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}
#/^esac$/,/^ac_abs_srcdir=/ {
/^ac_abs_srcdir=/ i\
ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%/dev/.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`\
ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%/dev/.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`\
ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%/dev/.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%;s%.:.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../..%"`
#ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%/dev/.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%;s%.:.*/libpng[-_0-9]\\{1,1\\}[-.0-9A-Za-z+]*%../../.%"`
/^ac_abs_srcdir=/ a\
for dj_dir in $ac_abs_builddir $ac_abs_top_builddir $ac_abs_top_srcdir $ac_abs_srcdir\
do\
  ac_abs_builddir=`echo "$ac_abs_builddir" | sed "s%//%/%g"`\
  ac_abs_top_builddir=`echo "$ac_abs_top_builddir" | sed "s%//%/%g"`\
  ac_abs_top_srcdir=`echo "$ac_abs_top_srcdir" | sed "s%//%/%g"`\
  ac_abs_srcdir=`echo "$ac_abs_srcdir" | sed "s%//%/%g"`\
done

# Add DJGPP version information.
/^#define VERSION/ s/\$VERSION/&  (DJGPP port (r1))/

# 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"`

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