i want to make a project where i used atmega8 but i want to used arduino library
You should (and probably want to) stay away from the old "Arduino NG and older" option. It was originally made for boards without auto reset, so there's a 10 second delay from hitting reset until you program starts. The bootloader is significantly larger than Optiboot, and there aren't a lot of space.
You should download MiniCore, which lets you use both the internal and the external oscillator, gives you two extra pins if you choose to use the internal oscillator and includes Optiboot. MiniCore can be downloaded at GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
You should (and probably want to) stay away from the old "Arduino NG and older" option. It was originally made for boards without auto reset, so there's a 10 second delay from hitting reset until you program starts. The bootloader is significantly larger than Optiboot, and there aren't a lot of space.
All very true IF the Op intends on using a bootloader. For device with such scant resources, I would use ISP.
Ray
There's also one more thing.. the Arduino IDE introduced a new ATmega8 related bug when v1.6 was released. You're actually not able to set fuses or burn the bootloader because avrdude except the ATmega8 to have an extended fuse, which it hasn't. I had to create a separate avrdude routine in the platform.txt file to get around this issue. No idea why it hasn't been fixed in the IDE yet..