configure.ac 3.92 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
AM_SILENT_RULES([yes])
5
VERSION=AC_PACKAGE_VERSION
6
AC_CONFIG_AUX_DIR([build-aux])
7
8

AM_CONFIG_HEADER(config.h)
Thomas White's avatar
Thomas White committed
9
AM_INIT_AUTOMAKE(crystfel, "$VERSION")
10
11

AC_PROG_CC
12
gl_EARLY
13
14
15
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
16
AC_PROG_RANLIB
17

Thomas White's avatar
Thomas White committed
18

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

25
26
gl_INIT

Thomas White's avatar
Thomas White committed
27

Thomas White's avatar
Thomas White committed
28
29
30
31
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"],
32
[HDF5_LIBS="-lhdf5"])
Thomas White's avatar
Thomas White committed
33

Thomas White's avatar
Thomas White committed
34

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

Thomas White's avatar
Thomas White committed
41

42
AC_ARG_ENABLE(opencl, AS_HELP_STRING([--enable-opencl], [Enable the use of OpenCL]))
43
AC_MSG_CHECKING([whether to use OpenCL])
Thomas White's avatar
Thomas White committed
44
45
46
AS_IF([test "x$enable_opencl" == "xyes"],
[
   AC_MSG_RESULT([yes])
Thomas White's avatar
Thomas White committed
47
48
49
50
51
52
53
54
55
   AC_CHECK_HEADERS([/System/Library/Frameworks/OpenCL.framework/Headers/cl.h],
   [
      OPENCL_CFLAGS="-I/System/Library/Frameworks/OpenCL.framework/Headers"
      OPENCL_LIBS="-framework OpenCL"
   ],
   [
      OPENCL_CFLAGS="-I/usr/include/CL"
      OPENCL_LIBS="-lOpenCL"
   ])
Thomas White's avatar
Thomas White committed
56
57
58
59
60
61
   AC_DEFINE([HAVE_OPENCL], [1], [Define to 1 if OpenCL is available])
   have_opencl=true
],
[
   AC_MSG_RESULT([no])
])
Thomas White's avatar
Thomas White committed
62
AM_CONDITIONAL([HAVE_OPENCL], test x$have_opencl = xtrue)
Thomas White's avatar
Thomas White committed
63

64

65
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [Disable GTK+/GLib]))
Thomas White's avatar
Thomas White committed
66
havegtk=false
67
AC_MSG_CHECKING([whether to use GTK])
Thomas White's avatar
Thomas White committed
68
69
70
71
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
72
73
   [
      havegtk=true
74
      AC_DEFINE([HAVE_GTK], [1], [Define to 1 if GTK and GDK are available])
Thomas White's avatar
Thomas White committed
75
76
   ],
   [
Thomas White's avatar
Thomas White committed
77
      AC_MSG_WARN([GTK not found.  hdfsee will not be built.])
Thomas White's avatar
Thomas White committed
78
   ])
Thomas White's avatar
Thomas White committed
79
80
81
82
],
[
   AC_MSG_RESULT([no])
])
83
AM_CONDITIONAL([HAVE_GTK], test "x$havegtk" = "xtrue")
Thomas White's avatar
Thomas White committed
84
85


Thomas White's avatar
Thomas White committed
86
87
AC_CHECK_FUNCS(forkpty,
   AC_DEFINE([HAVE_FORKPTY_BSD], [1],
Thomas White's avatar
Thomas White committed
88
             [Define to 1 if a BSD-style forkpty is available]),
Thomas White's avatar
Thomas White committed
89
   AC_CHECK_LIB(util,forkpty,
Thomas White's avatar
Thomas White committed
90
91
92
93
94
   [
      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
95
96
)

Thomas White's avatar
Thomas White committed
97

98
99
100
101
102
103
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
104
105
106
107
   PKG_CHECK_MODULES([libPNG], [libpng >= 1.2.0],
   [
     AC_DEFINE([HAVE_LIBPNG], [1], [Define to 1 if libPNG is available])
   ])
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
],[
   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])],
   [LIBTIFF_CFLAGS="-I$withval/include"
    LIBTIFF_LIBS="-L$withval/lib -ltiff"],
   [LIBTIFF_LIBS="-ltiff"])
   AC_MSG_RESULT([yes])
Thomas White's avatar
Thomas White committed
124
   AC_DEFINE([HAVE_TIFF], [1], [Define to 1 if libTIFF is available])
125
126
127
128
],
[
   AC_MSG_RESULT([no])
])
129
130


131
132
133
134
135
136
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])
137
138
139
140
141
   PKG_CHECK_MODULES([Cairo], [cairo >= 1.2.0],
   [
     havecairo=true
     AC_DEFINE([HAVE_CAIRO], [1], [Define to 1 if Cairo is available])
   ])
142
143
144
145
],
[
   AC_MSG_RESULT([no])
])
146
AM_CONDITIONAL([HAVE_CAIRO], test x$havecairo = xtrue)
147
148


149
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread"
150
CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS"
151
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
152
LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS"
Thomas White's avatar
Thomas White committed
153

154
155
156
AC_CONFIG_FILES(Makefile src/Makefile data/Makefile doc/Makefile)
AC_CONFIG_FILES(scripts/Makefile doc/examples/Makefile lib/Makefile)
AC_OUTPUT