diff auto/types/typedef @ 210:00cafae0bdf1

nginx-0.0.1-2003-12-14-23:10:27 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 14 Dec 2003 20:10:27 +0000
parents 11fbd0fc041d
children 1903c6821958
line wrap: on
line diff
--- a/auto/types/typedef
+++ b/auto/types/typedef
@@ -1,45 +1,56 @@
-
-echo "checking for $NGX_TYPE"
 
-FOUND=NO
+echo -n "checking for $ngx_type ..."
+echo >> $NGX_ERR
+echo "checking for $ngx_type" >> $NGX_ERR
 
-for TYPE in $NGX_TYPE $NGX_TYPES
+found=no
+
+for type in $ngx_type $ngx_types
 do
-    echo "#include <sys/types.h>" > autotest.c
-    echo "#include <sys/socket.h>" >> autotest.c
-    echo "#include <sys/time.h>" >> autotest.c
-    echo "#include <sys/resource.h>" >> autotest.c
-    echo "#include <netinet/in.h>" >> autotest.c
-    echo "$NGX_INTTYPES_H" >> autotest.c
-    echo "int main() { $TYPE i = 0; return 0; }" >> autotest.c
+
+    cat << END > $NGX_AUTOTEST.c
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <netinet/in.h>
+$NGX_INTTYPES_H
 
-    eval "$CC -o autotest autotest.c > $NGX_ERR 2>&1"
+int main() {
+    $type i = 0;
+    return 0;
+}
+
+END
 
-    if [ -x autotest ]; then
-        if [ $TYPE = $NGX_TYPE ]; then
-            echo " + $NGX_TYPE found"
-            FOUND=YES
+    eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
+
+    if [ -x $NGX_AUTOTEST ]; then
+        if [ $type = $ngx_type ]; then
+            echo " found"
+            found=yes
         else
-            echo " + $TYPE used"
-            FOUND=$TYPE
+            echo ", $type used"
+            found=$type
         fi
     fi
 
-    rm autotest*
+    rm $NGX_AUTOTEST*
 
-    if [ $FOUND = NO ]; then
-        echo " + $TYPE not found"
+    if [ $found = no ]; then
+        echo -n " $type not found"
     else
         break
     fi
 done
 
-if [ $FOUND = NO ]; then
-    echo "$0: error: can not define $NGX_TYPE"
+if [ $found = no ]; then
+    echo
+    echo "$0: error: can not define $ngx_type"
     exit 1
 fi
 
-if [ $FOUND != YES ]; then
-    echo "typedef $FOUND  $NGX_TYPE;"   >> $NGX_AUTO_CONFIG_H
-    echo                                >> $NGX_AUTO_CONFIG_H
+if [ $found != yes ]; then
+    echo "typedef $found  $ngx_type;"   >> $NGX_AUTO_CONFIG_H
 fi