[PATCH] Fix ./configure script for less error-forgiving compilers
Ruslan Ermilov
ru at nginx.com
Tue Mar 6 08:45:03 UTC 2012
On Mon, Mar 05, 2012 at 10:37:31PM +0100, Piotr Sikora wrote:
> --- auto/types/uintptr_t.orig Sun Jul 29 18:24:53 2007
> +++ auto/types/uintptr_t Tue Aug 24 19:38:17 2010
> @@ -14,7 +14,8 @@
> $NGX_INTTYPES_H
>
> int main() {
> - uintptr_t i = 0;
> + uintptr_t i;
> + i = 0;
> return 0;
> }
The way this script is written, -Wall -Werror were not passed
to the compiler. I've fixed this, and it made your change
obviously required.
> --- auto/unix.orig Thu Aug 12 04:33:51 2010
> +++ auto/unix Thu Aug 12 04:34:20 2010
> @@ -82,7 +82,7 @@
> ngx_feature="setproctitle()"
> ngx_feature_name="NGX_HAVE_SETPROCTITLE"
> ngx_feature_run=no
> -ngx_feature_incs=
> +ngx_feature_incs="#include <stdlib.h>"
> ngx_feature_path=
> ngx_feature_libs=$NGX_SETPROCTITLE_LIB
> ngx_feature_test="setproctitle(\"test\");"
setproctitle() is in <unistd.h> on FreeBSD, and the latter
is always included when available. This change isn't needed.
I've also fixed configure errors on Linux when configured
with --with-cc=gcc --with-cc-opt="-Wall -Werror".
-------------- next part --------------
Index: auto/os/linux
===================================================================
--- auto/os/linux (revision 4504)
+++ auto/os/linux (working copy)
@@ -52,7 +52,7 @@
ngx_feature_incs="#include <sys/epoll.h>"
ngx_feature_path=
ngx_feature_libs=
-ngx_feature_test="int efd = 0, fd = 1, n;
+ngx_feature_test="int efd = 0;
struct epoll_event ee;
ee.events = EPOLLIN|EPOLLOUT|EPOLLET;
ee.data.ptr = NULL;
@@ -142,7 +142,7 @@
ngx_feature_path=
ngx_feature_libs=-lcrypt
ngx_feature_test="struct crypt_data cd;
- crypt_r(NULL, NULL, &cd);"
+ crypt_r(\"key\", \"salt\", &cd);"
. auto/feature
Index: auto/unix
===================================================================
--- auto/unix (revision 4504)
+++ auto/unix (working copy)
@@ -237,7 +237,7 @@
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct statfs fs;
- statfs(NULL, &fs);"
+ statfs(\".\", &fs);"
. auto/feature
@@ -249,7 +249,7 @@
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct statvfs fs;
- statvfs(NULL, &fs);"
+ statvfs(\".\", &fs);"
. auto/feature
@@ -585,7 +585,8 @@
ngx_feature="memalign()"
ngx_feature_name="NGX_HAVE_MEMALIGN"
ngx_feature_run=no
-ngx_feature_incs="#include <stdlib.h>"
+ngx_feature_incs="#include <stdlib.h>
+ #include <malloc.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="void *p; p = memalign(4096, 4096)"
Index: auto/types/sizeof
===================================================================
--- auto/types/sizeof (revision 4504)
+++ auto/types/sizeof (working copy)
@@ -20,12 +20,13 @@
#include <sys/time.h>
$NGX_INCLUDE_UNISTD_H
#include <signal.h>
+#include <stdio.h>
#include <sys/resource.h>
$NGX_INCLUDE_INTTYPES_H
$NGX_INCLUDE_AUTO_CONFIG_H
int main() {
- printf("%d", sizeof($ngx_type));
+ printf("%zu", sizeof($ngx_type));
return 0;
}
Index: auto/types/typedef
===================================================================
--- auto/types/typedef (revision 4504)
+++ auto/types/typedef (working copy)
@@ -28,7 +28,8 @@
$NGX_INCLUDE_INTTYPES_H
int main() {
- $ngx_try i = 0;
+ $ngx_try i;
+ i = 0;
return 0;
}
Index: auto/types/uintptr_t
===================================================================
--- auto/types/uintptr_t (revision 4504)
+++ auto/types/uintptr_t (working copy)
@@ -4,8 +4,8 @@
echo $ngx_n "checking for uintptr_t ...$ngx_c"
-echo >> $NGX_ERR
-echo "checking for uintptr_t" >> $NGX_ERR
+echo >> $NGX_AUTOCONF_ERR
+echo "checking for uintptr_t" >> $NGX_AUTOCONF_ERR
found=no
@@ -15,13 +15,17 @@
$NGX_INTTYPES_H
int main() {
- uintptr_t i = 0;
+ uintptr_t i;
+ i = 0;
return 0;
}
END
-eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
+ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT"
+
+eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
echo " uintptr_t found"
More information about the nginx-devel
mailing list