Configure missed -Kpic on Solaris

David Collier-Brown davecb at Canada.Sun.COM
Fri Nov 27 15:12:05 GMT 1998

When configuring Samba 2.0 beta 2 on Solaris 2.7, I specified
 --with-smbwarppers, but got
checking for sysv ipc... (cached) yes
checking whether to use smbwrapper... yes
No support for PIC code - disabling smbwrapper and smbsh
checking whether to use AFS... no

A look at config.log only showed 
configure:6838: checking for sysv ipc
configure:6876: checking whether to use smbwrapper
configure:6920: checking whether to use AFS

Looking at configure showed a check for -Kpic that should
have succeeded: I ran configure again with sh -x
to get
+ echo checking whether cc accepts -Kpic... \c ^M
checking whether cc accepts -Kpic... + echo configure:5534: checking
whether cc
accepts -Kpic ^M
+ echo ${ac_cv_prog_cc_Kpic+set} ^M
+ eval test "${ac_cv_prog_cc_Kpic+set}" = set ^M
+ test  = set ^M
+ echo void f(){} ^M
+ cc -Kpic -c conftest.c ^M
+ test -z
ic -c conftest.c^M
/opcom/on998-tools/SUNWspro/SC4.2/bin/../SC4.2/bin/acomp -i conftest.c
-y-fbe -y
/opcom/on998-tools/SUNWspro/SC4.2/bin/../SC4.2/bin/fbe -y-xarch=v7 -y-o
st.o -y-pic -y-verbose -H -Qy -D__SunOS_5_7 -D__SUNPRO_C=0x420 -D__SVR4
 -D__sun -D__sparc -D__BUILTIN_VA_ARG_INCR -Xa -Dunix -Dsun -Dsparc
 -I/opcom/on998-tools/SUNWspro/SC4.2/SC4.2/include/cc -2k
SUNWspro/SC4.2/bin/../SC4.2/bin/cc -H -xtime -Kpic -c "^M
acomp           real    0.0     user    0.0     sys     0.0      ^M
+ rm -f conftest.c conftest.o ^M
+ echo no ^M

When I create a file "conftest.c" containing
and run $ cc -Kpic -c conftest.c; echo $? I get
-c conftest.c
/opcom/on998-tools/SUNWspro/SC4.2/bin/../SC4.2/bin/acomp -i conftest.c
-y-fbe -y/opcom/on998-tools/SUNWspro/SC4.2/bin/../SC4.2/bin/fbe
-y-xarch=v7 -y-o -yconftest.o -y-pic -y-verbose -H -Qy -D__SunOS_5_7
-D__SUNPRO_C=0x420 -D__SVR4 -D__unix -D__sun -D__sparc
-D__BUILTIN_VA_ARG_INCR -Xa -Dunix -Dsun -Dsparc -D__RESTRICT
-I/opcom/on998-tools/SUNWspro/SC4.2/SC4.2/include/cc -2k
"-g/opcom/on998-tools/SUNWspro/SC4.2/bin/../SC4.2/bin/cc -H -xtime -Kpic
-c "
acomp           real    0.8     user    0.0     sys     0.0
$ echo $?

I find the failure contra-intuitive...  the actual code is
if test -z "`${CC-cc} -Kpic -c conftest.c 2>&1`"; then

which appears to be looking for any output **whatsoever** from cc as
indication of failure.  This is sane on v6, but not every
compiler-writer is sane (or even knows why Unix isn't chatty).

Alas, the idiom "command 2>&1 1>/dev/null" doesn't help, as the SunPro 
folks write their status messages to stderr!

Could you switch the combination of Solaris and SunPro cc to using the
return value from cc, instead of the messages?  It would also catch
cases where the program dies before it could open it's mouth (;-))

David Collier-Brown,  | Always do right. This will gratify some people
185 Ellerslie Ave.,   | and astonish the rest.        -- Mark Twain
Willowdale, Ontario   |
Work: (905) 477-0437, Home: (416) 223-8968, Email: davecb at

More information about the samba-technical mailing list