configure.ac 7.91 KB
Newer Older
1
2
dnl Process this file with autoconf to produce a configure script.

Thomas White's avatar
Thomas White committed
3
AC_INIT(crystfel, 0.4.2, taw@physics.org)
4
AC_CONFIG_AUX_DIR([build-aux])
5
AM_CONFIG_HEADER(config.h)
6
AM_INIT_AUTOMAKE([subdir-objects])
7
8

AC_PROG_CC
9
gl_EARLY
10
AM_PROG_CC_C_O
11
12
13
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
Thomas White's avatar
Thomas White committed
14
AC_PROG_LIBTOOL
15
AM_SILENT_RULES([yes])
Thomas White's avatar
Thomas White committed
16

17
AC_HEADER_STDC
Thomas White's avatar
Thomas White committed
18
AC_CHECK_HEADERS([fcntl.h stdlib.h unistd.h])
19
20
21
22
AC_C_CONST
AC_FUNC_MALLOC
AC_TYPE_SIGNAL

23
24
gl_INIT

Thomas White's avatar
Thomas White committed
25

Thomas White's avatar
Thomas White committed
26
27
28
29
AC_ARG_WITH(hdf5,
[AS_HELP_STRING([--with-hdf5], [specify location of HDF5 library])],
[HDF5_CFLAGS="-I$withval/include"
 HDF5_LIBS="-L$withval/lib -lhdf5"],
30
[HDF5_LIBS="-lhdf5"])
Thomas White's avatar
Thomas White committed
31

Thomas White's avatar
Thomas White committed
32

Thomas White's avatar
Thomas White committed
33
AC_ARG_WITH(gsl,
34
35
[AS_HELP_STRING([--with-gsl],
                [specify location of GSL (instead of using pkg-config)])],
Thomas White's avatar
Thomas White committed
36
37
[GSL_CFLAGS="-I$withval/include"
 GSL_LIBS="-L$withval/lib -lgsl -lgslcblas -lm"],
38
[PKG_CHECK_MODULES([GSL], [gsl])])
39

40
41

AC_ARG_WITH(opencl, AS_HELP_STRING([--with-opencl], [Use OpenCL]))
42
AC_MSG_CHECKING([whether to use OpenCL])
43
AS_IF([test "x$with_opencl" == "xyes"],
Thomas White's avatar
Thomas White committed
44
45
[
   AC_MSG_RESULT([yes])
46
47
48

   AC_MSG_CHECKING([cl.h])
   AS_IF([test -f /System/Library/Frameworks/OpenCL.framework/Headers/cl.h],
Thomas White's avatar
Thomas White committed
49
   [
50
      AC_MSG_RESULT([/System/Library/Frameworks/OpenCL.framework/Headers/cl.h])
Thomas White's avatar
Thomas White committed
51
52
      OPENCL_CFLAGS="-I/System/Library/Frameworks/OpenCL.framework/Headers"
      OPENCL_LIBS="-framework OpenCL"
53
   ], [
Thomas White's avatar
Thomas White committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
      AS_IF([test -f /usr/local/cuda/cuda/include/CL/cl.h],
      [
         AC_MSG_RESULT([/usr/local/cuda/cuda/include/CL/cl.h])
         OPENCL_CFLAGS="-I/usr/local/cuda/cuda/include"
         OPENCL_LIBS="-lOpenCL"
         cl_cl_h=true
      ], [
         AS_IF([test -f /usr/local/cuda/include/CL/cl.h],
         [
            AC_MSG_RESULT([/usr/local/cuda/include/CL/cl.h])
            OPENCL_CFLAGS="-I/usr/local/cuda/include"
            OPENCL_LIBS="-lOpenCL"
            cl_cl_h=true
         ], [
            AC_MSG_RESULT([not found, assuming /usr/include/CL/cl.h])
            OPENCL_CFLAGS=""
            OPENCL_LIBS="-lOpenCL"
            cl_cl_h=true
          ])
       ])
Thomas White's avatar
Thomas White committed
74
   ])
Thomas White's avatar
Thomas White committed
75
76
   AC_DEFINE([HAVE_OPENCL], [1], [Define to 1 if OpenCL is available])
   have_opencl=true
77
], [
Thomas White's avatar
Thomas White committed
78
79
   AC_MSG_RESULT([no])
])
Thomas White's avatar
Thomas White committed
80
AS_IF([test x$cl_cl_h = xtrue],
81
82
83
[
   AC_DEFINE([HAVE_CL_CL_H], [1], [Define to 1 if CL/cl.h should be used])
])
84

