From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.redhat.com (mail.redhat.com [199.183.24.239]) by listman.redhat.com (Postfix) with ESMTP id 2FE452F101 for ; Thu, 4 Jan 2001 02:50:19 -0500 (EST) Received: (from mail@localhost) by mail.redhat.com (8.11.0/8.8.7) id f047oJ126988 for axp-list@listman.redhat.com; Thu, 4 Jan 2001 02:50:19 -0500 Received: from relay1.teleport.com (relay1.teleport.com [192.108.254.28]) by mail.redhat.com (8.11.0/8.8.7) with SMTP id f047oID26984 for ; Thu, 4 Jan 2001 02:50:18 -0500 Received: (qmail 6536 invoked by uid 5); 4 Jan 2001 07:50:16 -0000 Received: from evrtwa1-ar4-233-089.dsl.gtei.net(4.41.233.89), claiming to be "teleport.com" via SMTP by relay1.teleport.com, id smtpdAAA0FXjik; Wed Jan 3 23:50:11 2001 Message-ID: <3A542B4D.1FC96EB7@teleport.com> Date: Wed, 03 Jan 2001 23:50:37 -0800 From: Alan Young X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.18 alpha) X-Accept-Language: en, en-US, en-GB MIME-Version: 1.0 To: axp-list@redhat.com, Peter Petrakis Subject: Re: stopping ./configure from choking on use of ccc/cxx (LONG) References: <3A528EA6.DE1AED22@alphalinux.org> <3A52FC64.14001F04@teleport.com> <3A53199A.349C120@alphalinux.org> <3A5377D0.E018D46E@teleport.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0beta4 Precedence: bulk Reply-To: axp-list@redhat.com List-Id: Linux and Red Hat on Alpha processors 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