开发者

autoconf with -pthread

开发者 https://www.devze.com 2022-12-11 08:54 出处:网络
Greetings. I am trying to create an autoconf configure script that automatically checks for which pthread option to use and, ideally, specifies -pthread when compiling with gcc.

Greetings. I am trying to create an autoconf configure script that automatically checks for which pthread option to use and, ideally, specifies -pthread when compiling with gcc.

It was my hope that AX_PTHREAD would work, but neither seems to work on MacOS 10.6.

I'm using AX_PTHREAD from http://www.nongnu.org/autoconf-archive/ax_pthread.html

For reasons that I do not understand, it just doesn't use the -pthread option for scripts build on a mac.

The problem seems to be that "none" is compiling without error, and as a result the other threads in the ax_pthread_flags variable aren't being checked.

So I've moved the -pthread case before the "none" case and added this case to the case statement:

        -pthread)
        PTHREAD_CFLAGS="-pthread"
        PTHREAD_LIBS="-pthread"
        ;;

This seems to work, but I am not sure if it will work with non-GCC compilers. And I'm not even sure if I should care.

Equally annoying is the fact that the AX_PTHREAD macro only upda开发者_高级运维tes CFLAGS, not CPPFLAGS.

Is there a better way to test for the -pthread option using autoconf?


PostgreSQL has a hacked version of AX_PTHREAD that addresses some problems: http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/config/acx_pthread.m4 . PostgreSQL builds on Mac OS X, so give it a try perhaps.

0

精彩评论

暂无评论...
验证码 换一张
取 消