85

86
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [Disable GTK+/GLib]))
87
have_gtk=false
88
AC_MSG_CHECKING([whether to use GTK])
Thomas White's avatar
Thomas White committed
89
90
91
92
AS_IF([test "x$enable_gtk" != "xno"],
[
   AC_MSG_RESULT([yes])
   AM_PATH_GTK_2_0(2.0.0,
Thomas White's avatar
Thomas White committed
93
   [
94
      have_gtk=true
95
      AC_DEFINE([HAVE_GTK], [1], [Define to 1 if GTK and GDK are available])
Thomas White's avatar
Thomas White committed
96
97
   ],
   [
Thomas White's avatar
Thomas White committed
98
      AC_MSG_WARN([GTK not found.  hdfsee will not be built.])
Thomas White's avatar
Thomas White committed
99
   ])
Thomas White's avatar
Thomas White committed
100
101
102
103
],
[
   AC_MSG_RESULT([no])
])
Thomas White's avatar
Thomas White committed
104
105


Thomas White's avatar
Thomas White committed
106
107
AC_CHECK_FUNCS(forkpty,
   AC_DEFINE([HAVE_FORKPTY_BSD], [1],
Thomas White's avatar
Thomas White committed
108
             [Define to 1 if a BSD-style forkpty is available]),
Thomas White's avatar
Thomas White committed
109
   AC_CHECK_LIB(util,forkpty,
Thomas White's avatar
Thomas White committed
110
111
112
113
114
   [
      AC_DEFINE([HAVE_FORKPTY_LINUX], [1],
                [Define to 1 if a Linux-style forkpty is available])
      LIBS="$LIBS -lutil"
   ])
Thomas White's avatar
Thomas White committed
115
116
)

Thomas White's avatar
Thomas White committed
117

118
119
120
121
122
123
AC_MSG_CHECKING([whether to use PNG])
AC_ARG_ENABLE([png],
    AS_HELP_STRING([--disable-png], [Disable the use of libPNG]))
AS_IF([test "x$enable_png" != "xno"],
[
   AC_MSG_RESULT([yes])
Thomas White's avatar
Thomas White committed
124
125
   PKG_CHECK_MODULES([libPNG], [libpng >= 1.2.0],
   [
126
127
128
129
130
      AC_DEFINE([HAVE_LIBPNG], [1], [Define to 1 if libPNG is available])
      have_libpng=true
   ], [
      have_libpng=false
   ])
131
132
133
134
135
136
137
138
139
140
],[
   AC_MSG_RESULT([no])
])


AC_MSG_CHECKING([whether to use TIFF])
AC_ARG_ENABLE([tiff],
    AS_HELP_STRING([--disable-tiff], [Disable the use of libTIFF]))
AS_IF([test "x$enable_tiff" != "xno"],
[
141
   AC_MSG_RESULT([yes])
142
143
   AC_ARG_WITH(libtiff,
   [AS_HELP_STRING([--with-libtiff], [specify location of libTIFF library])],
144
145
146
   [
      LIBTIFF_CFLAGS="-I$withval/include"
      LIBTIFF_LIBS="-L$withval/lib -ltiff"
Thomas White's avatar
Thomas White committed
147
      have_libtiff=true
148
   ], [
Thomas White's avatar
Thomas White committed
149
150
151
152
      AC_CHECK_LIB([tiff], [TIFFOpen], [
         have_libtiff=true
         LIBTIFF_LIBS="-ltiff"
      ])
153
   ])
154
], [
155
156
   AC_MSG_RESULT([no])
])
Thomas White's avatar
Thomas White committed
157
158
159
160
AS_IF([test x$have_libtiff = xtrue],
[
   AC_DEFINE([HAVE_TIFF], [1], [Define to 1 if libTIFF is available])
])
161
162


