summaryrefslogtreecommitdiff
path: root/m4/mysql.m4
blob: 78de05636c07057432d4a5b810d2ce7cdaf4992f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Configure paths for mysql
# Nicolas Noble 2002-12-06
# stolen from Sam Lantinga
# stolen from Manish Singh
# stolen back from Frank Belew
# stolen from Manish Singh
# Shamelessly stolen from Owen Taylor

dnl AM_PATH_SDL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for mysql, and define MYSQL_CFLAGS and MYSQL_LIBS
dnl
AC_DEFUN(AM_PATH_MYSQL,
[dnl 
dnl Get the cflags and libraries from the mysql-config script
dnl
AC_ARG_WITH(mysql-prefix,[  --with-mysql-prefix=PFX Prefix where mysql is installed (optional)],
            mysql_prefix="$withval", mysql_prefix="")
AC_ARG_WITH(mysql-exec-prefix,[  --with-mysql-exec-prefix=PFX Exec prefix where mysql is installed (optional)],
            mysql_exec_prefix="$withval", mysql_exec_prefix="")

  if test x$mysql_exec_prefix != x ; then
     mysql_args="$mysql_args --exec-prefix=$mysql_exec_prefix"
     if test x${MYSQL_CONFIG+set} != xset ; then
        MYSQL_CONFIG=$mysql_exec_prefix/bin/mysql_config
     fi
  fi
  if test x$mysql_prefix != x ; then
     mysql_args="$mysql_args --prefix=$mysql_prefix"
     if test x${MYSQL_CONFIG+set} != xset ; then
        MYSQL_CONFIG=$mysql_prefix/bin/mysql_config
     fi
  fi

  PATH="$prefix/bin:$prefix/usr/bin:$PATH"
  AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no, [$PATH])
  no_mysql=""
  if test "$MYSQL_CONFIG" = "no" ; then
    no_mysql=yes
  else
    MYSQL_CFLAGS=`$MYSQL_CONFIG $mysqlconf_args --cflags`
    MYSQL_LIBS=`$MYSQL_CONFIG $mysqlconf_args --libs`
  fi

  if test "x$no_mysql" = x ; then
     ifelse([$1], , :, [$1])     
  else
     MYSQL_CFLAGS=""
     MYSQL_LIBS=""
     ifelse([$2], , :, [$2])
  fi
  AC_SUBST(MYSQL_CFLAGS)
  AC_SUBST(MYSQL_LIBS)
])