From AVRFreaks forums. Dude said it works.

/* Read ADC on ATMega128 */
 
void adc_init(void)
{
DDRC = 0x00;
PORTC = 0x00;
ADCSRA = 0x00; //disable adc
ADMUX = 0x00;
ACSR = 0x80;
ADCSRA = 0x81;
}

unsigned int adc_get(unsigned char chx)
{
unsigned int n;

ADMUX = chx;
ADCSRA = (1<<ADEN)|(1<<ADSC)|(1<<ADPS1)|(1<<ADPS0);
while(!ADCSRA&(1<<ADIF));
n = ADCL + ADCH * 256;
return n;
}