# Compiling R with PNG support

I just compiled sage 4.6 from source on an Ubuntu 10.04 machine. I have the xorg-dev packages installed. However, I still cannot get r to save the plot of a histogram. Specifically, I am getting:

```
sage: r.png('/tmp/histogram.png')
RuntimeError: R was not compiled with PNG support
```

What *does* work is:

```
sage: r.X11()
sage: r.hist("rnorm(100)")
```

But I can't save the resulting graphic. (Of course, I can print-screen and get it that way, but I was hoping there would be a better way.) Can I compile R with PNG support somehow? Or is there another workaround which will give me what I want (namely, saving a picture of a histogram)?

Thanks.