Imported from libpng-0.97a.tar
diff --git a/pngwio.c b/pngwio.c
index 0fa2a94..497c5ca 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -33,6 +33,7 @@
       png_error(png_ptr, "Call to NULL write function");
 }
 
+#if !defined(PNG_NO_STDIO)
 /* This is the function which does the actual writing of data.  If you are
    not writing to a standard C stream, you should create a replacement
    write_data function and use it at run time with png_set_write_fn(), rather
@@ -99,6 +100,7 @@
 }
 
 #endif
+#endif
 
 /* This function is called to output any data pending writing (normally
    to disk).  After png_flush is called, there should be no data pending
@@ -111,6 +113,7 @@
       (*(png_ptr->output_flush_fn))(png_ptr);
 }
 
+#if !defined(PNG_NO_STDIO)
 static void
 png_default_flush(png_structp png_ptr)
 {
@@ -120,6 +123,7 @@
       fflush(io_ptr);
 }
 #endif
+#endif
 
 /* This function allows the application to supply new output functions for
    libpng if standard C streams aren't being used.
@@ -149,16 +153,24 @@
 {
    png_ptr->io_ptr = io_ptr;
 
+#if !defined(PNG_NO_STDIO)
    if (write_data_fn != NULL)
       png_ptr->write_data_fn = write_data_fn;
    else
       png_ptr->write_data_fn = png_default_write_data;
+#else
+   png_ptr->write_data_fn = write_data_fn;
+#endif
 
 #if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#if !defined(PNG_NO_STDIO)
    if (output_flush_fn != NULL)
       png_ptr->output_flush_fn = output_flush_fn;
    else
       png_ptr->output_flush_fn = png_default_flush;
+#else
+   png_ptr->output_flush_fn = output_flush_fn;
+#endif
 #endif /* PNG_WRITE_FLUSH_SUPPORTED */
 
    /* It is an error to read while writing a png file */