Commit 84aa2221c29c05c9d7e33a9abdc4a980686a5680

Authored by knodlseder
1 parent 90734cce

separate Python and Python.h check

Showing 1 changed file with 60 additions and 24 deletions
configure.ac
... ... @@ -116,7 +116,7 @@ fi
116 116  
117 117 dnl =========================================================================
118 118 dnl Checks if Python bindings are to be build. Python binding requires Python
119   -dnl and either the files gammalib_wrap.cpp and gammalib.py or swig to create
  119 +dnl and either the files ctatools_wrap.cpp and ctatools.py or swig to create
120 120 dnl these files. The following conditionals are set:
121 121 dnl WITH_PYTHON - Python bindings will be built
122 122 dnl HAVE_SWIG - swig is available
... ... @@ -125,6 +125,7 @@ dnl =========================================================================
125 125 # Initialise flags
126 126 enable_python="no"
127 127 has_python="no"
  128 +has_python_h="no"
128 129 has_swig="no"
129 130 has_wrappers="no"
130 131  
... ... @@ -135,7 +136,7 @@ AC_ARG_ENABLE([python-binding],
135 136 [ac_enable_python_binding="$enableval"],
136 137 [ac_enable_python_binding="yes"])
137 138 if test "x$ac_enable_python_binding" = "xno"; then
138   - AC_MSG_NOTICE([Python binding for gammalib will not be built])
  139 + AC_MSG_NOTICE([Python binding for ctatools will not be built])
139 140 AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding])
140 141 fi
141 142  
... ... @@ -151,15 +152,15 @@ if test "x$has_python" = "xyes"; then
151 152 PY_INCLUDE="$PY_INCLUDE$PYTHON_VERSION"
152 153  
153 154 # Check if we have Python.h
154   - AC_CHECK_HEADERS($PY_INCLUDE/Python.h, [has_python="yes"], [has_python="no"])
  155 + AC_CHECK_HEADERS($PY_INCLUDE/Python.h, [has_python_h="yes"], [has_python_h="no"])
155 156  
156 157 # Mac OS X kluge: if test before was unsuccessful then check for headers in /usr/include
157   - if test "x$has_python" = "xno"; then
158   - AC_CHECK_HEADERS("/usr/include/python$PYTHON_VERSION/Python.h", [has_python="yes"], [has_python="no"])
  158 + if test "x$has_python_h" = "xno"; then
  159 + AC_CHECK_HEADERS("/usr/include/python$PYTHON_VERSION/Python.h", [has_python_h="yes"], [has_python_h="no"])
159 160 fi
160 161  
161 162 # Signal any problem
162   - if test "x$has_python" = "xno"; then
  163 + if test "x$has_python_h" = "xno"; then
163 164 AC_MSG_WARN([No Python header file "$PY_INCLUDE/Python.h" found. Please install appropriate Python development package.])
164 165 fi
165 166 fi
... ... @@ -171,16 +172,16 @@ if test "$SWIG"; then
171 172 fi
172 173 AM_CONDITIONAL(HAVE_SWIG, test "x$has_swig" = "xyes")
173 174  
174   -# Do we have wrappers (gammalib_wrap.cpp and gammalib.py)?
175   -AC_CHECK_FILES([pyext/gammalib_wrap.cpp pyext/gammalib.py],,)
176   -if test "x$ac_cv_file_pyext_gammalib_wrap_cpp" = "xyes"; then
177   - if test "x$ac_cv_file_pyext_gammalib_py" = "xyes"; then
  175 +# Do we have wrappers (ctatools_wrap.cpp and ctatools.py)?
  176 +AC_CHECK_FILES([pyext/ctatools_wrap.cpp pyext/ctatools.py],,)
  177 +if test "x$ac_cv_file_pyext_ctatools_wrap_cpp" = "xyes"; then
  178 + if test "x$ac_cv_file_pyext_ctatools_py" = "xyes"; then
178 179 has_wrappers="yes"
179 180 fi
180 181 fi
181 182  
182 183 # Signal if Python is enabled
183   -if test "x$ac_enable_python_binding" = "xyes" -a "x$has_python" = "xyes"; then
  184 +if test "x$ac_enable_python_binding" = "xyes" -a "x$has_python" = "xyes" -a "x$has_python_h" = "xyes"; then
184 185 if test "x$has_swig" = "xyes" -o "x$has_wrappers" = "xyes"; then
185 186 enable_python="yes"
186 187 fi
... ... @@ -320,32 +321,67 @@ if test "x$has_gammalib" = "xyes"; then
320 321 else
321 322 echo " - GammaLib support (no) no gammalib library found"
322 323 fi
323   -if test ! "$SWIG"; then
324   - echo " - swig (no)"
  324 +if test "x$has_python" = "xyes"; then
  325 + echo " * Python (yes)"
325 326 else
  327 + echo " - Python (no)"
  328 +fi
  329 +if test "x$has_python_h" = "xyes"; then
  330 + echo " * Python.h (yes)"
  331 +else
  332 + echo " - Python.h (no)"
  333 +fi
  334 +if test "x$has_swig" = "xyes"; then
326 335 echo " * swig (yes)"
  336 +else
  337 + echo " - swig (no)"
327 338 fi
  339 +if test "x$has_wrappers" = "xyes"; then
  340 + echo " * Python wrappers (yes)"
  341 +else
  342 + echo " - Python wrappers (no)"
  343 +fi
  344 +
  345 +# Dump Python binding information
328 346 if test "x$ac_enable_python_binding" = "xyes"; then
329 347 if test "x$has_python" = "xyes"; then
330   - if test "x$has_python_wrap" = "xyes"; then
331   - if test ! "$SWIG"; then
332   - echo " * Python binding (yes)"
  348 + if test "x$has_python_h" = "xyes"; then
  349 + if test "x$has_wrappers" = "xyes"; then
  350 + if test "x$has_swig" = "xyes"; then
  351 + echo " * Make Python binding (yes) use swig for updates"
  352 + else
  353 + echo " * Make Python binding (yes) use wrappers"
  354 + fi
333 355 else
334   - echo " * Python binding (yes) use swig for updates"
  356 + if test "x$has_swig" = "xyes"; then
  357 + echo " * Make Python binding (yes) use swig for building"
  358 + else
  359 + echo " - Make Python binding (no) swig required to build wrappers"
  360 + fi
335 361 fi
336 362 else
337   - if test ! "$SWIG"; then
338   - echo " - Python binding (no) swig not installed"
339   - else
340   - echo " * Python binding (yes) use swig for building"
341   - fi
  363 + echo " - Make Python binding (no) Python.h not installed"
342 364 fi
343 365 else
344   - echo " - Python binding (no) python not installed"
  366 + echo " - Make Python binding (no) Python not installed"
345 367 fi
346 368 else
347   - echo " - Python binding (no)"
  369 + echo " - Make Python binding (no)"
  370 +fi
  371 +
  372 +# Dump compile options
  373 +if test "x$enable_debug" = "xyes"; then
  374 + echo " * Compile in debug code (yes)"
  375 +else
  376 + echo " - Compile in debug code (no) (default)"
348 377 fi
  378 +if test "x$enable_profiling" = "xyes"; then
  379 + echo " * Enable code for profiling (yes)"
  380 +else
  381 + echo " - Enable code for profiling (no) (default)"
  382 +fi
  383 +
  384 +# Dump next step information
349 385 echo
350 386 echo "Now type 'make'"
351 387 echo
... ...