add more build controls
[goodguy/history.git] / cinelerra-5.1 / configure
index 5c31eb4483341ed8435259cda047c38fcc403fdc..02e4c514e73cdbe9de39efbc7f2c993a425becce 100755 (executable)
@@ -1,21 +1,42 @@
-#!/bin/sh
+#!/bin/bash
+# configure reset  - resets probed config
+# configure static - build all builtin static libraries
+# configure shared - build only static libraries needed
+
+#edit global_config and set HAVE_var to override probe
+
+PROBED="STATIC_LIBRARIES HAVE_VIDEO4LINUX2 HAVE_DVB HAVE_GL"
+PROBED="$PROBED HAVE_DL HAVE_NUMA"
 
 if [ $# -gt 0 ]; then
+  if [ "$1" = "reset" ]; then
+     for v in $PROBED; do
+       sed -e "s/^$v := .*/#$v := y/" -i global_config
+     done
+     echo "configuration reset"
+     exit 0;
+  fi
   if [ "$1" = "static" ]; then
-    STATIC_LIBRARIES=1
+    STATIC_LIBRARIES=y
   elif [ "$1" = "shared" ]; then
-    STATIC_LIBRARIES=0
+    STATIC_LIBRARIES=n
   else
     echo usage: "./configure <shared | static>"
     exit 1
   fi
 fi
 
-ERROR=0
 if [ -z "$STATIC_LIBRARIES" ]; then
-STATIC_LIBRARIES=0
+STATIC_LIBRARIES=y
 fi
 
+for v in $PROBED; do
+  vv=`grep "^$v := .*"  global_config`
+  if [ $? = 0 ]; then
+    echo "config probe override: $vv"
+  fi
+done
+
 # test for nasm
 OBJDIR=`uname -m`
 TOPDIR=`pwd`
@@ -115,18 +136,61 @@ if [ -x a.out ]; then HAVE_GL=y; else HAVE_GL=n; fi
 rm -f a.out conftest.c
 
 
-# probe for libraries
-if [ $STATIC_LIBRARIES = 0 ]; then
-  sed -e "s/^STATIC_LIBRARIES := .*/STATIC_LIBRARIES := n/" -i global_config
-  cd thirdparty && ./configure shared && cd ..
-else
-  sed -e "s/^STATIC_LIBRARIES := .*/STATIC_LIBRARIES := y/" -i global_config
-  cd thirdparty && ./configure static && cd ..
-fi
+# test for libdl
+
+rm -f a.out
+cat > conftest.c << EOF
+int main()
+{
+  return 0;
+}
+EOF
+
+gcc conftest.c -ldl > /dev/null 2>&1
+
+if [ -x a.out ]; then HAVE_DL=y; else HAVE_DL=n; fi
+
+rm -f a.out conftest.c
+
+
+# test for libnuma
+
+rm -f a.out
+cat > conftest.c << EOF
+int main()
+{
+  return 0;
+}
+EOF
+
+gcc conftest.c -lnuma > /dev/null 2>&1
+
+if [ -x a.out ]; then HAVE_NUMA=y; else HAVE_NUMA=n; fi
+
+rm -f a.out conftest.c
+
+
+# update global_config with probe data
+
+for v in $PROBED; do
+  sed -e "s/^#$v := .*/$v := ${!v}/" -i global_config
+done
+
+# configure thirdparty build
+
+cd thirdparty
+case "$STATIC_LIBRARIES" in
+ "y") ./configure static ;;
+ "n") ./configure shared ;;
+ *) echo "configuration failed"; exit 1;;
+esac
 if [ $? -ne 0 ]; then
   echo "Error in thirdparty configuration."
   exit 1
 fi
+cd ..
+
+# configure libzmpeg3 build
 
 echo CONFIGURING LIBZMPEG3
 cd libzmpeg3* && ./configure && cd ..
@@ -135,8 +199,8 @@ if [ $? -ne 0 ]; then
   exit 1
 fi
 
-
 # success
+
 echo "Configured successfully."
 echo "Type 'make' to build me."
 echo "If all ok, 'make install'";