It helps a bit the fact that the 'configure' script usually hasn't any
sh function definition; they're simply lots of instructions written and
run in order. So, if a program stops at one point, whenever you find
the point, you know (easier than with code with function) which code
lines were run and when.
5,000 lines is actually a rather small configure script. These are
the configure scripts I have lying around (just on Plan 9, I haven't
even looked at my Mac or OpenBSD firewall) that exceed 5,000 lines:
5520 /n/other/scr/src/gs/hpijs- 1.5/configure
5621 /sys/src/libdb/dist/configure
5962 /sys/src/cmd/uucp.taylor/configure
5962 /n/other/frommac/src/cmd/uucp/configure
6722 /sys/src/cmd/links/configure
6722 /n/other/scr/links/links.native/configure
6722 /n/other/scr/links/links.varfont/configure
7352 /n/other/scr/src/gs/jbig2dec/configure
7751 /usr/geoff/src/cmd/unix/rc.byron/configure
8000 /n/other/frommac/desk/gilmore/udftools-1.0.0b2/configure
8250 /n/other/frommac/desk/src/flex/flex-2.5.31/configure
9756 /n/other/scr/src/gs/configure
11460 /n/other/frommac/desk/src/raid.evms/configure
12676 /usr/geoff/src/cmd/grip/grip/configure
13698 /n/other/scr/src/mp3enc.lame/configure
16489 /usr/geoff/src/cmd/imagemagick/ltdl/configure
16489 /n/other/dist/image.magick/im/ltdl/configure
23719 /usr/geoff/src/cmd/imagemagick/configure
23851 /n/other/frommac/src/cmd/bochs/configure
25527 /n/other/dist/image.magick/im/configure
25877 /n/other/scr/src/index/swishe/swish-e-2.4.2/configure
Trying to debug a machine-generated 25,000-line script is really fun.