Add
-Wl,--no-as-needed before your lib, and -Wl,--as-needed after.Example:
LDFLAGS=-L/opt/informix/lib/esql/ -lm -Wl,--no-as-needed -lifgls -Wl,--as-needed -liodbcThis example will force linking libifgls.so but libiodbc.so will be left out, if not used.