configure.ac 8.47 KB
Newer Older
1
#  Process this file with autoconf to produce a configure script.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
2

Deike Kleberg's avatar
Deike Kleberg committed
3
AC_INIT([cdi], [1.5.1], [http://code.zmaw.de/projects/cdi])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
4

Uwe Schulzweida's avatar
Uwe Schulzweida committed
5
6
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"

Uwe Schulzweida's avatar
Uwe Schulzweida committed
7
CONFIG_ABORT=yes
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_CANONICAL_BUILD

# Checks for username, hostname and system type
USERNAME=$LOGNAME
if test -z "$USERNAME" ; then USERNAME=$USER; fi;
if test -z "$USERNAME" ; then USERNAME="unknown"; fi;
AC_DEFINE_UNQUOTED([USER_NAME],["$USERNAME"], [User name])
AC_SUBST([USER_NAME],["$USERNAME"])
AS_IF([test -z "$HOST"],
      [HOST=unknown
       AS_IF([test -x /bin/hostname],[HOST=$(hostname)],
             [AS_IF([test -x /bin/uname],
                    [HOST=$(uname -n)])])])
AC_DEFINE_UNQUOTED([HOST_NAME],["$HOST"],[Host name])
AC_SUBST([HOST_NAME],["$HOST"])
AC_DEFINE_UNQUOTED([SYSTEM_TYPE],["$ac_cv_build"], [System type])
AC_SUBST([SYSTEM_TYPE],["$ac_cv_build"])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
28
29

AM_INIT_AUTOMAKE
30
31
32
33
34
35
AM_CONFIG_HEADER([src/config.h])
AM_MAINTAINER_MODE([disable])

# Set up libtool.
AC_MSG_NOTICE([setting up libtool])
LT_INIT([pic-only])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
36

37
38
# Check building environment
AC_CHECK_TOOL([CC],[gcc],[:])
39
AC_PROG_CC_C99
40
AC_PROG_FC
Uwe Schulzweida's avatar
Uwe Schulzweida committed
41
42
AC_PROG_F77
AC_PROG_RANLIB
43
AC_PROG_CXX
44
45
AC_CHECK_PROG(SED,sed,sed,false)
AC_CHECK_PROG(GREP,grep,grep,false)
46
47
48
49
50
51
52
53
54
55
56
57
AC_PROG_INSTALL
AC_CHECK_TOOL([AR],[ar],[:])
AC_CHECK_TOOL([CPP],[cpp],[:])
AC_CHECK_TOOL([LD],[ld],[:])
AC_CHECK_TOOL([NM],[nm],[:])
AC_CHECK_TOOL([AS],[as],[:])
AC_CHECK_TOOL([DLLTOOL],[dlltool],[:])
AC_CHECK_TOOL([OBJDUMP],[objdump],[:])
AC_CHECK_TOOL([STRIP],[strip],[:])
AC_CHECK_TOOL([RANLIB],[ranlib],[:])
#  ----------------------------------------------------------------------
# Check large file support on 32 bit systems
Uwe Schulzweida's avatar
Uwe Schulzweida committed
58
AC_SYS_LARGEFILE
59
60
#  ----------------------------------------------------------------------
# Checks for library functions.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
61
AC_FUNC_MMAP
62
63
#  ----------------------------------------------------------------------
# Checks for library malloc.
Uwe Schulzweida's avatar
Uwe Schulzweida committed
64
AC_CHECK_LIB(malloc, malloc)
65
#  ----------------------------------------------------------------------
66
67
# Checks for structures.
AC_CHECK_MEMBERS([struct stat.st_blksize])
68
#  ----------------------------------------------------------------------
Uwe Schulzweida's avatar
Uwe Schulzweida committed
69
70
# Checks for header files
AC_CHECK_HEADERS(malloc.h)
71
#  ----------------------------------------------------------------------
Uwe Schulzweida's avatar
Uwe Schulzweida committed
72
73
# Checks for the availability of functions
AC_CHECK_FUNCS(mallinfo)
74
#  ----------------------------------------------------------------------
75
76
# Checks for the availability of ANSI-C99 functions
AC_CHECK_FUNCS(isnan)
Uwe Schulzweida's avatar
Uwe Schulzweida committed
77
78
79
80
#  ----------------------------------------------------------------------
#  Check for math library
AC_CHECK_LIB(m, floor)

Deike Kleberg's avatar
Deike Kleberg committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

#  ----------------------------------------------------------------------
#  Checks for pthread library
AC_ARG_WITH([threads],
            [AC_HELP_STRING([--with-threads=<directory>],
                            [Use the pthread library [default=yes]])],
            [],
            [with_threads=yes])
AS_CASE([$with_threads],
        [no],[AC_MSG_CHECKING([for pthread library])
              AC_MSG_RESULT([suppressed])],
        [yes],[AC_CHECK_HEADERS(pthread.h)
               AC_CHECK_LIB([pthread],[pthread_create])
               AC_SUBST([THREADS_LDFLAGS],[" -lpthread"])
               AC_SUBST([THREADS_INCLUDE],[""])],
        [*],[THREADS_ROOT=$with_threads
             LDFLAGS="$LDFLAGS -L$THREADS_ROOT/lib"
             CPPFLAGS="$CPPFLAGS -I$THREADS_ROOT/include"
             AC_CHECK_HEADERS(pthread.h)
             AC_CHECK_LIB([pthread],[pthread_create])
             AC_SUBST([THREADS_LDFLAGS],[" -L$THREADS_ROOT/lib -lpthread"])
             AC_SUBST([THREADS_INCLUDE],[" -I$THREADS_ROOT/include"])])

Uwe Schulzweida's avatar
Uwe Schulzweida committed
104
#  ----------------------------------------------------------------------
105
106
# Add basic configure options
ACX_OPTIONS
Uwe Schulzweida's avatar
Uwe Schulzweida committed
107
#  ----------------------------------------------------------------------
108
109
# Compile with MPI support
AC_ARG_ENABLE(mpi,AS_HELP_STRING([--enable-mpi],[Compile with MPI compiler [default=no]]),enable_mpi=${enableval},enable_mpi=no)
110
111
112
AS_IF([test x"${enable_mpi}" = x"yes"],
      [USE_MPI=yes])
AS_IF([test x"$USE_MPI" = xyes],
113
  [AC_DEFINE([USE_MPI],[1],[parallel I/O requested and available])])
114
AM_CONDITIONAL([USE_MPI],[test x"$USE_MPI" = xyes])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
115
116
117
118
#  ----------------------------------------------------------------------
#  Create the Fortran Interface via iso_c_binding module (Fortran 2003 Standard)
AC_ARG_ENABLE(iso-c-interface,
              AS_HELP_STRING([--enable-iso-c-interface],
119
                             [Create Fortran Interface via iso_c_bindings facility of F2003 [default=no]]).
Uwe Schulzweida's avatar
Uwe Schulzweida committed
120
121
              ,enable_isoc=${enableval},enable_isoc=no)
AM_CONDITIONAL([CREATE_ISOC],[test $enable_isoc = 'yes'])
122
AS_IF([test "x${enable_isoc}" != "xyes"],[AC_SUBST([FC],$F77)])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
123
124
#  Check the module extension of the fortran compiler
ACX_SL_FC_MOD_SUFFIX(,[FCMODEXT=mod])
125
# -----------------------------------------------------------------------
126
127
# Check for SWIG - Generator for script-language bindings
AC_ARG_ENABLE(swig,
128
129
130
131
              [AS_HELP_STRING([--enable-swig],[use swig to create extra bindings [default=no] (EXPERIMENTAL)])],
              [AC_CHECK_PROG(SWIG,swig,swig)],
              [enable_swig=no])
AM_CONDITIONAL(ENABLE_SWIG,[test "x$SWIG" != "x"])
132
133
134
#  ----------------------------------------------------------------------
#  Create the Ruby Interface via swig
AC_ARG_ENABLE(ruby,
135
  [AS_HELP_STRING([--enable-ruby],[ruby language bindings [default=no] (EXPERIMENTAL)])],
136
  [AC_CHECK_PROG(RUBY,ruby,ruby)
137
   RUBY_INCLUDES="$($RUBY $srcdir/config/interface.rb)"
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
   save_CPPFLAGS=$CPPFLAGS
   CPPFLAGS="$CPPFLAGS $RUBY_INCLUDES"
   AC_CHECK_HEADER([ruby.h],,[enable_ruby=no
                              RUBY=
                             ])
   CPPFLAGS=$save_CPPFLAGS
   AS_IF([test "x$RUBY" != "x"],
         [AS_IF([test "x$SWIG" = "x"],
                [AC_MSG_NOTICE([Ruby bindings: Swig is disabled, pregenerated files will be used. Use '--enable-swig' for swig usage])])],
                [AS_IF([test `$SWIG -help 2>&1 | $GREP -c '\-ruby *- Generate'` = 0],
                       [AC_MSG_NOTICE([No (swig does not support -ruby option)])
                        enable_ruby=no
                       ])])],
  [enable_ruby=no])
AM_CONDITIONAL(ENABLE_RUBY,[test "x$enable_ruby" != "xno"])
AS_IF([test "x$enable_ruby" != "xno"],[AC_SUBST([ENABLE_RUBY],[true])],[AC_SUBST([ENABLE_RUBY],[false])])
154
155
156
#  ----------------------------------------------------------------------
#  Create the Ruby Interface via swig
AC_ARG_ENABLE(python,
157
  [AS_HELP_STRING([--enable-python],[python language bindings [default=no] (EXPERIMENTAL)])],
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
  [AC_CHECK_PROG(PYTHON,python,python)
   PYTHON_INCLUDES="-I$($PYTHON -c 'from distutils import sysconfig;print sysconfig.get_python_lib(1,1)' | $SED 's/lib/include/')"
   save_CPPFLAGS=$CPPFLAGS
   CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
   AC_CHECK_HEADER([Python.h],,[enable_python=no
                                PYTHON=
                               ])
   CPPFLAGS=$save_CPPFLAGS
   AS_IF([test "x$PYTHON" != "x"],
         [AS_IF([test "x$SWIG" = "x"],
                [AC_MSG_NOTICE([Python bindings: Swig is disabled, pregenerated files will be used. Use '--enable-swig' for swig usage])])],
                [AS_IF([test `$SWIG -help 2>&1 | $GREP -c '\-python *- Generate'` = 0],
                       [AC_MSG_NOTICE([No (swig does not support -python option)])
                        enable_python=no
                       ])])],
  [enable_python=no])
AM_CONDITIONAL(ENABLE_PYTHON, [test "x$enable_python" != "xno"])
AS_IF([test "x$enable_python" != "xno"],[AC_SUBST([ENABLE_PYTHON],[true])],[AC_SUBST([ENABLE_PYTHON],[false])])
#  ----------------------------------------------------------------------
AM_CONDITIONAL(CREATE_INTERFACES, [test  "x$enable_ruby" = "xyes" -o "x$enable_python" = "xyes"])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
178
#  ----------------------------------------------------------------------
179
#  Check C / Fortran interface
180
ACX_CHECK_CFINT([$srcdir/src/cfortran.h])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
181

182
AC_SUBST([CPPFLAGS])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
183

184
185
186
AC_OUTPUT([Makefile src/Makefile interfaces/Makefile app/Makefile \
	tests/Makefile examples/Makefile cdi.settings \
	pioExamples/Makefile])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
187

188
189
190
#  ----------------------------------------------------------------------
#  Show configuration
AC_MSG_NOTICE([CDI is configured with the following options:])
191
./config.status cdi.settings
192
cat cdi.settings
193

194
195
AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
      [AC_MSG_NOTICE([
196

197
198
  Warning: The C compiler does not accept ANSI C99 source code!
])])
Uwe Schulzweida's avatar
Uwe Schulzweida committed
199
200
201
202
203
204
AC_MSG_NOTICE([

  Configuration completed.

    You can now say 'make' to compile the CDI package and 'make install' to install it afterwards.
])