163
164
165
166
167
168
AC_MSG_CHECKING([whether to use Cairo])
AC_ARG_ENABLE([cairo],
              AS_HELP_STRING([--disable-cairo], [Disable the use of Cairo]))
AS_IF([test "x$enable_cairo" != "xno"],
[
   AC_MSG_RESULT([yes])
169
170
   PKG_CHECK_MODULES([Cairo], [cairo >= 1.2.0],
   [
171
172
      have_cairo=true
      AC_DEFINE([HAVE_CAIRO], [1], [Define to 1 if Cairo is available])
Thomas White's avatar
Thomas White committed
173
174
175
   ], [
      have_cairo=false
   ])
176
], [
177
178
179
180
   AC_MSG_RESULT([no])
])


Thomas White's avatar
Thomas White committed
181
182
183
184
185
186
187
188
189
190
191
192
193
AC_MSG_CHECKING([whether to use Pango])
AC_ARG_ENABLE([pango],
              AS_HELP_STRING([--disable-pango], [Disable the use of Pango]))
AS_IF([test "x$enable_pango" != "xno"],
[
   AC_MSG_RESULT([yes])
   PKG_CHECK_MODULES([Pango], [pango >= 1.0.0],
   [
      have_pango=true
      AC_DEFINE([HAVE_PANGO], [1], [Define to 1 if Pango is available])
   ], [
      have_pango=false
   ])
Thomas White's avatar
Thomas White committed
194
195
196
197
198
199
200
201
   PKG_CHECK_MODULES([PangoCairo], [pangocairo],
   [
      have_pangocairo=true
      AC_DEFINE([HAVE_PANGOCAIRO], [1],
                [Define to 1 if PangoCairo is available])
   ], [
      have_pangocairo=false
   ])
Thomas White's avatar
Thomas White committed
202
203
204
205
206
], [
   AC_MSG_RESULT([no])
])


207
208
209
210
AC_MSG_CHECKING([whether to use GDK-pixbuf])
AC_ARG_ENABLE([gdk-pixbuf], AS_HELP_STRING([--disable-gdk-pixbuf],
                                           [Disable the use of gtk-pixbuf]))
AS_IF([test "x$enable_gdk_pixbuf" != "xno"],
211
[
212
213
   AC_MSG_RESULT([yes])
   PKG_CHECK_MODULES([GDK_pixbuf], [gdk-pixbuf], [],
214
   [
215
216
217
218
219
      PKG_CHECK_MODULES([GDK_pixbuf_2], [gdk-pixbuf-2.0],
      [
         AC_DEFINE([HAVE_GDK_PIXBUF], [1],
                   [Define to 1 if gdk-pixbuf is available])
         have_gdk_pixbuf=true
Thomas White's avatar
Thomas White committed
220
221
222
      ], [
         have_gdk_pixbuf=false
      ])
223
224
225
   ])
], [
   AC_MSG_RESULT([no])
226
227
228
])


Thomas White's avatar
Thomas White committed
229
230
231
232
233
234
AC_CHECK_LIB([pthread], [sched_setaffinity], [
   AC_DEFINE([HAVE_CPU_AFFINITY], [1],
             [Define to 1 if sched_setaffinity is available.])
])


235
236
237
238
239
240
241
AC_CHECK_LIB([hdf5], [H5Fcreate], [],
[
   AC_MSG_ERROR([HDF5 not found!])
])



