File: configure.ac

package info (click to toggle)
stardict-tools 3.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,848 kB
  • sloc: cpp: 17,404; sh: 10,701; ansic: 1,985; python: 950; php: 308; makefile: 251; perl: 135
file content (141 lines) | stat: -rw-r--r-- 2,957 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(stardict-tools, 3.0.2, http://stardict.sourceforge.net)
AC_CONFIG_SRCDIR([src/stardict-editor.cpp])
AM_INIT_AUTOMAKE([dist-bzip2])
AC_CONFIG_HEADERS([config.h])
AH_BOTTOM([#include <config-custom.h>])

AC_CONFIG_MACRO_DIR([m4])
LT_INIT

AC_DEFUN([AC_FIND_FILE],
[
	$3=NO
	for x in $2
	do
		for y in $1
		do
			if test -r "$x/$y"
			then
				$3=$x
				break 2
			fi
		done
	done
]
)

# Checks for programs.
AC_PROG_CC
AC_PROG_CXX

# Checks for libraries.

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])

# mysql.h
MYSQLFOUND=NO
AC_CHECK_HEADER([mysql.h],
	[
		MYSQL_CFLAGS=
		MYSQLFOUND=YES
	],
	[], []
)
if test x$MYSQLFOUND = xNO; then
	AC_FIND_FILE([mysql.h],
		[/usr/local/mysql/include /usr/include/mysql /usr/local/include/mysql],
		[MYSQLINCDIR])
	if test x$MYSQLINCDIR != xNO; then
		AC_CHECK_HEADER([$MYSQLINCDIR/mysql.h],
			[
				MYSQL_CFLAGS="-I${MYSQLINCDIR}"
				MYSQLFOUND=YES
			],
			[], []
		)
	fi
fi
if test x$MYSQLFOUND = xNO; then
	AC_ERROR([mysql.h header not found])
fi
AC_SUBST(MYSQL_CFLAGS)

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
DEP_MODULES="gtk+-2.0 >= 2.6 glib-2.0 >= 2.8"
PKG_CHECK_MODULES(STARDICT, $DEP_MODULES)

# mysqlclient
MYSQLFOUND=NO
AC_CHECK_LIB([mysqlclient], [mysql_real_connect],
	[
		MYSQL_LIBS="-lmysqlclient"
		MYSQL_LDFLAGS=
		MYSQLFOUND=YES
	],
	[]
)
if test x$MYSQLFOUND = xNO; then
	AC_FIND_FILE([libmysqlclient.a],
		[/usr/lib /usr/lib/mysql /usr/local/mysql/lib /usr/local/lib/mysql],
		[MYSQLLIBDIR])
	if test x$MYSQLLIBDIR != xNO; then
		MYSQL_LIBS="-lmysqlclient"
		MYSQL_LDFLAGS="-L${MYSQLLIBDIR}"
		MYSQLFOUND=YES
		AC_MSG_RESULT([libmysqlclient.a found at ${MYSQLLIBDIR}])
	fi
fi
if test x$MYSQLFOUND = xNO; then
	AC_ERROR([libmysqlclient.a not found])
fi
AC_SUBST(MYSQL_LIBS)
AC_SUBST(MYSQL_LDFLAGS)

STARDICT_CFLAGS="-Wall $STARDICT_CFLAGS"

LFS_CFLAGS=`getconf LFS_CFLAGS`
LFS_LDFLAGS=`getconf LFS_LDFLAGS`
LFS_LIBS=`getconf LFS_LIBS`
AC_SUBST(LFS_CFLAGS)
AC_SUBST(LFS_LDFLAGS)
AC_SUBST(LFS_LIBS)

dnl For src/dsl2dict.c
PKG_CHECK_MODULES(DSL2DICT, libpcre)
AC_CHECK_FUNCS([getline mempcpy])

dnl Many programs use iconv function. Determine whether it is available and the
dnl type of the second argument: whether it is char ** or const char **.
dnl The AM_ICONV macro is a part of gettext package.
dnl In case AM_ICONV is not able to find the iconv library, consider setting
dnl LDFLAGS environment variable to specify library path. For example, 
dnl export LDFLAGS="-L/usr/local/lib".
AM_ICONV

if test "x$am_cv_func_iconv" != xyes; then
AC_ERROR([iconv not found])
fi

dnl for src/stardict_text2bin
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.5])

AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT

echo "

Type \"make\" to compile stardict-tools.

"