Skip to content

Commit b7e7398

Browse files
committed
now the --with-cc=CC option of ./configure also controls the C compiler used by Lua and LuaJIT. thanks @姜大炮 for reporting the issue; also released ngx_openresty 1.0.4.1rc3.
1 parent 68aac43 commit b7e7398

File tree

3 files changed

+76
-9
lines changed

3 files changed

+76
-9
lines changed

t/sanity.t

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ The http_drizzle_module is not enabled while --with-libdrizzle is specified.
871871
--- exit: 255
872872
873873
874+
874875
=== TEST 16: ngx_drizzle enabled and --with-libdrizzle is specified
875876
--- cmd: ./configure --with-libdrizzle=/opt/drizzle --with-http_drizzle_module --dry-run
876877
--- out
@@ -921,3 +922,50 @@ install:
921922
clean:
922923
rm -rf build
923924
925+
926+
927+
=== TEST 17: --with-cc
928+
--- cmd: ./configure --with-cc=gcc-4.2 --dry-run --platform=solaris
929+
--- out
930+
platform: solaris (solaris)
931+
cp -rp bundle/ build/
932+
cd build
933+
cd lua-5.1.4
934+
make CC=gcc-4.2 solaris
935+
make install CC=gcc-4.2 INSTALL_TOP=$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua
936+
export LUA_LIB='$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/lib'
937+
export LUA_INC='$OPENRESTY_BUILD_DIR/lua-root/usr/local/openresty/lua/include'
938+
cd ..
939+
cd nginx-1.0.4
940+
./configure --prefix=/usr/local/openresty/nginx \
941+
--add-module=../echo-nginx-module-0.37rc1 \
942+
--add-module=../xss-nginx-module-0.03rc3 \
943+
--add-module=../ngx_devel_kit-0.2.17 \
944+
--add-module=../set-misc-nginx-module-0.21 \
945+
--add-module=../form-input-nginx-module-0.07rc4 \
946+
--add-module=../encrypted-session-nginx-module-0.01 \
947+
--add-module=../ngx_lua-0.2.1rc2 \
948+
--add-module=../headers-more-nginx-module-0.15 \
949+
--add-module=../srcache-nginx-module-0.12 \
950+
--add-module=../array-var-nginx-module-0.02 \
951+
--add-module=../memc-nginx-module-0.12 \
952+
--add-module=../redis2-nginx-module-0.07 \
953+
--add-module=../upstream-keepalive-nginx-module-0.3 \
954+
--add-module=../auth-request-nginx-module-0.2 \
955+
--add-module=../rds-json-nginx-module-0.12rc1 \
956+
--with-cc=gcc-4.2 --with-http_ssl_module
957+
cd ../..
958+
--- makefile
959+
.PHONY: all install clean
960+
961+
all:
962+
cd build/lua-5.1.4 && $(MAKE) CC=gcc-4.2 solaris
963+
cd build/nginx-1.0.4 && $(MAKE)
964+
965+
install:
966+
cd build/lua-5.1.4 && $(MAKE) install CC=gcc-4.2 INSTALL_TOP=$(DESTDIR)/usr/local/openresty/lua
967+
cd build/nginx-1.0.4 && $(MAKE) install DESTDIR=$(DESTDIR)
968+
969+
clean:
970+
rm -rf build
971+

util/configure

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,19 @@ my $prefix = '/usr/local/openresty';
105105
my %resty_opts;
106106
my $dry_run;
107107
my @ngx_rpaths;
108+
my $cc;
108109

109110
my (@ngx_opts, @ngx_cc_opts, @ngx_ld_opts);
110111

111112
for my $opt (@ARGV) {
112113
next unless defined $opt;
113114

115+
if ($opt =~ /^--with-cc=(.+)/) {
116+
$cc = $1;
117+
push @ngx_opts, $opt;
118+
next;
119+
}
120+
114121
if ($opt eq '--dry-run') {
115122
$dry_run = 1;
116123
next;
@@ -317,14 +324,21 @@ sub build_resty_opts {
317324

318325
cd $luajit_src;
319326

320-
shell "make PREFIX=$luajit_prefix", $dry_run;
321-
shell "make install PREFIX=$luajit_prefix DESTDIR=$luajit_root", $dry_run;
327+
my $extra_opts = '';
328+
329+
if (defined $cc) {
330+
$extra_opts .= " CC=$cc";
331+
}
332+
333+
shell "make$extra_opts PREFIX=$luajit_prefix", $dry_run;
334+
335+
shell "make install$extra_opts PREFIX=$luajit_prefix DESTDIR=$luajit_root", $dry_run;
322336

323337
push @make_cmds, "cd build/$luajit_src && "
324-
. "\$(MAKE) PREFIX=$luajit_prefix";
338+
. "\$(MAKE)$extra_opts PREFIX=$luajit_prefix";
325339

326340
push @make_install_cmds, "cd build/$luajit_src && "
327-
. "\$(MAKE) install PREFIX=$luajit_prefix DESTDIR=\$(DESTDIR)";
341+
. "\$(MAKE) install$extra_opts PREFIX=$luajit_prefix DESTDIR=\$(DESTDIR)";
328342

329343
env LUAJIT_LIB => "$luajit_root$luajit_prefix/lib";
330344
env LUAJIT_INC => "$luajit_root$luajit_prefix/include/luajit-2.0";
@@ -354,16 +368,21 @@ sub build_resty_opts {
354368

355369
cd $lua_src;
356370

357-
shell "make $platform", $dry_run;
358-
shell "make install INSTALL_TOP=$lua_root$lua_prefix", $dry_run;
371+
my $extra_opts = '';
372+
if (defined $cc) {
373+
$extra_opts .= " CC=$cc";
374+
}
375+
376+
shell "make$extra_opts $platform", $dry_run;
377+
shell "make install$extra_opts INSTALL_TOP=$lua_root$lua_prefix", $dry_run;
359378

360379
env LUA_LIB => "$lua_root$lua_prefix/lib";
361380
env LUA_INC => "$lua_root$lua_prefix/include";
362381

363-
push @make_cmds, "cd build/$lua_src && \$(MAKE) $platform";
382+
push @make_cmds, "cd build/$lua_src && \$(MAKE)$extra_opts $platform";
364383

365384
push @make_install_cmds, "cd build/$lua_src && "
366-
. "\$(MAKE) install INSTALL_TOP=\$(DESTDIR)$lua_prefix";
385+
. "\$(MAKE) install$extra_opts INSTALL_TOP=\$(DESTDIR)$lua_prefix";
367386

368387
cd '..';
369388
}

util/ver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
main_ver=1.0.4
4-
minor_ver=1rc2
4+
minor_ver=1rc3
55
version=$main_ver.$minor_ver
66
echo $version
77

0 commit comments

Comments
 (0)