Subject: pkg/31324: lang/swi-prolog-lite package is broken on Mac OS X
To: None <,,>
From: None <>
List: pkgsrc-bugs
Date: 09/15/2005 20:12:00
>Number:         31324
>Category:       pkg
>Synopsis:       lang/swi-prolog-lite package is broken on Mac OS X
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 15 20:12:00 +0000 2005
>Originator:     Peter Bex
>Release:        n/a (Mac OS X 10.3.9)
Darwin byers.local 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC  Power Macintosh powerpc
When compiling lang/swi-prolog-lite on Mac OS X (Darwin), it will fail halfway during compilation because the configure script gets its information about readline support wrong.

A quick look at the configure script (work/pl-5.2.13/src/ shows that they are knowingly making assumptions that are not valid.  They are trying to detect readline _variables_ by checking for _functions_ with the same name!  (line 374)

I'm not sure why this works on NetBSD, but the C code that is generated for configure on Darwin is definitely not correct:
#line $LINENO "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char $ac_func (); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char $ac_func ();
char (*f) ();

#ifdef F77_DUMMY_MAIN
#  ifdef __cplusplus
     extern "C"
#  endif
   int F77_DUMMY_MAIN() { return 1; }
main ()
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
f = $ac_func;

  return 0;

It assigns ac_func (which is in reality an integer, for example in the case of rl_readline_state) to a function pointer f.
Try to install swi-prolog-lite from pkgsrc on an OS X/Darwin system.
Do not include ../../devel/readline/ if under Darwin.  It won't try to use readlink and the problem goes away.

Unfortunately the prolog directory it installs under is different, so installation still doesn't work: it tries to install to /usr/pkg/lib/swi-prolog-5.2.13, but the Makefiles from the program install to /usr/pkg/lib/swipl-5.2.13
I'm not sure how it is possible that this differs from the location it would install to on other platforms...