On Tue, 3 Jan 2006, Steven Woody wrote:

on linux, simplly adding a '-pthread' option to the command line gcc, i can
make a multi-thread c program. but if using automake, i only got many
undefined reference to pthread_xxx errors. i've already add the '-pthread'
to the myprogram_CFLAGS variable.

The '-pthread' option is a non-standard compiler extension which causes different pre-processor definitions to be applied, and different/additional libraries to be applied. You should not assume that other compilers/platforms work with '-pthread'. So if you insert it into myprogram_CFLAGS then your package will only work if the compiler supports the '-pthread' option.

Note that CFLAGS is only applied when compiling. The LDFLAGS value is used while linking so if you want to use '-pthread' then you should supply it for both CFLAGS and LDFLAGS.

The Autoconf macro archive includes a macro for determining the correct options to use in a platform-independent way.

Bob
======================================
Bob Friesenhahn
[EMAIL PROTECTED], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


Reply via email to