Menu

#14 presence of getopt_long should be checked with autoconf

open
nobody
None
5
2006-02-19
2006-02-19
Anonymous
No

in mmad.cc, two different checks for the presence of
mmad.c (both actually checking for solaris) are used,
however, there are many more OSes that do not provide
getopt_long. Instead of checking for each OS that
doesn't have this function, autoconf should be used to
check if getopt_long is available, and #ifdef
HAVE_GETOPT_LONG should be used to check for its presence.

a working test for getopt_long can be found at:
http://autoconf-archive.cryp.to/adl_func_getopt_long.html

Here's a discussion about copying the gnu getopt_long
into one's own project:
http://lists.gnu.org/archive/html/autoconf/2000-12/msg00030.html

enclosed is a trivial patch for mmad.cc that would work
if the simple test from the first link was implemented.

Discussion

  • Nobody/Anonymous

    mmad.cc.patch

     
  • Nobody/Anonymous

    Logged In: NO

    I forgot to mention that I'm using IRIX 6.5 and that I
    suspect that this problem will appear in most other SYS V
    based systems.

     
  • Nobody/Anonymous

    Logged In: NO

    further issues wile compiling for irix:

    fmin and fmax are not defined. I have no idea where they
    should come from, could you please implement a test for them
    (like the getopt_long test in the first link given in the
    summary), and use the obvious trivial replacements if they
    are not present?

    float fmin(float a, float b){
    return a<b?a:b;
    }
    float fmax(float a, float b){
    return a>b?a:b;
    }

    I don't have GL/glext.h so I commented the #include out, but
    could still compile trackballs; the same goes for stdint.h

    I had to add a -llibintl to the final link pass

    the -D option is not universally understood by all versions
    of install:
    install -D -m664 -g games highScores
    /usr/local/share/trackballs/highScoresinstall: illegal
    option -D.

     

Log in to post a comment.