Thomas White's avatar
Thomas White committed
242
243
AC_CHECK_LIB([rt], [clock_gettime],
[
244
245
246
247
248
249
250
251
252
   AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
             [Define to 1 if clock_gettime is available.])
   TIMER_LIBS="-lrt"
], [
   AC_MSG_WARN([Falling back on gettimeofday().])
   AC_MSG_WARN([Time intervals may not be correct in certain circumstances.])
])


Thomas White's avatar
Thomas White committed
253
PKG_CHECK_MODULES([FFTW], [fftw3],
Thomas White's avatar
Thomas White committed
254
255
[
   have_fftw=true
Thomas White's avatar
Thomas White committed
256
   AC_DEFINE([HAVE_FFTW], [1], [Define to 1 if FFTW is available])
Thomas White's avatar
Thomas White committed
257
258
259
260
261
], [
   AC_MSG_WARN([ReAx indexing will not be available.])
   have_fftw=false
])

262
263
264
265
266
267
268
dnl Conditionals...
AM_CONDITIONAL([HAVE_OPENCL], test x$have_opencl = xtrue)

AM_CONDITIONAL([BUILD_HDFSEE], test x$have_gdk_pixbuf = xtrue \
                                -a "x$have_gtk" = "xtrue" \
                                -a "x$have_cairo" = "xtrue")

Thomas White's avatar
Thomas White committed
269
270
AM_CONDITIONAL([HAVE_CAIRO], test x$have_cairo = xtrue)

Thomas White's avatar
Thomas White committed
271
272
AM_CONDITIONAL([HAVE_PANGOCAIRO], test x$have_pangocairo = xtrue)

Thomas White's avatar
Thomas White committed
273
274
AM_CONDITIONAL([HAVE_PANGO], test x$have_pango = xtrue)

Thomas White's avatar
Thomas White committed
275
AM_CONDITIONAL([HAVE_FFTW], test x$have_fftw = xtrue)
276

277
278
279
gl_IGNORE_UNUSED_LIBRARIES


280
281
282
MAIN_CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread"
MAIN_CFLAGS="$MAIN_CFLAGS $GTK_CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE "
MAIN_CFLAGS="$MAIN_CFLAGS $libPNG_CFLAGS $Cairo_CFLAGS $GDK_pixbuf_CFLAGS"
283
MAIN_CFLAGS="$MAIN_CFLAGS $GDK_pixbuf_2_CFLAGS $FFTW_CFLAGS $Pango_CFLAGS"
Thomas White's avatar
Thomas White committed
284
MAIN_CFLAGS="$MAIN_CFLAGS $PangoCairo_CFLAGS"
285
286
287
288
289
290
291
AC_SUBST([MAIN_CFLAGS])

LIBCRYSTFEL_CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $FFTW_CFLAGS"
AC_SUBST([LIBCRYSTFEL_CFLAGS])

MAIN_LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
MAIN_LIBS="$MAIN_LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS $GDK_pixbuf_LIBS"
292
MAIN_LIBS="$MAIN_LIBS $GDK_pixbuf_2_LIBS $TIMER_LIBS $FFTW_LIBS"
Thomas White's avatar
Thomas White committed
293
MAIN_LIBS="$MAIN_LIBS $Pango_LIBS $PangoCairo_LIBS $LDFLAGS"
294
295
296
297
AC_SUBST([MAIN_LIBS])

LIBCRYSTFEL_LIBS="$LIBS $HDF5_LIBS $GSL_LIBS $FFTW_LIBS $LDFLAGS"
AC_SUBST([LIBCRYSTFEL_LIBS])
Thomas White's avatar
Thomas White committed
298

299
GTK_DOC_CHECK([1.9],[--flavour no-tmpl])
Thomas White's avatar
Thomas White committed
300
301
AC_CONFIG_MACRO_DIR(m4)

302
303
HTML_DIR=${docdir}/reference

Thomas White's avatar
Thomas White committed
304

Thomas White's avatar
Thomas White committed
305
AC_CONFIG_FILES(Makefile lib/Makefile doc/reference/Makefile libcrystfel/Makefile)
306
AC_OUTPUT