1 #Copyright (c) Brian B.
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 3 of the License, or (at your option) any later version.
7 # See the file LICENSE included with this distribution for more
9 rule -configure-options-help- {
10 Echo "jam configure supports" ;
11 Echo " --prefix=dir [/usr/local]" ;
12 Echo " --debug build with debug symbols" ;
13 Echo " --multiarch multiarch support" ;
14 Echo " --shared build with shared library" ;
18 rule -configure-options-debug- {
22 rule -configure-options-multiarch- {
26 rule -configure-test-gmp- {
28 -configure-test-compile-cc- "libgmp" :
32 "mpz_init_set_str(x, "1234567", 10);"
39 # $(1) -- program, string list
40 # $(2) -- additional compiler flags (optional)
41 # $(3) -- additional linker flags (optional)
42 rule -configure-try-exec-cc- {
46 local tfn = [ RandName ] ;
48 if [ ListWrite $(tfn) : $(1) ] {
49 rc = [ Command $(CC) -c $(tfn:Q) -o $(tfn:S=.o:Q) $(2) '2>/dev/null' : exit-code no-output ] ;
51 rc = [ Command $(LINK) $(tfn:S=.o:Q) -o $(tfn:S=.elf:Q) $(3) '2>/dev/null' : exit-code no-output ] ;
53 res = [ Command $(tfn:S=.elf:Q) : parse-output no-space-break no-tab-break no-cr-break ] ;
56 Command rm $(tfn:Q) $(tfn:S=.o:Q) $(tfn:S=.elf:Q) '2>/dev/null' ;
63 # $(2) -- program, string list
64 # $(3) -- additional compiler flags (optional)
65 # $(4) -- additional linker flags (optional)
66 rule -configure-test-exec-cc- {
68 Echo 'generate code for' $(1) '... ' : -n ;
69 r = [ -configure-try-exec-cc- $(2) : $(3) : $(4) ] ;
71 if ( $(r) = "-D__m32__" ) {
73 } else if ( $(r) = "-D__m64__" ) {
83 rule -configure-test-arch- {
85 -configure-test-exec-cc- "" :
88 "switch (sizeof(void*)) {"
89 "case 4: printf(\"-D__m32__\"); break;"
90 "case 8: printf(\"-D__m64__\"); break;"
100 PREFIX = /usr/local ;
102 local arch = [ -configure-test-arch- ] ;
105 if ( $(arch) = '-D__m32__' ) {
106 ARCH_LIB = "/i386-linux-gnu" ;
108 ARCH_LIB = "/x86_64-linux-gnu" ;
111 if ( $(arch) = '-D__m32__' ) {
112 ARCH_LIB = "/powerpc-aix-ibm" ;
114 ARCH_LIB = "/powerpc64-aix-ibm" ;
121 Exit "Architecture not supported" ;
124 local pl = [ Command "echo $(ARCH_LIB) | sed \"s/\\//\\\\\\\\\\\//g\"" : dummy ] ;
125 -configure-add-line- "ARCH_LIB = $(ARCH_LIB) ;" ;
126 -configure-pkg-config-necessary-
129 local pp = [ Command "echo $(PREFIX) | sed \"s/\\//\\\\\\\\\\\//g\"" : dummy ] ;
130 if [ -configure-test-gmp- ] == 1 {
131 -configure-add-line- "CFLAGS.all += -DHAVE_GMP ;" ;
132 -configure-add-line- "LINKLIBS.all += -lgmp ;" ;
134 Command "sed -e \"s/@prefix/\\$(pp)/\" -e \"s/@cflags/-DHAVE_GMP/\" -e \"s/@arch_lib/\\$(pl)/g\" -e \"s/@ldflags/-lgmp/g\" ./libpgcli.pc.in > ./libpgcli.pc" ;
136 Command "sed -e \"s/@prefix/\\$(pp)/\" -e \"s/@cflags/-DHAVE_GMP/\" -e \"s/@arch_lib//g\" -e \"s/@ldflags/-lgmp/g\" ./libpgcli.pc.in > ./libpgcli.pc" ;
140 Command "sed -e \"s/@prefix/\\$(pp)/\" -e \"s/@cflags//\" -e \"s/@arch_lib/\\$(pl)/g\" -e \"s/@ldflags//g\" ./libpgcli.pc.in > ./libpgcli.pc" ;
142 Command "sed -e \"s/@prefix/\\$(pp)/\" -e \"s/@cflags//\" -e \"s/@arch_lib//g\" -e \"s/@ldflags//g\" ./libpgcli.pc.in > ./libpgcli.pc" ;
147 -configure-add-line- "CFLAGS.all += -O0 -g3 ;" ;
149 -configure-add-line- "CFLAGS.all += -O0 -g ;" ;
152 -configure-add-line- "set-profile ;" ;
154 -configure-add-line- "BUILDDEBUG =" "$(BUILDDEBUG)" ";" ;
155 -configure-add-line- "MULTIARCH =" "$(MULTIARCH)" ";" ;
158 rule -configure-preinit- {