--- configure.orig	2011-07-23 12:11:13.000000000 +0900
+++ configure	2011-07-23 12:11:47.000000000 +0900
@@ -3785,7 +3785,7 @@
 
   *darwin*)
     is_darwin="yes"
-    LDFLAGS="$LDFLAGS -lSystemStubs"
+    LDFLAGS="$LDFLAGS"
   ;;
 
   cray-*-*)
@@ -9315,13 +9315,8 @@
       readline_inc="$readline_inc ${ga_include_prefix}/${ga_include_name}"
   done
 
-
-  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_inc=""
+  readline_libs=-lreadline
 
 else
    { echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5
@@ -9394,13 +9389,8 @@
       readline_inc="$readline_inc ${ga_include_prefix}/${ga_include_name}"
   done
 
-
-  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_inc=""
+  readline_libs=-lreadline
 
 else
    { echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
@@ -9473,14 +9463,8 @@
       readline_inc="$readline_inc ${ga_include_prefix}/${ga_include_name}"
   done
 
-
-  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_libadd=" -ltermcap"
+  readline_inc=""
+  readline_libs=-lreadline
 
 fi
 
@@ -10428,19 +10412,8 @@
 if test $ac_cv_lib_geotiff_main = yes; then
    use_geotiff=yes
 
-  ga_include_prefix='-I$(supp_include_dir)'
-
-  for ga_include_name in tiff geotiff ; do
-      geotiff_inc="$geotiff_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-
-  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_inc=""
+  geotiff_libs="-lgeotiff -ltiff"
 
 fi
 
@@ -10697,19 +10670,8 @@
 if test $ac_cv_lib_shp_main = yes; then
    use_shp=yes
 
-  ga_include_prefix='-I$(supp_include_dir)'
-
-  for ga_include_name in shapelib shp ; do
-      shp_inc="$shp_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-
-  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_inc=""
+  shp_libs=-lshp
 
 fi
 
@@ -11361,29 +11323,8 @@
 if test $ac_cv_lib_gd_gdImageCreate = yes; then
    use_printim=yes
 
-  ga_include_prefix='-I$(supp_include_dir)'
-
-  for ga_include_name in gd ; do
-      printim_inc="$printim_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-	  if test "$have_jpeg" = "yes" ; then
-
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in gd png12 z jpeg ; do
-      printim_libs="$printim_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
-
-	  else
-
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in gd png12 z ; do
-      printim_libs="$printim_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
-
-          fi
+  printim_inc=""
+  printim_libs=-lgd
 
 fi
 
@@ -12926,15 +12867,12 @@
 
   ga_include_prefix='-I$(supp_include_dir)'
 
-  for ga_include_name in grib2c ; do
-      grib2_inc="$grib2_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
+  grib2_inc=""
 
   ga_lib_prefix='$(supp_lib_dir)/lib'
   ga_lib_suffix='.a'
   for ga_lib_name in grib2c jasper png12 z ; do
-      grib2_libs="$grib2_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
+      grib2_libs="$grib2_libs -l${ga_lib_name}"
   done
 
 
@@ -14260,17 +14198,9 @@
 if test $ac_cv_lib_mfhdf_main = yes; then
    use_hdf=yes
 
-  ga_include_prefix='-I$(supp_include_dir)'
-
-  for ga_include_name in hdf udunits ; do
-      hdf_inc="$hdf_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
+  hdf_inc=""
   for ga_lib_name in mfhdf df udunits sz jpeg z ; do
-      hdf_libs="$hdf_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
+      hdf_libs="$hdf_libs -l${ga_lib_name}"
   done
 
 
@@ -16715,19 +16645,8 @@
 if test $ac_cv_lib_hdf5_main = yes; then
    use_hdf5=yes
 
-  ga_include_prefix='-I$(supp_include_dir)'
-
-  for ga_include_name in hdf5 ; do
-      hdf5_inc="$hdf5_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in hdf5 sz jpeg z ; do
-      hdf5_libs="$hdf5_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
-
+  hdf5_inc=""
+  hdf5_libs=-lhdf5
 
 fi
 
@@ -17328,17 +17247,8 @@
 
   ga_include_prefix='-I$(supp_include_dir)'
 
-  for ga_include_name in udunits netcdf ; do
-      nc_inc="$nc_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in udunits netcdf hdf5_hl hdf5 z sz curl ; do
-      nc_libs="$nc_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
-
+  nc_inc=""
+  nc_libs=-lnetcdf
 
 fi
 
@@ -17851,19 +17761,8 @@
 if test $ac_cv_lib_netcdf_main = yes; then
    use_nc="yes"
 
-  ga_include_prefix='-I$(supp_include_dir)'
-
-  for ga_include_name in udunits netcdf ; do
-      nc_inc="$nc_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  for ga_lib_name in netcdf udunits ; do
-      nc_libs="$nc_libs ${ga_lib_prefix}${ga_lib_name}${ga_lib_suffix}"
-  done
-
+  nc_inc=""
+  nc_libs=-lnetcdf
 
 fi
 
@@ -19257,19 +19156,8 @@
 if test $ac_cv_lib_curl_main = yes; then
    use_gadap="yes"
 
-  ga_include_prefix='-I$(supp_include_dir)'
-
-  for ga_include_name in gadap ; do
-      gadap_inc="$gadap_inc ${ga_include_prefix}/${ga_include_name}"
-  done
-
-
-  ga_lib_prefix='$(supp_lib_dir)/lib'
-  ga_lib_suffix='.a'
-  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_inc=""
+  gadap_libs="-lgadap -ldap -ldapserver -ldapclient -lcurl -lidn -lssl -lcrypto -lz -lxml2 -lpthread -lz -liconv -lm"
 
 fi
 
