File: want_mysql.m4

package info (click to toggle)
dovecot 1%3A2.3.21.1%2Bdfsg1-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 58,708 kB
  • sloc: ansic: 562,646; makefile: 7,865; sh: 5,927; cpp: 1,557; perl: 306; python: 255; yacc: 153; xml: 151; lex: 139; pascal: 27
file content (87 lines) | stat: -rw-r--r-- 2,515 bytes parent folder | download | duplicates (3)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
AC_DEFUN([DOVECOT_WANT_MYSQL], [
  have_mysql=no
    AS_IF([test $want_mysql != no],[
    PKG_CHECK_MODULES([MYSQL],[mysqlclient],,[
      AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, mysql_config, NO)
      if test $MYSQL_CONFIG = NO; then
    	# based on code from PHP
    	MYSQL_LIBS="-lmysqlclient -lz -lm"
    	for i in /usr /usr/local /usr/local/mysql; do
    		for j in include include/mysql ""; do
    			if test -r "$i/$j/mysql.h"; then
    				MYSQL_CFLAGS="-I$i/$j"
    			fi
    		done
    		for j in lib lib/mysql lib64 lib64/mysql ""; do
    			if test -f "$i/$j/libmysqlclient.so" || test -f "$i/$j/libmysqlclient.a"; then
    				MYSQL_LIBS="-L$i/$j -lmysqlclient -lz -lm"
    			fi
    		done
    	done
      else
        MYSQL_CFLAGS="`$MYSQL_CONFIG --include`"
        MYSQL_LIBS="`$MYSQL_CONFIG --libs`"
      fi
    ])
  
    old_LIBS=$LIBS
    if test "$MYSQL_LIBS" != ""; then
      LIBS="$LIBS $MYSQL_LIBS"
    fi
  
    mysql_lib=""
    LIBS="$LIBS -lz -lm"
    AC_CHECK_LIB(mysqlclient, mysql_init, [
  		old_CPPFLAGS=$CPPFLAGS
  		if test "$MYSQL_CFLAGS" != ""; then
  			CPPFLAGS="$CPPFLAGS $MYSQL_CFLAGS"
  		fi
  		AC_CHECK_HEADER(mysql.h, [
  			AC_CHECK_LIB(mysqlclient, mysql_ssl_set, [
  				AC_DEFINE(HAVE_MYSQL_SSL,, [Define if your MySQL library has SSL functions])
  				if test "x$have_openssl" = "yes"; then
  				  ssl_define="#define HAVE_OPENSSL"
  				else
  				  ssl_define=""
  				fi
  				AC_TRY_COMPILE([
  				  $ssl_define
  				  #include <mysql.h>
  				], [
				  mysql_ssl_set(0, 0, 0, 0, 0, 0);
  				], [
  					AC_DEFINE(HAVE_MYSQL_SSL_CIPHER,, [Define if your MySQL library supports setting cipher])
  
  					AC_TRY_COMPILE([
  					  $ssl_define
  					  #include <mysql.h>
  					], [
  					  int i = MYSQL_OPT_SSL_VERIFY_SERVER_CERT;
  					], [
  						AC_DEFINE(HAVE_MYSQL_SSL_VERIFY_SERVER_CERT,, [Defineif your MySQL library supports verifying the name in the SSL certificate])
  					])
  				])
  			])
  			
  			have_mysql=yes
  			AC_DEFINE(HAVE_MYSQL,, [Build with MySQL support])
  			found_sql_drivers="$found_sql_drivers mysql"
  		], [
  		  if test $want_mysql = yes; then
  		    AC_ERROR([Can't build with MySQL support: mysql.h not found])
  		  fi
  		])
  		CPPFLAGS=$old_CPPFLAGS
    ], [
      if test $want_mysql = yes; then
        AC_ERROR([Can't build with MySQL support: libmysqlclient not found])
      fi
    ])
  
    if test $have_mysql != yes; then
      MYSQL_LIBS=
      MYSQL_CFLAGS=
    fi
    LIBS=$old_LIBS
  ])
])