Ok, here it is. This patch changes AC_LIBTOOL_PROG_COMPILER_PIC so that it only appends -DPIC to the default "C" tag and the CXX tag for C++. I would also like to deprecate -DPIC in the 1.5 release to make it clear we intend to do away with it. I would also like to ask anyone who does depend on this to let us know when/where/why & how so we can add a section to the documentation on how to modify code to not need -DPIC.
Here is a sample of before & after the patch is applied: before: [rbo@lucifer ~/libtool]$ ./libtool --tag=C --config | grep pic_flag= libtool: ignoring unknown tag C pic_flag=" -fPIC -DPIC" [rbo@lucifer ~/libtool]$ ./libtool --tag=GCJ --config | grep pic_flag= pic_flag=" -fPIC -DPIC" pic_flag=" -fPIC" [rbo@lucifer ~/libtool]$ ./libtool --tag=F77 --config | grep pic_flag= pic_flag=" -fPIC -DPIC" pic_flag=" -DPIC" [rbo@lucifer ~/libtool]$ ./libtool --tag=CXX --config | grep pic_flag= pic_flag=" -fPIC -DPIC" pic_flag=" -fPIC -DPIC" after: [rbo@lucifer ~/libtool]$ ./libtool --config | grep pic_flag= pic_flag=" -fPIC -DPIC" [rbo@lucifer ~/libtool]$ ./libtool --tag=CXX --config | grep pic_flag= pic_flag=" -fPIC -DPIC" pic_flag=" -fPIC -DPIC" [rbo@lucifer ~/libtool]$ ./libtool --tag=GCJ --config | grep pic_flag= pic_flag=" -fPIC -DPIC" pic_flag=" -fPIC" [rbo@lucifer ~/libtool]$ ./libtool --tag=F77 --config | grep pic_flag= pic_flag=" -fPIC -DPIC" pic_flag="" ChangeLog entry: 2003-01-15 Robert Boehne <[EMAIL PROTECTED]> * libtool.m4 (AC_LIBTOOL_PROG_COMPILER_PIC): Don't add -DPIC for languages other than C and C++. Simon Richter wrote: > > Robert, > > > I think you can ignore inline assembler for anything other than > > C (including C++). I've never thought about it, but inline assembler > > in Fortran code sounds truly frightening! Anyway, if it was so > > important, why doesn't the compiler define it for you? > > Current gcc defines __PIC__ and __pic__ if -fPIC or -fpic is used (this > is defined in the specs file), and actually this is the right way to do > it, but I fear that people are still using #ifdef PIC because they have > seen it defined on the command line and are not aware of __PIC__. > > What would be needed is a good transition plan. For example, the > libtoolize command could list the incompatible changes since the last > version. > > Simon > > -- > GPG Fingerprint: 040E B5F7 84F1 4FBC CEAD ADC6 18A0 CC8D 5706 A4B4 > > ------------------------------------------------------------------------ > Part 1.1.2Type: application/pgp-signature > > ------------------------------------------------------------------------ > _______________________________________________ > Libtool mailing list > [EMAIL PROTECTED] > http://mail.gnu.org/mailman/listinfo/libtool
Index: libtool.m4 =================================================================== RCS file: /cvsroot/libtool/libtool/libtool.m4,v retrieving revision 1.290 diff -u -r1.290 libtool.m4 --- libtool.m4 15 Jan 2003 02:55:33 -0000 1.290 +++ libtool.m4 16 Jan 2003 03:47:07 -0000 @@ -4758,7 +4758,7 @@ if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[GCJ],[],[ -DPIC])], [], + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ +-DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; @@ -4772,7 +4772,7 @@ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[GCJ],[],[ -DPIC])" + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, +$1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" ;; esac ])
_______________________________________________ Libtool mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/libtool