X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=src%2Fos_dbd%2Fdbmake.sh;h=351c0ef7ce6abada658ba66c101406dd9ddf3de1;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=b3cbce33fa0430cde08785f9994d13f7ae71c59c;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b;p=ossec-hids.git diff --git a/src/os_dbd/dbmake.sh b/src/os_dbd/dbmake.sh index b3cbce3..351c0ef 100755 --- a/src/os_dbd/dbmake.sh +++ b/src/os_dbd/dbmake.sh @@ -1,38 +1,34 @@ #!/bin/sh - MI="" ML="" PI="" PL="" - -# Looking for mysql +# Look for MySQL ls "`which mysql 2>/dev/null`" > /dev/null 2>&1 if [ $? = 0 ]; then - - # Checking if mysql_config is installed to use it. + # Check if mysql_config is installed to use it mysql_config --port > /dev/null 2>&1 if [ $? = 0 ]; then MI=`mysql_config --cflags` ML=`mysql_config --libs` - fi + fi - - # Checking on a few dirs if mysql_config is not there. + # Check in a few dirs if mysql_config is perhaps there for i in /usr /usr/local $1 - do + do for j in $i/include/mysql/mysql.h $i/include/mysql.h do - ls $j > /dev/null 2>&1 + ls $j > /dev/null 2>&1 if [ $? = 0 ]; then - if [ "X$MI" = "X" ]; then + if [ "X$MI" = "X" ]; then MI="-I `dirname $j`"; - fi + fi break; fi done - + for j in $i/lib/mysql $i/lib64/mysql do ls $j > /dev/null 2>&1 @@ -41,17 +37,15 @@ if [ $? = 0 ]; then ML="-L $j -lmysqlclient"; fi break - fi + fi done - done + done fi - -# Looking for postgresql +# Look for PostgreSQL ls "`which psql 2>/dev/null`" > /dev/null 2>&1 if [ $? = 0 ]; then - - # Checking if pg_config is installed to use it. + # Check if pg_config is installed to use it pg_config --version > /dev/null 2>&1 if [ $? = 0 ]; then PGID=`pg_config --includedir` @@ -61,20 +55,20 @@ if [ $? = 0 ]; then PI="${PGID} -I${PGPI}" PL="-L${PGLD} -L${PGLI}" fi - + for i in /usr /usr/local /usr/local/pgsql /usr/pgsql /usr/postgresql $1 - do + do for j in $i/include/pgsql/libpq-fe.h $i/include/libpq-fe.h $i/include/postgresql/libpq-fe.h do - ls $j > /dev/null 2>&1 + ls $j > /dev/null 2>&1 if [ $? = 0 ]; then if [ "X$PI" = "X" ]; then PI=`dirname $j`; - fi + fi break; fi done - + for j in $i/lib/pgsql $i/lib/postgresql $i/lib64/pgsql $i/lib64/postgresql do ls $j > /dev/null 2>&1 @@ -84,50 +78,46 @@ if [ $? = 0 ]; then PL="-L$j -L${PG_MAIN}"; fi break - fi + fi done - done + done fi - - - -# Printing error if mysql is not found +# Print error if MySQL is not found if [ "X$MI" = "X" -a "X$ML" = "X" ]; then echo "" >&2 echo "Error: MySQL client libraries not installed." >&2 echo "" >&2 fi -# Printing error if postgresql is not found +# Print error if PostgreSQL is not found if [ "X$PI" = "X" -a "X$PL" = "X" ]; then echo "" >&2 echo "Error: PostgreSQL client libraries not installed." >&2 echo "" >&2 fi - -# Final cflags -- can not be empty. +# Final MySQL CFLAGS if [ "X$MI" = "X" -o "X$ML" = "X" ]; then MYSQL_FINAL="" else echo "Info: Compiled with MySQL support." >&2 - MYSQL_FINAL="$MI $ML -DDBD -DUMYSQL" + MYSQL_FINAL="$MI $ML -DDBD -DUMYSQL" fi -# For postgresql +# Final PostgreSQL CFLAGS if [ "X$PI" = "X" -o "X$PL" = "X" ]; then POSTGRES_FINAL="" else echo "Info: Compiled with PostgreSQL support." >&2 - POSTGRES_FINAL="-I$PI $PL -lpq -DDBD -DUPOSTGRES" + POSTGRES_FINAL="-I$PI $PL -lpq -DDBD -DUPOSTGRES" fi if [ "X${MYSQL_FINAL}" = "X" -a "X${POSTGRES_FINAL}" = "X" ]; then echo "Error: DB libraries not installed." >&2 exit 1; -fi +fi echo "${MYSQL_FINAL} ${POSTGRES_FINAL}"