Switch to side-by-side view

--- a/src/configure
+++ b/src/configure
@@ -602,6 +602,7 @@
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 RCLVERSION
+NOPYTHON
 NOPIC
 LIBQZEITGEIST
 QMAKE_DISABLE_ZEITGEIST
@@ -692,6 +693,7 @@
 with_fam
 enable_xattr
 enable_camelcase
+enable_python_module
 enable_pic
 enable_qtgui
 enable_webkit
@@ -1341,9 +1343,10 @@
                           manual" and "my sql manual" are the same, but not
                           the same as "mysql manual" (in phrases only and you
                           could raise the phrase slack to get a match).
-  --enable-pic            Compile library objects as position independant
-                          code. This is necessary for building the php
-                          extension.
+  --disable-python-module Do not build the Python module.
+  --enable-pic            Do not compile library objects as position
+                          independant code. This is incompatible with the php
+                          or python extensions.
   --disable-qtgui         Disable the QT-based graphical user interface.
   --disable-webkit        Disable use of qt-webkit.
   --disable-x11mon        Disable recollindex support for X11 session
@@ -4343,21 +4346,43 @@
 
 fi
 
-# Build PIC objects for the library. This is necessary when building the
-# php extension, would be useful for the others, and costs little. I wonder
-# if this should be made the default.
-# Not by default as these are little used for now.
+# Disable building the python module. This is built by default, because
+# it's really the easiest way to interface and extend recoll. It forces PIC
+# objects for everything (indexing performance impact: 1%), because it's
+# just not worth building the lib twice
+# You can still have a non-pic recoll with:
+#   configure --disable-python-module; make; make install;make clean
+#   configure; make; cd python/recoll; make install
+#
+# Check whether --enable-python-module was given.
+if test "${enable_python_module+set}" = set; then :
+  enableval=$enable_python_module; pythonEnabled=$enableval
+else
+  pythonEnabled=yes
+fi
+
+if test X$pythonEnabled = Xyes ; then
+  NOPYTHON=""
+else
+  NOPYTHON="#"
+fi
+
+# Build PIC objects for the library ?
 # Check whether --enable-pic was given.
 if test "${enable_pic+set}" = set; then :
   enableval=$enable_pic; picEnabled=$enableval
 else
-  picEnabled=no
-fi
-
-if test X$picEnabled = Xyes ; then
-  NOPIC=""
-else
-  NOPIC="#"
+  picEnabled=forpython
+fi
+
+case $picEnabled in
+forpython) picEnabled=$pythonEnabled; NOPIC=$NOPYTHON;;
+yes) NOPIC="";;
+*) NOPIC="#";;
+esac
+
+if test X$pythonEnabled = Xyes -a X$picEnabled != Xyes; then
+   as_fn_error $? "Python build needs PIC library" "$LINENO" 5
 fi
 
 for ac_func in mkdtemp
@@ -5646,6 +5671,7 @@
 
 
 
+
 # All object files depend on localdefs which has the cc flags. Avoid
 # changing it unless necessary
 ac_config_files="$ac_config_files mk/localdefs.new:mk/localdefs.in"
@@ -5657,6 +5683,8 @@
 ac_config_files="$ac_config_files sampleconf/recoll.conf"
 
 ac_config_files="$ac_config_files common/rclversion.h"
+
+ac_config_files="$ac_config_files python/recoll/setup.py"
 
 
 for d in bincimapmime index lib query
@@ -6375,6 +6403,7 @@
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "sampleconf/recoll.conf") CONFIG_FILES="$CONFIG_FILES sampleconf/recoll.conf" ;;
     "common/rclversion.h") CONFIG_FILES="$CONFIG_FILES common/rclversion.h" ;;
+    "python/recoll/setup.py") CONFIG_FILES="$CONFIG_FILES python/recoll/setup.py" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac