]> git.stg.codes - stg.git/blobdiff - projects/sgconv/build
Added common functions for tests.
[stg.git] / projects / sgconv / build
index 7e430be2fe4f8438b3ad727862d1b8d5f2649628..5ceb4013f2cd6fc7e78d6076a57ffc2167e90933 100755 (executable)
@@ -21,6 +21,7 @@ if [ "$1" = "debug" ]
 then
    DEFS="$DEFS -DDEBUG"
    MAKEOPTS="$MAKEOPTS -j1"
 then
    DEFS="$DEFS -DDEBUG"
    MAKEOPTS="$MAKEOPTS -j1"
+   CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
    CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
    DEBUG="yes"
 else
    CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
    DEBUG="yes"
 else
@@ -28,6 +29,7 @@ else
    DEBUG="no"
 fi
 
    DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -ggdb3 -W -Wall -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
@@ -45,15 +47,20 @@ then
         5) OS=bsd5;;
         6) OS=bsd5;;
         7) OS=bsd7;;
         5) OS=bsd5;;
         6) OS=bsd5;;
         7) OS=bsd7;;
-        8) OS=bsd7;;
-        9) OS=bsd7;;
-        *) OS=unknown;;
+        *) OS=bsd7;;
     esac
     MAKE="gmake"
 fi
 
     esac
     MAKE="gmake"
 fi
 
+if [ "$sys" = "Darwin" ]
+then
+    OS=darwin
+    ETC_DIR="./inst/freebsd/etc/stargazer"
+    MAKE="gmake"
+fi
+
 if [ "$OS" = "unknown" ]
 if [ "$OS" = "unknown" ]
-then 
+then
     printf "#############################################################################\n"
     printf "# Sorry, but sgconv currently supported by Linux, FreeBSD 4.x, 5.x, 6.x     #\n"
     printf "#############################################################################\n"
     printf "#############################################################################\n"
     printf "# Sorry, but sgconv currently supported by Linux, FreeBSD 4.x, 5.x, 6.x     #\n"
     printf "#############################################################################\n"
@@ -64,12 +71,12 @@ printf "########################################################################
 printf "       Building sgconv for $sys $release\n"
 printf "#############################################################################\n"
 
 printf "       Building sgconv for $sys $release\n"
 printf "#############################################################################\n"
 
-STG_LIBS="logger.lib 
+STG_LIBS="logger.lib
           locker.lib
           locker.lib
-         crypto.lib 
-         common.lib 
-         conffiles.lib
-         dotconfpp.lib"
+          crypto.lib
+          common.lib
+          conffiles.lib
+          dotconfpp.lib"
 
 PLUGINS="store/files"
 
 
 PLUGINS="store/files"
 
@@ -83,12 +90,18 @@ else
         DEFS="$DEFS -DFREE_BSD"
         LIB_THREAD=-lc_r
     else
         DEFS="$DEFS -DFREE_BSD"
         LIB_THREAD=-lc_r
     else
-        DEFS="$DEFS -DFREE_BSD5"
         if [ "$OS" = "bsd7" ]
         then
         if [ "$OS" = "bsd7" ]
         then
+            DEFS="$DEFS -DFREE_BSD5"
             LIB_THREAD=-lpthread
         else
             LIB_THREAD=-lpthread
         else
-            LIB_THREAD=-lc_r
+            if [ "$OS" == "darwin" ]
+            then
+                DEFS="$DEFS -DDARWIN"
+                LIB_THREAD=-lpthread
+            else
+                LIB_THREAD=-lc_r
+            fi
         fi
     fi
 fi
         fi
     fi
 fi
@@ -160,6 +173,7 @@ fi
 rm -f fake
 
 printf "Checking for mysql_config... "
 rm -f fake
 
 printf "Checking for mysql_config... "
+printf "#include <mysql.h>\nint main() { return 0; }\n" > build_check.c
 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
 MYSQL_VERSION=`mysql_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
@@ -199,6 +213,7 @@ else
 fi
 
 printf "Checking for pg_config... "
 fi
 
 printf "Checking for pg_config... "
+printf "#include <libpq-fe.h>\nint main() { return 0; }\n" > build_check.c
 PG_VERSION=`pg_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
 PG_VERSION=`pg_config --version 2> /dev/null`
 if [ $? != 0 ]
 then
@@ -296,5 +311,9 @@ printf "VAR_DIR=$VAR_DIR\n" >> $CONFFILE
 
 mkdir -p ../stargazer/modules
 
 
 mkdir -p ../stargazer/modules
 
-$MAKE $MAKEOPTS
-
+if [ "$1" != "debug" ]
+then
+    $MAKE $MAKEOPTS
+else
+    printf "\n\n\nDebug build. Type $MAKE explicitly\n"
+fi