Finally got autotools to do what I want..I think:
1. use libtool to create either static/shared libs
2. export the header as well as the libs
3. build the testcase when the user runs 'make check'