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

3
AC_INIT(crystfel, 0.2.0, 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
14
AC_PROG_RANLIB
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
34
35
36
37
38
39
40
AC_ARG_WITH(gsl,
[AS_HELP_STRING([--with-gsl], [specify location of GSL (instead of using pkg-config)])],
[GSL_CFLAGS="-I$withval/include"
 GSL_LIBS="-L$withval/lib -lgsl -lgslcblas -lm"],
[PKG_CHECK_MODULES([GSL], [gsl], [],
 [
    AC_ERROR([GSL is required])
 ])
Thomas White's avatar
Thomas White committed
41
])
Thomas White's avatar
Thomas White committed
42

Thomas White's avatar
Thomas White committed
43

44
45
46
47
48
49
50
51
52
53
54
55
AC_ARG_ENABLE(gsl-fudge, AS_HELP_STRING([--enable-gsl-fudge],
   [Use this option if you get lots of linker errors concerning GSL and CBLAS]))
AC_MSG_CHECKING([whether to use the GSL CBLAS fudge])
AS_IF([test "x$enable_gsl_fudge" == "xyes"],
[
   AC_MSG_RESULT([yes])
   AC_DEFINE([GSL_FUDGE], [1], [Define to 1 if the GSL fudge is needed])
],
[
   AC_MSG_RESULT([no])
])

56
57

AC_ARG_WITH(opencl, AS_HELP_STRING([--with-opencl], [Use OpenCL]))
58
AC_MSG_CHECKING([whether to use OpenCL])
59
AS_IF([test "x$with_opencl" == "xyes"],
Thomas White's avatar
Thomas White committed
60
61
[
   AC_MSG_RESULT([yes])
62
63
64

   AC_MSG_CHECKING([cl.h])
   AS_IF([test -f /System/Library/Frameworks/OpenCL.framework/Headers/cl.h],
Thomas White's avatar
Thomas White committed
65
   [
66
      AC_MSG_RESULT([/System/Library/Frameworks/OpenCL.framework/Headers/cl.h])
Thomas White's avatar
Thomas White committed
67
68
      OPENCL_CFLAGS="-I/System/Library/Frameworks/OpenCL.framework/Headers"
      OPENCL_LIBS="-framework OpenCL"
69
70
   ])
   AS_IF([test -f /usr/local/cuda/cuda/include/CL/cl.h],
Thomas White's avatar
Thomas White committed
71
   [
72
73
      AC_MSG_RESULT([/usr/local/cuda/cuda/include/CL/cl.h])
      OPENCL_CFLAGS="-I/usr/local/cuda/cuda/include"
Thomas White's avatar
Thomas White committed
74
      OPENCL_LIBS="-lOpenCL"
75
76
77
78
79
80
81
82
83
84
85
86
87
      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
88
   ])
Thomas White's avatar
Thomas White committed
89
90
   AC_DEFINE([HAVE_OPENCL], [1], [Define to 1 if OpenCL is available])
   have_opencl=true
91
], [
Thomas White's avatar
Thomas White committed
92
93
   AC_MSG_RESULT([no])
])
94
95
96
97
AS_IF([test "x$cl_cl_h" == "xtrue"],
[
   AC_DEFINE([HAVE_CL_CL_H], [1], [Define to 1 if CL/cl.h should be used])
])
98

99
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [Disable GTK+/GLib]))
100
have_gtk=false
101
AC_MSG_CHECKING([whether to use GTK])
Thomas White's avatar
Thomas White committed
102
103
104
105
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
106
   [
107
      have_gtk=true
108
      AC_DEFINE([HAVE_GTK], [1], [Define to 1 if GTK and GDK are available])
Thomas White's avatar
Thomas White committed
109
110
   ],
   [
Thomas White's avatar
Thomas White committed
111
      AC_MSG_WARN([GTK not found.  hdfsee will not be built.])
Thomas White's avatar
Thomas White committed
112
   ])
Thomas White's avatar
Thomas White committed
113
114
115
116
],
[
   AC_MSG_RESULT([no])
])
Thomas White's avatar
Thomas White committed
117
118


Thomas White's avatar
Thomas White committed
119
120
AC_CHECK_FUNCS(forkpty,
   AC_DEFINE([HAVE_FORKPTY_BSD], [1],
Thomas White's avatar
Thomas White committed
121
             [Define to 1 if a BSD-style forkpty is available]),
Thomas White's avatar
Thomas White committed
122
   AC_CHECK_LIB(util,forkpty,
Thomas White's avatar
Thomas White committed
123
124
125
126
127
   [
      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
128
129
)

Thomas White's avatar
Thomas White committed
130

131
132
133
134
135
136
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
137
138
139
   PKG_CHECK_MODULES([libPNG], [libpng >= 1.2.0],
   [
     AC_DEFINE([HAVE_LIBPNG], [1], [Define to 1 if libPNG is available])
140
141
     have_libpng=true
   ], [])
142
143
144
145
146
147
148
149
150
151
152
153
],[
   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"],
[
   AC_ARG_WITH(libtiff,
   [AS_HELP_STRING([--with-libtiff], [specify location of libTIFF library])],
154
155
156
157
158
159
   [
      LIBTIFF_CFLAGS="-I$withval/include"
      LIBTIFF_LIBS="-L$withval/lib -ltiff"
   ], [
      LIBTIFF_LIBS="-ltiff"
   ])
160
   AC_MSG_RESULT([yes])
Thomas White's avatar
Thomas White committed
161
   AC_DEFINE([HAVE_TIFF], [1], [Define to 1 if libTIFF is available])
162
163
164
165
],
[
   AC_MSG_RESULT([no])
])
166
167


168
169
170
171
172
173
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])
174
175
   PKG_CHECK_MODULES([Cairo], [cairo >= 1.2.0],
   [
176
177
178
      have_cairo=true
      AC_DEFINE([HAVE_CAIRO], [1], [Define to 1 if Cairo is available])
   ], [])
179
180
181
182
183
184
],
[
   AC_MSG_RESULT([no])
])


185
186
PKG_CHECK_MODULES([GDK_pixbuf], [gdk-pixbuf], [],
[
187
   PKG_CHECK_MODULES([GDK_pixbuf_2], [gdk-pixbuf-2.0],
188
   [
189
190
191
192
      AC_DEFINE([HAVE_GDK_PIXBUF], [1],
         [Define to 1 if gdk-pixbuf is available])
      have_gdk_pixbuf=true
   ], [])
193
194
195
])


196
197
198
199
200
201
202
203
204
205
206
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")

AM_CONDITIONAL([BUILD_CUBEIT], test x$have_cairo = xtrue \
                                 -a x$have_libpng = xtrue)


207
208
209
gl_IGNORE_UNUSED_LIBRARIES


Thomas White's avatar
Thomas White committed
210
CFLAGS="$CFLAGS $HDF5_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread $GTK_CFLAGS"
211
CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
212
CFLAGS="$CFLAGS $GDK_pixbuf_CFLAGS $GDK_pixbuf_2_CFLAGS"
213
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
214
LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS $GDK_pixbuf_LIBS"
Thomas White's avatar
Thomas White committed
215
216
LIBS="$LIBS $GDK_pixbuf_2_LIBS $LDFLAGS"

Thomas White's avatar
Thomas White committed
217

218
AC_CONFIG_FILES(Makefile lib/Makefile)
219
AC_OUTPUT