Custom options for building extensions with --with--llvm - Mailing list pgsql-hackers

From Konstantin Knizhnik
Subject Custom options for building extensions with --with--llvm
Date
Msg-id 9373f6b4-90d0-54ef-2be7-73b12476beee@postgrespro.ru
Whole thread Raw
Responses Re: Custom options for building extensions with --with--llvm  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

In my extension I want to define some custom options for compiler.
I do it in the following way:

ifdef USE_DISK
CUSTOM_COPT += -DIMCS_DISK_SUPPORT
endif


So if I want to enable disk support, I am building my extension as

make USE_DISK=1 clean all install

and it normally works... unless Postgres is built with --enable-llvm.
In this case it tries to build llvm code using clang and is not using 
CUSTOM_COPTS:

gcc -Wall -Wmissing-prototypes -Wpointer-arith 
-Wdeclaration-after-statement -Werror=vla -Wendif-labels 
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing 
-fwrapv -fexcess-precision=standard -g -O3 -Wall -pthread 
-DIMCS_DISK_SUPPORT -fPIC -I. -I. -I../../src/include -D_GNU_SOURCE   -c 
-o disk.o disk.c

vs.

/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  
-I. -I. -I../../src/include  -D_GNU_SOURCE  -flto=thin -emit-llvm -c -o 
disk.bc disk.c


I wonder is there any way to pass custom compile options to clang?
Thanks in advance,

-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Report error position in partition bound check
Next
From: Heikki Linnakangas
Date:
Subject: Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2