NNTPC: genextern.sh fails on Linux??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> compiling 1.0.[45] fails on my system with messages like that:
> 
> :4: `#' operator should be followed by a macro argument name
> :5: `#' operator should be followed by a macro argument name
> 
> These are generated by the shell-script genextern.sh.

I believe this is due to changes introduced after I mentioned on the list
that the nested ifdefs used in the genextern process create problems for
the Digital Unix C compiler (and preprocessor):

> The method used to generate extern.h is maybe a bit too smart for its own
> good. The Digital Unix C compiler chokes on the nested ifdefs:
> 
> cc -g -I. -I.. -c str.c
> /usr/lib/cmplrs/cc/cfe: Error: str.c: 356: An if directive is not terminated properly in the file
> 
> (it runs off the end of the file).
> 
> Closer inspection shows that HAVE_STRCASESTR and HAVE_STRNCASESTR are not
> defined, and that the compiler fails when it tries to compile strcasestr()
> and strncasestr() and the surrounding #ifdef/#endif goop. If the routines
> *and* the surrounding #ifdef/#endif goop is deleted from the file, it
> compiles just fine (but nntpcached won't link, of course).
> 
> gcc works fine.

What I *should* have said in the last sentence is "gcc works fine, as long
as you use the gcc version of cpp also".

For now, I'd recommend you to use the genextern.sh version from 1.0.3, and
make sure that you use the GNU cpp either by patching genextern.sh to
explicitly call GNU cpp (adjust full path name to taste):

*** genextern.sh.orig	Wed Jun 05 13:12:30 1996
--- genextern.sh	Fri Feb 28 23:16:03 1997
***************
*** 5,11 ****
  PATH=$PATH:/lib:/usr/ccs/lib:/usr/lib:/usr/libexec:/usr/bin
  (echo '#define X(y) extern y ;'
   echo '#define Xadd(y) y'
!  cat $* | egrep '^X(add)? *\(') |(cpp || $cpp)|sed -e 's/; *;/;/g'|sed -e 's/^ *//'|\
    (cat <<END
  #ifdef __cplusplus
  extern "C" {
--- 5,11 ----
  PATH=$PATH:/lib:/usr/ccs/lib:/usr/lib:/usr/libexec:/usr/bin
  (echo '#define X(y) extern y ;'
   echo '#define Xadd(y) y'
!  cat $* | egrep '^X(add)? *\(') |(/usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2.2/cpp || $cpp)|sed -e 's/; *;/;/g'|sed -e 's/^ *//'|\
    (cat <<END
  #ifdef __cplusplus
  extern "C" {

or simply change your PATH/path to include the GNU cpp before the system
defined one:

% set path=(/usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2.2/cpp $path)

or similar.

Note that you also need to replace libproff/str.c with the version from
1.0.3. The functionality is the same, but the ifdefs are different.

Steinar Haug, Nethelp consulting, sthaug@nethelp.no


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux