ac signal detection and output high or low
In comments you specified


  frequency is around 15hz. ... it is ac signal with one peak at around 4.5V and 0.1V in negative cycle


For this scenario, there's no external circuit needed except maybe a digital buffer (with a few mV hysteresis, maybe). If your micro runs on 3.3 V, use a buffer with 5 V tolerant inputs.

Detect the signal presence using a timer in the micro. Each time the input transitions low-high, reset the timer and consider that "signal present". If the timer ever reaches slightly longer than the maximum signal period, consider that "signal absent".