Use of $(THREAD_CFLAGS) in CPPFLAGS

Started by Bruce Momjianover 22 years ago5 messageshackers
Jump to latest
#1Bruce Momjian
bruce@momjian.us

I just noticed that libpq/ecpg use $(THREAD_CFLAGS) as part of CPPFLAGS.
(I added that code.)

Is that correct? Should it be added to CFLAGS instead?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: Use of $(THREAD_CFLAGS) in CPPFLAGS

Bruce Momjian <pgman@candle.pha.pa.us> writes:

I just noticed that libpq/ecpg use $(THREAD_CFLAGS) as part of CPPFLAGS.
Is that correct? Should it be added to CFLAGS instead?

I was just noticing that today. THREAD_CFLAGS typically includes -D
flags, and as such it *must* be added to CPPFLAGS --- it'd be incorrect
to add it to CFLAGS. Possibly we should rename THREAD_CFLAGS to
THREAD_CPPFLAGS. I'm not sure that we have any platforms for which it
would be useful to invent both THREAD_CPPFLAGS and THREAD_CFLAGS.

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: Use of $(THREAD_CFLAGS) in CPPFLAGS

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

I just noticed that libpq/ecpg use $(THREAD_CFLAGS) as part of CPPFLAGS.
Is that correct? Should it be added to CFLAGS instead?

I was just noticing that today. THREAD_CFLAGS typically includes -D
flags, and as such it *must* be added to CPPFLAGS --- it'd be incorrect
to add it to CFLAGS. Possibly we should rename THREAD_CFLAGS to
THREAD_CPPFLAGS. I'm not sure that we have any platforms for which it
would be useful to invent both THREAD_CPPFLAGS and THREAD_CFLAGS.

Actually, the most common THREAD_CFLAGS is -pthread, used by Solaris,
OSF, and FreeBSD 4.X. Only Linux uses -D flags for threading.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#3)
Re: Use of $(THREAD_CFLAGS) in CPPFLAGS

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Actually, the most common THREAD_CFLAGS is -pthread, used by Solaris,
OSF, and FreeBSD 4.X. Only Linux uses -D flags for threading.

So is -pthread a compile-time or link-time flag?

If we need both THREAD_CPPFLAGS and THREAD_CFLAGS then let's go ahead
and invent both.

regards, tom lane

#5Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#4)
Re: Use of $(THREAD_CFLAGS) in CPPFLAGS

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Actually, the most common THREAD_CFLAGS is -pthread, used by Solaris,
OSF, and FreeBSD 4.X. Only Linux uses -D flags for threading.

So is -pthread a compile-time or link-time flag?

If we need both THREAD_CPPFLAGS and THREAD_CFLAGS then let's go ahead
and invent both.

I just did a 'man gcc' on our PostgreSQL FreeBSD server and read:

-pthread
Link a user-threaded process against libc_r instead of libc. Ob-
jects linked into user-threaded processes should be compiled
with -D_THREAD_SAFE.

so it seems it is a link flag, and they have a compile flag no one told
me about. I already have it configured as a compile flag. Let me fix
that. I am working on the thread test program so I will commit it all
at once.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073