Results 1 to 5 of 5

Thread: Using ClanLib with autotools (autoconf, automake, pkg-config ...)

  1. #1
    Peasant LiFo2's Avatar
    Join Date
    May 2007
    Location
    Paris, France
    Posts
    9

    Question Using ClanLib with autotools (autoconf, automake, pkg-config ...)

    Hello,

    I'm using autotools to generate the configure script that will generate the Makefile of the game I'm working on. I managed to get someting that works, but I'm not entirely satisfied.

    First, concerning the check of the library presence :

    Usually, with autoconf, I do it this way :

    To test if foo function of bar library is present, I use this line in configure.in
    Code:
    AC_CHECK_LIB(bar, foo, ,echo "MyApp requires bar library to run."; exit 1)
    Unfortunately, this doesn't seem to work with ClanLib, as I would have to write something like this :
    Code:
    AC_CHECK_LIB(clanCore, function, ,echo "MyApp requires ClanLib to run."; exit 1)
    The problem is it won't work as all functions are members, so they would need to define the class name, but there is no inclusion made in the test code produced.

    <edit reason="forgot this part">
    So I did it this way, but I'm not sure if it's clever, and I think it's not really clean :
    Code:
    AC_CHECK_LIB(clanSignals, main, ,echo "MyApp requires ClanLib to run."; exit 1)
    </edit>

    Secondly concerning pkg-config :
    For now, I'm using a Makefile.in that looks like this :
    Code:
    (...)
    EXTERN_LIBS =   -lclanSignals -lclanGL -lclanCore -lclanSound -lclanDisplay -lclanApp
    HEADERS = `pkg-config --cflags clanApp-0.8`
    (...)
    It works, but I'm sure it's not a clean way to do it. What I'd like to have is something :
    - that will use only pkg-config to find headers and library (seems easy)
    - that will not require to be modified to work with another version of clanlib

    Of course, maybe the API will break my app with future version of clanlib, but isn't it one of the objectives to have a backward compatibility at some points ? Then, it would be nice to be able to compile and install an application, no matter which version of ClanLib is installed.

    So I'm wondering why pkg-config use the library version number. Isn't it a problem ?
    Last edited by LiFo2; 05-14-2007 at 04:29 PM. Reason: I'm stupid and write some stupid things !

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    First Question:
    Using AC_CHECK_LIB(clanSignals...) would only check for the existence of clanSignals. It would not check for (for example) clanMikmod.

    Maybe you can use AC_CHECK_HEADER, i have not tried it with clanlib, but it "should" work:
    Code:
    AC_CHECK_HEADER([stdio.h],
                    [AC_DEFINE([HAVE_STDIO_H])],
                    [AC_MSG_ERROR([Sorry, can't do anything for you])])
    ClanLib uses AC_TRY_COMPILE or AC_RUN_IFELSE to create a test program for existence of other libraries.

    For example using - AC_TRY_COMPILE - see ClanLib configure.ac
    For example using AC_RUN_IFELSE See ClanLib acinclude.m4 CLANLIB_CHECK_LIB macro

    Second Question:
    The next version of ClanLib 0.9 (which is under development) API is not compatible with ClanLib 0.8 API.

    The API is undergoing vast improvements (for example; allowing multiple windows), which will unfortunately break compatibility.

  3. #3
    Peasant LiFo2's Avatar
    Join Date
    May 2007
    Location
    Paris, France
    Posts
    9

    Exclamation When will API be stable ?

    The API is undergoing vast improvements (for example; allowing multiple windows), which will unfortunately break compatibility.
    OK, I understand that sometimes, modifying the API is necessary. Of course, adding functions, objects, features ... is nice, and I have no problem with it. But it's another problem when some are suppressed, renamed or modified. I just ported a game from ClanLib-0.6 to ClanLib-0.8, I know what I'm talking about.

    These kinds of changes not only break compatibility and give to all developers of application relying on the library a lot of work, it can also introduce new bugs in application. During the upgrade, maybe I won't choose the good replacement for the function/object/variable which name was changed. Or worse, maybe after its name was changed, another function/object/variable took this name that was much more logic for it. But my app is using the old one. Now, it compiles but it doesn't do what I want it to.

    I know there are some changes that need to be done, and we all want ClanLib to progress as quick as possible, and to be as good as possible. But as more and more games use it, it should converge to a stable API, and give to its users the assurance of backward compatibility.

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    (Note: I am not a core developer)

    How i understand it, you can still use ClanLib 0.8 for as long as you want, you are not forced to upgrade. Hence, you can specify the library version number when using pkg-config.

    The API of 0.9, has changed, as far as i can see, the changes are "sensible". For example, when i converted the ClanLib 0.9 Basic2D example a couple of days ago, these changes were required:

    Code:
    CL_DisplayWindow window("ClanLib Basic2D Example", 640, 480);
    
    Add - CL_GraphicContext gc = window.get_gc();
    
    Replace -  CL_Display::draw_line(0, (int)(ypos+198), CL_Display::get_width(), (int)(ypos+198), CL_Color( 127, 0, 0));
    
    With - CL_Draw::line(0, (int)(ypos+198), window.get_width(), (int)(ypos+198),CL_Color(127, 0, 0), gc);
    Hopefully, the required changes will be documented somewhere.

    I was quite fortunate when i converted my game http://methane.sourceforge.net/ ( from ClanLib-0.6 to ClanLib-0.8, it only require a single change, the removal of a "&" character. !!! Although i did only use ClanLib to open a screen and use a pixel buffer to manually write to.

  5. #5
    Peasant LiFo2's Avatar
    Join Date
    May 2007
    Location
    Paris, France
    Posts
    9

    Thumbs up No idea for a title :)

    Hey your game looks cool. I'll try it as soon as I'm back home !

Similar Threads

  1. Video in ClanLib
    By d_oilen in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 06-04-2007, 02:52 PM
  2. Clanlib physics
    By pTymN in forum Official ClanLib SDK Forums
    Replies: 4
    Last Post: 05-11-2007, 04:19 AM
  3. Patch to ClanLib-0.9 svn rev 365
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-09-2007, 01:08 PM
  4. Patch to ClanLib-0.8 svn rev 364
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-06-2007, 01:14 PM
  5. Help Installing clanlib
    By dgilla in forum Official ClanLib SDK Forums
    Replies: 5
    Last Post: 01-03-2007, 07:29 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •