Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: herr.jth on October 06, 2008, 05:11:22 pm

Title: GNU build system / pkgconfig?
Post by: herr.jth on October 06, 2008, 05:11:22 pm
Hi,
First of all, great engine. I saw the Battlestar Galactica project today at my friends PC and thought "wow, have to try it".
So, back home I downloaded the open_fs2 source and tried to build it using autogen.sh / configure and ran into this bug (http://scp.indiegames.us/mantis/view.php?id=1663). Like the reporter said, no problem for people familiar with *nix, but quite annoying for newbies, so I tried to fix that one.

Result:
Code: [Select]
--- fs2_open_old/configure.ac 2008-10-06 23:20:39.000000000 +0200
+++ fs2_open/configure.ac 2008-10-06 23:31:29.000000000 +0200
@@ -372,7 +372,8 @@
 
 dnl OpenAL
 if test "$fs2_os_unix" = "yes" ; then
- AC_DEFINE([USE_OPENAL])
+ PKG_CHECK_MODULES(OpenAL,openal)
+  AC_DEFINE([USE_OPENAL])
  FS2_LDFLAGS="$FS2_LDFLAGS -lopenal"
 elif test "$fs2_os_osx" = "yes" ; then
  AC_DEFINE([USE_OPENAL])

I simply added the PKG_CHECK_MODULES-Macro which calls pkg-config (... and does not provide some version-checking or valuable output, though)

Since I have almost no experience with autoconf I looked through acincludes.m4 and configure.ac to see how the SDL headers and libraries are found and was somewhat surprised about the relatively big macros/functions there which don`t seem to use pkg-config (at least at first glance).

For the lack of experience I asked myself, which is the better way fixing this problem? Writing some big m4-macro (eventually with a c-testprogram?) and avoiding pkg-config or use the .pc files in /usr/lib/pkgconfig (or whatever the path is)?

Regards, jth
Title: Re: GNU build system / pkgconfig?
Post by: chief1983 on October 06, 2008, 05:31:54 pm
Very true, I ran into this myself.  It was obvious to me what was needed to make it work based on the error, but it would definitely be nice if autogen picked up on it in advance.  Believe it or not, the same problem exists for OpenGL as well, although it's much more rare that it not be installed already on a modern Linux distro.  However, I was using console-only Gentoo at the time.  I will say though, autoconf and family are black magic and I try to avoid touching them with a ten foot pole.

Also,

:welcome:
Title: Re: GNU build system / pkgconfig?
Post by: herr.jth on October 07, 2008, 01:51:42 am
Very true, I ran into this myself.  It was obvious to me what was needed to make it work based on the error, but it would definitely be nice if autogen picked up on it in advance.  Believe it or not, the same problem exists for OpenGL as well, although it's much more rare that it not be installed already on a modern Linux distro.  However, I was using console-only Gentoo at the time.  I will say though, autoconf and family are black magic and I try to avoid touching them with a ten foot pole.



Also,

:welcome:

Thanks for the welcome ;)

I must admit that this was the first time ever I took a close look on those autoconf-files. At least I had some fun with it ;)

Code: [Select]
# Configure paths for SDL
# Sam Lantinga 9/21/99
# stolen from Manish Singh
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor

Well, despite the fact I`am note quite experienced with autoconf, acinclude.m4 and configure.ac convinced me to stay with simple Makefiles and never ever touch autoconf again. I think its better to let the user provide some paths (if necessary) instead of using x thousand lines bash to figure them out.
However, time to start reading the fs2 src ;)
Title: Re: GNU build system / pkgconfig?
Post by: taylor on October 07, 2008, 09:32:13 am
There is a todo list item to move from autoconf to cmake for the build system in order to make things easier on the devs.  I did get it converted to cmake, but never had time to go through and fix up all of the project files and what not so that it is half sane for MSVC and Xcode.

But with this particular bug, I was trying to avoid putting a dependency on pkg-config, particular for just one lib.