Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#23 Compiling 15.7a on MacOS X fails - diagnosis: constants.h

closed-out-of-date
nobody
None
5
2011-07-03
2009-11-30
Jonathan Leffler
No

Building on MacOS X 10.6.2 (but I had the same problem on 10.5.8 - unresolved at the time), I get the errors:

In file included from main.c:49:
/usr/include/ncurses.h:539:40: error: macro "cbreak" passed 1 arguments, but takes just 0
/usr/include/ncurses.h:564:44: error: macro "erasechar" passed 1 arguments, but takes just 0
/usr/include/ncurses.h:600:43: error: macro "killchar" passed 1 arguments, but takes just 0
make[2]: *** [main.o] Error 1

It turns out that the file constants.h #defines these three macros if the system does not support terminfo.
It also seems that MacOS X looks enough like BSD and not enough like NetBSD or FreeBSD to be considered not to use terminfo, even though it does.

The 'get it to compile and work hack/patch' was to add the #undef and #define lines in the middle of this chunk of code in constants.h:

#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
# define TERMINFO 0 /* no terminfo curses */
#else
# define TERMINFO 1
#endif

#undef TERMINFO
#define TERMINFO 1

#if !TERMINFO
# ifndef KEY_BREAK
# define KEY_BREAK 0400 /* easier to define than to add #if around the use */
# endif
# ifndef KEY_ENTER
# define KEY_ENTER 0401
# endif
# ifndef KEY_BACKSPACE
# define KEY_BACKSPACE 0402
# endif

# if !sun
# define cbreak() crmode() /* name change */
# endif

# if UNIXPC
# define erasechar() (_tty.c_cc[VERASE]) /* equivalent */
# define killchar() (_tty.c_cc[VKILL]) /* equivalent */
# else
# define erasechar() (_tty.sg_erase) /* equivalent */
# define killchar() (_tty.sg_kill) /* equivalent */
# endif /* if UNIXPC */
#endif /* if !TERMINFO */

I'm not sure what symbol you should use to automatically detect MacOS X - and therefore its terminfo support. Maybe there's something standard in Autoconf - but I haven't looked hard.

I hope this diagnosis helps. The compilation was clean and the program works fine with the workaround in place.

Discussion


  • Anonymous
    2010-07-14

    Found a define that worked for me:
    diff constants.h constants.h.orig
    106c106
    < #if (BSD || V9 ) && !__NetBSD__ && !__FreeBSD__ && !__APPLE__
    ---
    > #if (BSD || V9 ) && !__NetBSD__ && !__FreeBSD__

     
  • Thank you so much.

    Sridhar Sarnobat

     
    • status: open --> closed-out-of-date