--- configure.orig	2017-08-09 21:30:02.000000000 +0900
+++ configure	2017-10-23 11:12:30.000000000 +0900
@@ -17163,11 +17163,7 @@
 if test "x$ac_cv_lib_readline_tgetent" = xyes; then :
    use_readline=yes
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in readline ; do
-      readline_libs="$readline_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  readline_libs=-lreadline
 
 
   ga_lib_prefix='-l'
@@ -17216,11 +17212,7 @@
 if test "x$ac_cv_lib_ncurses_tgetent" = xyes; then :
    use_readline=yes
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in readline ncurses ; do
-      readline_libs="$readline_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  readline_libs=-lreadline
 
 
   ga_lib_prefix='-l'
@@ -17337,11 +17329,7 @@
    have_geotiff=yes
             have_tiff=yes
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in tiff geotiff ; do
-      geotiff_libs="$geotiff_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  geotiff_libs="-lgeotiff -ltiff"
 
 
   ga_lib_prefix='-l'
@@ -17427,11 +17415,7 @@
 if test "x$ac_cv_lib_shp_main" = xyes; then :
    have_shp=yes
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in shp ; do
-      shp_libs="$shp_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  shp_libs=-lshp
 
 
   ga_lib_prefix='-l'
@@ -17454,7 +17438,7 @@
   LIBS=$ga_saved_libs
 
 
-  # png15
+  # png
   echo
   echo png
   echo ---
@@ -17471,13 +17455,13 @@
   LDFLAGS="-L${ga_supplib_dir}/lib "
   LIBS="$LIBS "
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpng15" >&5
-$as_echo_n "checking for main in -lpng15... " >&6; }
-if ${ac_cv_lib_png15_main+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lpng" >&5
+$as_echo_n "checking for main in -lpng... " >&6; }
+if ${ac_cv_lib_png_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng15  $LIBS"
+LIBS="-lpng  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -17491,17 +17475,17 @@
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_png15_main=yes
+  ac_cv_lib_png_main=yes
 else
-  ac_cv_lib_png15_main=no
+  ac_cv_lib_png_main=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png15_main" >&5
-$as_echo "$ac_cv_lib_png15_main" >&6; }
-if test "x$ac_cv_lib_png15_main" = xyes; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_main" >&5
+$as_echo "$ac_cv_lib_png_main" >&6; }
+if test "x$ac_cv_lib_png_main" = xyes; then :
   have_png=yes
 fi
 
@@ -17887,15 +17871,11 @@
 if test "x$ac_cv_lib_grib2c_main" = xyes; then :
    use_grib2=yes
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in grib2c jasper png15 z ; do
-      grib2_libs="$grib2_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  grib2_libs="-lgrib2c -ljasper -lpng -lz"
 
 
   ga_lib_prefix='-l'
-  for ga_lib_name in grib2c jasper png15 z ; do
+  for ga_lib_name in grib2c jasper png z ; do
       grib2_dynlibs="$grib2_dynlibs ${ga_lib_prefix}${ga_lib_name}"
   done
 
@@ -18172,11 +18152,7 @@
   done
 
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in cairo Xrender fontconfig freetype pixman-1 png15 xml2 z ; do
-      cairo_libs="$cairo_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  cairo_libs=-lcairo
 
 
   ga_lib_prefix='-l'
@@ -18436,11 +18412,7 @@
    use_hdf5=yes
           have_hdf5=yes
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in hdf5 z ; do
-      hdf5_libs="$hdf5_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  hdf5_libs=-lhdf5
 
 
   ga_lib_prefix='-l'
@@ -18555,6 +18527,7 @@
   for ga_lib_name in mfhdf df jpeg z udunits ; do
       hdf_libs="$hdf_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
   done
+  hdf_libs="-lmfhdf -ldf -ludunits"
 
 
   ga_lib_prefix='-l'
@@ -18637,11 +18610,7 @@
 	if test ! -f "$NC_CONFIG" || test ! -x "$NC_CONFIG"; then
           use_nc4="no"
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in udunits netcdf ; do
-      nc_libs="$nc_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  nc_libs=-lnetcdf
 
 
   ga_lib_prefix='-l'
@@ -18656,11 +18625,7 @@
           if test "$nchdf5" = "yes" -a "$use_dap" = "yes" -a "$have_curl" = "yes" ; then
             use_nc4="yes"
 
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in udunits netcdf hdf5_hl hdf5 curl z ; do
-      nc_libs="$nc_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
+  nc_libs=-lnetcdf
 
 
   ga_lib_prefix='-l'
@@ -18799,6 +18764,7 @@
   for ga_lib_name in gadap dapclient dap curl xml2 z ; do
       gadap_libs="$gadap_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
   done
+  gadap_libs=-lgadap
 
 
   ga_lib_prefix='-l'
