configure change required to set HAVE_FLOCKFILE

RESOLVED FIXED in mozilla0.9.8

Status

P2
major
RESOLVED FIXED
17 years ago
14 years ago

People

(Reporter: jdunn, Assigned: roland.mainz)

Tracking

Trunk
mozilla0.9.8
Other
AIX

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments, 1 obsolete attachment)

(Reporter)

Description

17 years ago
extensions/ctl/src/pangoLite/pango-util.c has an ifdef in it
for HAVE_FLOCKFILE which if not set defines getc_unlocked
and a couple of other functions.  

AIX already defines getc_unlocked in stdio.h so when it gets
to this line (HAVE_FLOCKFILE is not set) the build stops
with a redefinition error.

There should be a test in configure.in to check for the existence
of the flockfile stuff and set this define in autoconf.mk's AC_DEFINES.
However, there doesn't seem to be any way of currently setting this
define.

Since this pangoLite is turned on with --enable-extensions=all
this needs to be rectified, programatically, OR this extension
should be removed till it can be.
(Reporter)

Comment 1

17 years ago
updating target milestone... since this is a build bustage.
Severity: normal → major
Priority: -- → P2
Target Milestone: --- → mozilla0.9.8
(Assignee)

Comment 2

17 years ago
Does AIX have flockfile()/funlockfile() ?
(Reporter)

Comment 3

17 years ago
yup... aix has this so does HP...
HP however, just flags the redefinition as a warning
(Assignee)

Comment 4

17 years ago
Created attachment 64022 [details] [diff] [review]
Workaround which uses |#undef getc_unlocked|
(Assignee)

Updated

17 years ago
Keywords: patch, review

Comment 5

17 years ago
Roland, thanks for taking this.
Assignee: katakai → Roland.Mainz
(Assignee)

Comment 6

17 years ago
?!

OKOK, taking... :-)
Status: NEW → ASSIGNED
(Assignee)

Comment 7

17 years ago
cls:
Do we have already checks for flockfile()/funlockfile()/getc_unlocked() in
configure.in which set a CPP-symbol which may be used to determinate whether the
platforms supports them or not ?
As a quick grep will show, we do not have any checks for flockfile, funlockfile
nor getc_unlocked in configure.in.  
(Assignee)

Comment 9

17 years ago
Can someone check-in attachment 64022 [details] [diff] [review] to fix the build bustage - and then we
need a matching check for flockfile()-API in configure.in ...
... need help ...
(Reporter)

Comment 10

17 years ago
you can't undef getc_unlocked, since it isn't a define
it is a function prototype...  we need to come up with
the HAVE_FLOCKFILE define in configure.in

I am planning on looking at this... however my point is
that if someone went to the trouble to actually put
an ifdef HAVE_FLOCKFILE in the code... then SOMEONE
should have put the code in configure.in to set it!
(Assignee)

Comment 11

17 years ago
Created attachment 64133 [details] [diff] [review]
Workaround which sets |HAVE_FLOCKFILE| on AIX

Another attempt for a quick workaround (I am not a configure.in hacker...
sorry...) ...
Attachment #64022 - Attachment is obsolete: true
(Reporter)

Comment 12

17 years ago
Created attachment 64173 [details] [diff] [review]
configure.in change to set HAVE_FLOCKFILE

cls here is a patch, I think it can be made better (should I be using
AC_CACHE_CHECK???) but this seems to work.  NOTE: I tried this on HP, Linux &
AIX, and all 3 have flockfile.	I don't have a system that doesn't, so can't
check the negative case.

Comment 13

17 years ago
hi,

Afraid i am not a configure expert myself. However, simple suggestion. Since
pangolite comes from pango(.org), it must be possible to yank the appropriate
checks in pango's configure.in, configure, config.h.in for our use as below:

config.h.in
-----------
/* Define if you have the flockfile function.  */
#undef HAVE_FLOCKFILE

configure
---------
for ac_func in flockfile
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:7510: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 7515 "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.  */
/* 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();

int 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
#else
$ac_func();
#endif

; return 0; }
EOF
if { (eval echo configure:7538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } &&
test -s conftest${ac_exeext}; then
  rm -rf conftest*
  eval "ac_cv_func_$ac_func=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi

if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  echo "$ac_t""yes" 1>&6
    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHI
JKLMNOPQRSTUVWXYZ'`
  cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF

else
  echo "$ac_t""no" 1>&6
fi
done

configure.in
------------
AC_CHECK_FUNCS(flockfile)

prabhat.
Comment on attachment 64173 [details] [diff] [review]
configure.in change to set HAVE_FLOCKFILE

The AC_CHECK_FUNCS macro will do that testing & set HAVE_<functionname> for
you.  Just adding flockfile to the existing AC_CHECK_FUNCS macros should be
sufficient.
Attachment #64173 - Flags: needs-work+
(Reporter)

Comment 15

17 years ago
Created attachment 64282 [details] [diff] [review]
New diff based on everyone's input

Ok, looks like AC_CHECK_FUNCS(flockfile) does it.

cls  r=???
Comment on attachment 64282 [details] [diff] [review]
New diff based on everyone's input

Sorry, I was a bit quick with that.  Just add it to the existing AC_CHECK_FUNCS
on lines 1854 && 1855 .
Attachment #64282 - Flags: needs-work+
(Reporter)

Comment 18

17 years ago
Created attachment 64290 [details] [diff] [review]
revised diff

Ok, thanks cls, I have updated the patch based on your 
suggestion and am checking it in.  Sorry I didn't see
these before.
(Reporter)

Comment 19

17 years ago
fix checked in - THANKS EVERYONE!
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.