configure.ac 2.73 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.1.0, taw@physics.org)
4
AM_SILENT_RULES([yes])
5
6
7
VERSION=AC_PACKAGE_VERSION

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

AC_PROG_CC
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S

Thomas White's avatar
Thomas White committed
15

16
17
18
19
20
21
22
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
AC_C_CONST
AC_FUNC_MALLOC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([strdup])

Thomas White's avatar
Thomas White committed
23

Thomas White's avatar
Thomas White committed
24
25
26
27
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"],
28
[HDF5_LIBS="-lhdf5"])
Thomas White's avatar
Thomas White committed
29

Thomas White's avatar
Thomas White committed
30

Thomas White's avatar
Thomas White committed
31
32
33
34
35
36
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
37

38
AC_ARG_ENABLE(opencl, AS_HELP_STRING([--enable-opencl], [Enable the use of OpenCL]))
39
AC_MSG_CHECKING([whether to use OpenCL])
Thomas White's avatar
Thomas White committed
40
41
42
AS_IF([test "x$enable_opencl" == "xyes"],
[
   AC_MSG_RESULT([yes])
Thomas White's avatar
Thomas White committed
43
44
45
46
47
48
49
50
51
   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
52
53
54
55
56
57
   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
58
AM_CONDITIONAL([HAVE_OPENCL], test x$have_opencl = xtrue)
Thomas White's avatar
Thomas White committed
59

60

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


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

Thomas White's avatar
Thomas White committed
93

94
95
96
97
98
99
100
101
102
103
104
105
106
AC_MSG_CHECKING([libpng])
if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then
        LIBPNG_VERSION=`$PKG_CONFIG --modversion libpng`
        AC_MSG_RESULT($LIBPNG_VERSION)
        LIBPNG_CFLAGS=`$PKG_CONFIG --cflags libpng`
        LIBPNG_LIBS=`$PKG_CONFIG --libs libpng`
else
        AC_MSG_RESULT([Lower than 1.2.0 or not found])
        AC_MSG_ERROR([
*** libPNG is required to build CrystFEL])
fi


107
108
CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread"
LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread"
Thomas White's avatar
Thomas White committed
109
110

AC_OUTPUT(Makefile src/Makefile data/Makefile)