This file is a brief guide on how to get Allegro up and running on your Linux system. I can only describe my experience; if you encounter differences on your system, please let me know. For reference, I am setting up Allegro WIP 3.9.38 on an Intel system running Mandrake Linux 7.2. This isn't a substitute for reading the files that come with Allegro; readme.txt, readme.uni, readme.lnx and faq.txt. If you have problems, go there first, and if that fails to help, try the Forums on Allegro.cc. Here, I also cover the bits before and after compiling Allegro itself. I am assuming that you can use the Linux command prompt, sh, and that you can program in C or C++. I am fairly new to Unix myself, so I'd appreciate comments or suggestions on this, at the address above.
gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)
su -c "command" and type
your password. This makes you root for the duration of that command only. You'll see
when you need it as you'll get errors like "permission denied."
allegro-config --version
3.9.38
sh fix.sh unix
./configure
make
The first command is needed if you want to convert a DOS or Windows version to Unix; it doesn't do
any harm to run it anyway. The second sets up the makefile, and the third actually compiles the library../configure --help
to see them. These allow you to specify many options, such Pentium optimizations, and also to make the debug or profiling libraries. For example,
./configure --enable-dbglib=yes
make
If there's no configure file at all, type autoconf to generate it from the configure.in file.make install. Here's where you will probably need su -c "make install".Test the installation with allegro-config --version.
make, for more information. A simple makefile
might be
CFLAGS=-O `allegro-config --cflags`
LDLIBS=`allegro-config --shared`
LDFLAGS=-s
myprog: myprog.o
cc -c -O -I/usr/local/include myprog.c -o myprog.o
cc -s myprog.o -o myprog -L/usr/local/lib -lalleg-3.9.38 -lalleg_unsharable allegro-config is a bit of magic that selects the right include files and libraries
for your program to use. Try typing one of those allegro-config commands in; that's what it expands to in the compiler line..exe suffix, so the example above is called myprog,
not myprog.exe. Second, the shell does not look
in the current directory for programs, so if you type myprog, you'll get bash: myprog: command not found./myprog instead. If you still get errors, likebash: ./myprog: Permission deniedchmod to change it, for example chmod u+x myprog.
set_gfx_mode for errors. Also, running a program fullscreen means either using fullscreen X (slow) or DGA, SVGAlib or FBcon, which require root privileges to run. See the file readme.lnx in the Allegro directory.
#include <Allegro.h> it
will work in DOS but not on Unix. Use #include <allegro.h>.
| Visual C++ | GCC | |
| Object files | .obj | .o |
| C++ files | .cpp | .cc or .cpp |
| Library files | .lib | .a |
END_OF_MAIN(); at the end of your main(). Also, if your program takes
command line arguments, be aware that the shell will expand any wildcards before the program gets them. This is also true for
DJGPP and MinGW, but I don't know about Visual C++. This is a Unix thing rather than Allegro specific. It means that if your directory contains files b1.bmp, b2.bmp and b3.bmp, typing
prog *.bmpprog b1.bmp b2.bmp b3.bmpprog "*.bmp"Otherwise, I think you'll be surprised at how little you need to do to get a well-written DOS program to run on Linux. Congratulations to the Allegro creators!