File: configure.in

package info (click to toggle)
gmime2 2.0.14-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,092 kB
  • ctags: 3,177
  • sloc: ansic: 29,973; sh: 8,234; makefile: 413; perl: 6
file content (231 lines) | stat: -rw-r--r-- 5,647 bytes parent folder | download
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
dnl Process this file with autoconf to produce a configure script.
AC_INIT(configure.in)
AM_CONFIG_HEADER(config.h)

# In the following, there are a the following variants
# of GLib cflags and libs variables
#
# GLIB_CFLAGS:  cflags for compiling libraries and example progs
# GLIB_LIBS:    libraries for linking example programs
# glib_cflags:  cflags to store in gmime-config
# glib_libs:    libs to store in gmime-config

GMIME_MAJOR_VERSION=2
GMIME_MINOR_VERSION=0
GMIME_MICRO_VERSION=14
GMIME_VERSION=$GMIME_MAJOR_VERSION.$GMIME_MINOR_VERSION.$GMIME_MICRO_VERSION
GMIME_VERSION_INFO=`expr $GMIME_MAJOR_VERSION + $GMIME_MINOR_VERSION`:$GMIME_MICRO_VERSION:$GMIME_MINOR_VERSION

AC_SUBST(GMIME_MAJOR_VERSION)
AC_SUBST(GMIME_MINOR_VERSION)
AC_SUBST(GMIME_MICRO_VERSION)
AC_SUBST(GMIME_VERSION)
AC_SUBST(GMIME_VERSION_INFO)

VERSION=$GMIME_VERSION

AM_INIT_AUTOMAKE(gmime, $VERSION)

AC_CANONICAL_HOST

dnl Checks for programs.
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_C_INLINE
dnl AC_HEADER_STDC
AC_STDC_HEADERS
AC_ARG_PROGRAM
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)

AM_PROG_LIBTOOL

AM_MAINTAINER_MODE

LDFLAGS=${_ldflags}

dnl Checks for header files.
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(time.h)

AC_CHECK_TYPE(off_t, long)
AC_CHECK_TYPE(size_t, unsigned int)
AC_CHECK_TYPE(ssize_t, int)

AC_CHECK_FUNCS(isblank strftime localtime gethostname gethostbyname mmap munmap msync)
AC_CHECK_FUNCS(gmtime_r)

dnl Specific dir for HTML output ?
AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
if test "x$with_html_dir" = "x" ; then
  HTML_DIR='${datadir}/gtk-doc/html'
else
  HTML_DIR=$with_html_dir
fi

AC_SUBST(HTML_DIR)

dnl ******************************
dnl gtk-doc
dnl ******************************

AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
AC_SUBST(HAVE_GTK_DOC)

dnl Make people disable the gtk-doc stuff explicitly.
AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc        Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)

if test "x$enable_gtk_doc" = "xauto" ; then
  if test "x$GTKDOC" = "xtrue" ; then
    enable_gtk_doc="yes"
  else
    enable_gtk_doc="no"
  fi
fi

AC_SUBST(enable_gtk_doc)

dnl NOTE: We need to use a separate automake conditional for this
dnl       to make this work with the tarballs.
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)

dnl Check for gprof action
AC_ARG_ENABLE(gprof, [  --enable-gprof          Enable gprof profiling compile flags [default=no]], enable_gprof="$enableval", enable_gprof=no)
if test x$enable_gprof = xyes; then
  CFLAGS="$CFLAGS -pg"
fi

dnl Turn on a bunch of warnings
AC_ARG_ENABLE(warnings, [  --enable-warnings		Enable a bunch of compile warning options], enable_warnings="$enableval", enable_warnings=no)
if test x$enable_warnings = xyes; then
  CFLAGS="$CFLAGS -Wall -Wcast-align -Wmissing-prototypes -Wreturn-type -Wuninitialized -Wunused -Werror"
fi

dnl We need at *least* glib 2.0.0
AM_PATH_GLIB_2_0(2.0.0, ,
		 AC_MSG_ERROR(Cannot find GLIB: Is pkg-config in your path?),
		 gobject gmodule gthread)

glib_cflags="$GLIB_CFLAGS"
glib_libs="$GLIB_LIBS"
AC_SUBST(glib_cflags)
AC_SUBST(glib_libs)

dnl *****************************
dnl *** Checks for libnsl     ***
dnl *****************************
LIBNSL=""
AC_CHECK_LIB(nsl, gethostbyname, LIBNSL="-lnsl")

dnl Check for libiconv
AM_ICONV()

CFLAGS_save="$CFLAGS"
CFLAGS="$CFLAGS -I$srcdir"
LIBS_save="$LIBS"
LIBS="$LIBS $LIBICONV"

AC_MSG_CHECKING(preferred charset formats for system iconv)
AC_TRY_RUN([
#define CONFIGURE_IN
#include "iconv-detect.c"
],[
	AC_MSG_RESULT(found)
	AC_DEFINE(HAVE_ICONV_DETECT_H)
],[
	AC_MSG_RESULT(not found)
	AC_ERROR([
	*** The iconv-detect program was unable to determine the
	*** preferred charset formats recognized by your system
	*** iconv library. It is suggested that you install a
	*** working iconv library such as the one found at
	*** ftp://ftp.gnu.org/pub/gnu/libiconv
	])
])

CFLAGS="$CFLAGS_save"
LIBS="$LIBS_save"

dnl * Time zone stuff
AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
	AC_TRY_COMPILE([
		#include <time.h>
	], [
		timezone = 1;
	], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
if test $ac_cv_var_timezone = yes; then
	AC_DEFINE(HAVE_TIMEZONE)
else
	AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
		AC_TRY_COMPILE([
			#include <time.h>
			], [
			struct tm tm;
			tm.tm_gmtoff = 1;
			], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
	if test $ac_cv_struct_tm_gmtoff = yes; then
		AC_DEFINE(HAVE_TM_GMTOFF)
	else
		AC_ERROR(unable to find a way to determine timezone)
	fi
fi


dnl Extra libs
if test "x$LIBNSL" != "x"; then
	EXTRA_LIBS="$LIBNSL"
fi
if test "x$LIBICONV" != "x"; then
	EXTRA_LIBS="$EXTRA_LIBS $LIBICONV"
fi

AC_SUBST(CFLAGS)

LIBS="$LIBS $EXTRA_LIBS"
AC_SUBST(LIBS)

GMIME_LIBDIR="-L${libdir}"
GMIME_INCLUDEDIR="-I${includedir}/gmime-2.0"
GMIME_LIBS="-lgmime-2.0 $EXTRA_LIBS"
GMIME_CFLAGS=""

AC_SUBST(GMIME_LIBS)
AC_SUBST(GMIME_LIBDIR)
AC_SUBST(GMIME_INCLUDEDIR)
AC_SUBST(GMIME_CFLAGS)
AC_SUBST(HTML_DIR)

AC_OUTPUT(
Makefile
docs/Makefile
docs/reference/Makefile
gmime/Makefile
gmime/gmime.h
src/Makefile
tests/Makefile
gmime-config
gmime-2.0.pc
gmime.spec
)

echo "

Configuration:

  Source code location: ${srcdir}
  Install prefix:       ${prefix}
  Compiler:             ${CC}

  Profiling enabled:    ${enable_gprof}
"