I want to bundle the shared objects of Allegro 4.2 or 4.4 with a game, so people don't have to install the lib to their system first. (Static linking doesn't solve the problem, see last paragraph.)
I made fine progress with liballeg-4.2.2.so respective its symlink liballeg.so.4.2. I put those in ./bin/lib, with . being the game's root directory, and linked like so:
ld -L./bin/lib -lalleg-4.2.2 -Wl,-rpath,./bin/lib *.o
The game finds the lib at runtime, plays normally, but sound will not work. Apparently, I also need the shared objects usually installed in /usr/lib/allegro/4.2.2, i.e. things like alleg-alsadigi.so, alleg-dga2.so, ..., modules.lst. I had no luck whatsoever with putting them in subdirectories of the game. Neither ./bin/lib/allegro/4.2.2 seemed to work, nor ./bin/lib, nor anything else.
ldd gameexecutable won't even display a need for these libs, unlike for the main A4 lib. Apparently Allegro does some magic in locating them, or just assumes a normal installation.
This also sheds light on (but not solves) this: If you build the static version of Allegro 4, link (statically) against it, and don't install any Allegro-related files into the system, sound will not work. Old topic with this issue: http://www.allegro.cc/forums/thread/608589