MacPorts on Mountain Lion - get stuck in configuring or building packages

I upgraded my Macbook Pro from Snow Leopard to Mountain Lion by a clean installation last week and installed MacPorts.  A strange thing happened when I tried to install some packages.  For example, when I tried to install gettext, the installation got stuck in the configuration stage.  However, I could go to the working directory and successfully configure gettext manually with the same configuration options.

Assume the name of the package that gets stuck in configuration is NAME.  Below are the steps that I performed as a workaround.
  1. Go to the package folder in the working directory. The full path can be obtained from port with debugging messages (-d).
    # cd ......
  2. Configure the package manually. The full configuration command can be obtained from port with debugging messages (-d).
    # ./configure ......
  3. Go to the working directory.
    # cd `port work NAME`
  4. Modify .macports.NAME.state by appending the following line.
    target: org.macports.configure
  5. Install the package via port.
    # port -d install NAME
Bison is another example. Besides configuration, it also got stuck in building. Again, I could manually build the package with the same command /usr/bin/make -j2 -w all, appended target: org.macports.build to .macports.bison.state, and then installed bison successfully.