IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9802


Ignore:
Timestamp:
Oct 30, 2006, 6:36:19 PM (20 years ago)
Author:
jhoblitt
Message:

move mysql probling into it's only .m4 file

Location:
trunk/psLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/configure.ac

    r9800 r9802  
    115115dnl ----------------- MYSQL options --------------------
    116116
    117 dnl save LIBS/CFLAGS/LDFLAGS
    118 TMP_LIBS=${LIBS}
    119 TMP_CFLAGS=${CFLAGS}
    120 TMP_LDFLAGS=${LDFLAGS}
    121 TMP_CPPFLAGS=${CPPFLAGS}
    122 
    123 AC_ARG_ENABLE(mysql,
    124  [AS_HELP_STRING(--disable-mysql,Disable MySQL functionality)],
    125  [MYSQL_REQ=$enableval],
    126  [MYSQL_REQ="yes"])
    127 
    128 if test "$MYSQL_REQ" == "yes"
    129 then
    130   AC_MSG_RESULT([enable building MySQL functionality])
    131   AC_ARG_WITH(mysql_config,
    132     [AS_HELP_STRING(--with-mysql_config=FILE,Specify location of MYSQL configuration script.)],
    133     [MYSQL_CONFIG=$withval],
    134     [MYSQL_CONFIG=`which mysql_config`])
    135   AC_CHECK_FILE($MYSQL_CONFIG,[],
    136     [AC_MSG_ERROR([MYSQL 4.1.2 or newer is required.  http://www.mysql.com or use --with-mysql_config to specify location of ocnfiguration script.])])
    137 
    138   AC_MSG_CHECKING([MySQL cflags])
    139   MYSQL_CFLAGS="`${MYSQL_CONFIG} --include`"
    140   PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${MYSQL_CFLAGS}"
    141   AC_MSG_RESULT([${MYSQL_CFLAGS}])
    142 
    143   AC_MSG_CHECKING([MySQL link options])
    144   MYSQL_LIBS="`${MYSQL_CONFIG} --libs`"
    145   PSLIB_LIBS="${PSLIB_LIBS=} ${MYSQL_LIBS}"
    146   AC_MSG_RESULT([${MYSQL_LIBS}])
    147   AC_SUBST(TST_PSDB,"tst_psDB") dnl enable the test for psDB
    148 
    149 dnl AC_RUN_IFELSE() uses CFLAGS to find mysql_version.h
    150   CFLAGS="${CFLAGS} ${MYSQL_CFLAGS}"
    151   AC_RUN_IFELSE([AC_LANG_PROGRAM(
    152 [[#include <stdlib.h>
    153 #include <stdio.h>
    154 #include <mysql_version.h>
    155 ]],[[int v=MYSQL_VERSION_ID;
    156     if (v < 40102) {
    157     exit(1);
    158     } else {
    159     exit(0);
    160     }
    161 ]])], [], [AC_MSG_ERROR([MySQL 4.1.2 or newer is required.  Obtain it at  http://www.mysql.com or use --with-mysql to specify location.])])
    162 else
    163   PSLIB_CFLAGS="${PSLIB_CFLAGS=} -DOMIT_PSDB"
    164   AC_MSG_RESULT([disable building MySQL functionality])
    165 fi
    166 
    167 AC_SUBST([MYSQL_CFLAGS])
    168 
    169 dnl restore the CFLAGS/LDFLAGS
    170 LIBS=${TMP_LIBS}
    171 CFLAGS=${TMP_CFLAGS}
    172 LDFLAGS=${TMP_LDFLAGS}
    173 CPPFLAGS=${TMP_CPPFLAGS}
     117AX_LIB_MYSQL([4.1.2], [
     118    PSLIB_CFLAGS="${PSLIB_CFLAGS=} ${MYSQL_CFLAGS}"
     119    PSLIB_LIBS="${PSLIB_LIBS=} ${MYSQL_LIBS}"
     120  ], [
     121    PSLIB_CFLAGS="${PSLIB_CFLAGS=} -DOMIT_PSDB"
     122  ]
     123)
    174124
    175125dnl ----------------- CFITSIO options --------------------
  • trunk/psLib/m4/ax_lib_mysql.m4

    r9801 r9802  
    33# SYNOPSIS
    44#
    5 #   AX_LIB_MYSQL([MINIMUM-VERSION])
     5#   AX_LIB_MYSQL([MINIMUM-VERSION[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]])
    66#
    77# DESCRIPTION
     
    146146    AC_SUBST([MYSQL_CFLAGS])
    147147    AC_SUBST([MYSQL_LDFLAGS])
    148 ])
     148
     149dnl Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
     150if test "$mysql_version_check" = "1"; then
     151    $2
     152    :
     153else
     154    $3
     155    :
     156fi
     157
     158]) dnl ax_lib_mysql
Note: See TracChangeset for help on using the changeset viewer.