Alan Young wrote:
>
> > Something strange is going on in configure. There's something in
> > > configure that says if I'm not gcc, then don't create a shared lib.
> > > It gets worse if you specify CFLAGS in the environment, then it
> > > doesn't work at all (gcc pukes on my -arch switch). It seems to
> > > be calling /usr/bin/gcc directly.
> >
> > You see. The whole idea of libtool is to use "it" to call your compiler
> > so your makefile remains independant of such things and thus more
> > flexiable.
>
> Personally, I've never been real thrilled with libtool.
I think I've pinned down what is causing shared libraries to be turned off.
I found a message in the configure log - "checking if libtool supports
shared libraries..." which is getting "no" printed after it. It did some
spelunking into configure and found that this test is actually coming out
of ltconfig and not configure. By adding a --debug switch to the command
line that is built in configure to call ltconfig, I was able to generate
a trace and I think I see what might is going wrong. In ltconfig there
is a flag called "can_build_shared". This is set by a number of
different conditions. It seems we are hitting the default in a test that
is trying to figure out what switch the compiler needs to produce position
independent code (PIC). Specifically, it's this test:
echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
pic_flag=
special_shlib_compile_flags=
wl=
link_static_flag=
no_builtin_flag=
if test "$with_gcc" = yes; then
wl='-Wl,'
link_static_flag='-static'
case "$host_os" in
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
aix*)
# Below there is a dirty hack to force normal static linking with -ldl
# The problem is because libdl dynamically linked with both libc and
# libC (AIX C++ library), which obviously doesn't included in libraries
# list by gcc. This cause undefined symbols with -static flags.
# This hack allows C programs to be linked with "-static -ldl", but
# we not sure about C++ programs.
link_static_flag="$link_static_flag ${wl}-lC"
;;
cygwin* | mingw* | os2*)
# We can build DLLs from non-PIC.
;;
amigaos*)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
# like `-m68040'.
pic_flag='-m68020 -resident32 -malways-restore-a4'
;;
sysv4*MP*)
if test -d /usr/nec; then
pic_flag=-Kconform_pic
fi
;;
*)
pic_flag='-fPIC'
;;
esac
else
# PORTME Check for PIC flags for the system compiler.
case "$host_os" in
aix3* | aix4*)
# All AIX code is PIC.
link_static_flag='-bnso -bI:/lib/syscalls.exp'
;;
hpux9* | hpux10* | hpux11*)
# Is there a better link_static_flag that works with the bundled CC?
wl='-Wl,'
link_static_flag="${wl}-a ${wl}archive"
pic_flag='+Z'
;;
irix5* | irix6*)
wl='-Wl,'
link_static_flag='-non_shared'
# PIC (with -KPIC) is the default.
;;
cygwin* | mingw* | os2*)
# We can build DLLs from non-PIC.
;;
osf3* | osf4* | osf5*)
# All OSF/1 code is PIC.
wl='-Wl,'
link_static_flag='-non_shared'
;;
sco3.2v5*)
pic_flag='-Kpic'
link_static_flag='-dn'
special_shlib_compile_flags='-belf'
;;
solaris*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
wl='-Wl,'
;;
sunos4*)
pic_flag='-PIC'
link_static_flag='-Bstatic'
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
pic_flag='-KPIC'
link_static_flag='-Bstatic'
wl='-Wl,'
;;
uts4*)
pic_flag='-pic'
link_static_flag='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
pic_flag='-Kconform_pic'
link_static_flag='-Bstatic'
fi
;;
*)
can_build_shared=no
# I added this next echo - Alan
echo "ACK... we hit a default case. can_build_shared=no!"
;;
esac
fi
As you can see since CCC is not GCC, we fall into the else half of the
if. And since there's no Alpha Linux test in the else statement's case,
we hit the default which sets can_build_shared to NO. Peter's trick
works because it fools the script into thinking we are compiling with
GCC when we really are not and the program logic goes to the true part
of the if.
I'd like to propose that we add a case to ltconfig that will check for
Compaq C (ccc). Unfortunately, this will mean everyone will need to
update their libtools and people will have to update packages with the
new libtool until the maintainers catch up, but I think this will solve
the problem. In the above case, I suggest this additional code be
added before the default case so the code looks like:
linux-gnu)
# Should really test the cpu type here too, but for now we'll assume
# that ccc is only on the Alpha platform. If a non Alpha compiler
# called ccc comes along, well, then, this will need to be fixed.
case "$compiler" in
ccc)
# according to the ccc manpage -shared is the default
# do we need -call_shared too?
pic_flag='-shared'
can_build_shared=yes
;;
gcc)
echo "Huh? how did we get here? - shared test" 1>&6
can_build_shared=yes
;;
*)
can_build_shared=no
echo "Could not identify your Linux compiler - shared libraries will
not be built" 1>&6
;;
esac
;;
*)
can_build_shared=no
echo "Could not identify your compiler - shared libraries will not be
built" 1>&6
;;
esac
fi
I tested this with a modified ltconfig from libtool 1.3.5 and SDL 1.1.6. I
called
configure with "CC=ccc CFLAGS='-fast -arch ev56' ./configure". In my configure
log
I have the shared messages as "yes" and make build a shared library without my
intervention. So it seems to work for me. Please beat on it and see what it
does for you. If this looks good, then I think we can approach the libtool
maintainer and see if we can get this included in the next version.
Alan
_______________________________________________
Axp-list mailing list
Axp-list@redhat.com
https://listman.redhat.com/mailman/listinfo/axp-list
This archive was generated by hypermail version 2a22 on Sat Mar 3 12:54:54 2001 PST
Send any problems or questions about this archive to webmaster@alphalinux.org.