]> err.no Git - sope/blobdiff - configure
fixed gcc 4.0 warnings
[sope] / configure
index da814e3021890894deaf0a0762afeee5a5fc575f..6784de0fe43e29d8c98952ae95504f54a2beaa9d 100755 (executable)
--- a/configure
+++ b/configure
@@ -17,11 +17,15 @@ ARG_PREFIX=""
 ARG_GSMAKE="$GNUSTEP_MAKEFILES"
 ARG_CFGMAKE="$PWD/config.make"
 ARG_WITH_GNUSTEP=0
-ARG_WITH_DEBUG=0
+ARG_WITH_DEBUG=1
+ARG_WITH_STRIP=1
 
 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
 DARG_IS_FHS=1
 
+NGSTREAMS_DIR="./sope-core/NGStreams"
+LINK_SYSLIBDIRS="-L/usr/local/pgsql/lib -L/usr/local/lib -L/usr/lib"
+
 # ******************** usage ********************
 
 function usage() {
@@ -45,6 +49,7 @@ Installation directories:
   --configmake=PATH       path to the config file being created
   --with-gnustep          install in GNUstep tree
   --enable-debug          turn on debugging and compile time warnings
+  --enable-strip          turn on stripping of debug symbols
 
 _ACEOF
 
@@ -68,6 +73,11 @@ function printParas() {
   else
     echo "  debug:  no";
   fi
+  if test $ARG_WITH_STRIP = 1; then 
+    echo "  strip:  yes";
+  else
+    echo "  strip:  no";
+  fi
   
   echo "  prefix: $ARG_PREFIX"
   echo "  gstep:  $ARG_GSMAKE"
@@ -123,6 +133,18 @@ function validateGNUstepArgs() {
   fi
 }
 
+function setupAppleArgs() {
+  ARG_WITH_STRIP=0
+  ARG_WITH_GNUSTEP=1
+  
+  if test "xLIBRARY_COMBO" != "apple-apple-nil"; then
+    if test "xLIBRARY_COMBO" != "apple-apple-apple"; then
+      echo "WARNING: detected unusual GNUstep setup: $LIBRARY_COMBO"
+      echo ""
+    fi
+  fi
+}
+
 function validateArgs() {
   # validate prefix (could be better?)
   case "x$ARG_PREFIX" in
@@ -208,10 +230,10 @@ function genConfigMake() {
   cfgwrite "#         make debug=yes"
   cfgwrite ""
   
-  cfgwrite "# print on the cmdline that this file is being used"
-  cfgwrite "all :: "
-  cfgwrite "   @echo Local GNUstep config.make is active"
-  cfgwrite ""
+  #cfgwrite "# print on the cmdline that this file is being used"
+  #cfgwrite "all :: "
+  #cfgwrite "  @echo Local GNUstep config.make is active"
+  #cfgwrite ""
   
   # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
   
@@ -230,6 +252,15 @@ function genConfigMake() {
   fi
   cfgwrite ""
   
+  if test $ARG_WITH_STRIP = 1; then
+    cfgwrite "# configured to produce stripped code";
+    cfgwrite "strip:=yes"
+  else
+    cfgwrite "# configured not to strip code";
+    cfgwrite "strip:=no"
+  fi
+  cfgwrite ""
+
   cfgwrite "# enforce shared libraries";
   cfgwrite "shared:=yes"
   cfgwrite ""
@@ -240,6 +271,53 @@ function genConfigMake() {
     cfgwrite "${MAKE_ASSI}";
   done
   cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
+  cfgwrite ""
+  
+  cfgwrite "# avoid a gstep-make warning"
+  cfgwrite "PATH:=\$(GNUSTEP_SYSTEM_ROOT)/Tools:\$(PATH)"
+}
+
+function checkLinking() {
+  local oldpwd=$PWD
+  local tmpdir=".configure-test-$$"
+  
+  mkdir $tmpdir
+  cd $tmpdir
+  cp ../maintenance/dummytool.m .
+  
+  tmpmake="GNUmakefile"
+  echo  >$tmpmake "include ../config.make"
+  echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
+  echo >>$tmpmake "TOOL_NAME           := linktest"
+  echo >>$tmpmake "linktest_OBJC_FILES := dummytool.m"
+  echo >>$tmpmake "linktest_TOOL_LIBS  += -l$1"
+  echo >>$tmpmake "SYSTEM_LIB_DIR      += ${LINK_SYSLIBDIRS}"
+  echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/tool.make"
+  
+  make -s messages=yes -f $tmpmake linktest >out.log 2>err.log
+  LINK_RESULT=$?
+
+  if test $LINK_RESULT = 0; then
+    echo "$2 library found: $1"
+  else
+    if test "x$2" = "xrequired"; then
+      echo "failed to link $2 library: $1"
+      rm ../config.make
+      exit 1
+    else
+      echo "failed to link $2 library: $1"
+    fi
+  fi
+  
+  cd $oldpwd
+  rm -rf $tmpdir
+}
+
+function checkDependencies() {
+  checkLinking "xml2" required;
+  checkLinking "ldap" required;
+  checkLinking "ssl"  required; # TODO: make optional
+  checkLinking "pq"   required; # TODO: make optional
 }
 
 function runIt() {
@@ -253,6 +331,18 @@ function runIt() {
     fi
   else
     genConfigMake;
+    checkDependencies;
+    
+    if test -x $NGSTREAMS_DIR/configure; then
+      if test $ARG_BEQUIET != 1; then
+        echo -n "configuring NGStreams library .."
+        old="$PWD"
+        cd $NGSTREAMS_DIR
+        ./configure >$old/config-NGStreams.log
+        cd $old
+        echo ".. done (log in config-NGStreams.log)."
+      fi
+    fi
   fi
 }
 
@@ -288,6 +378,15 @@ function processOption() {
     "x--enable-debug")
         ARG_WITH_DEBUG=1
        ;;
+    "x--disable-debug")
+        ARG_WITH_DEBUG=0
+       ;;
+    "x--enable-strip")
+        ARG_WITH_STRIP=1
+       ;;
+    "x--disable-strip")
+        ARG_WITH_STRIP=0
+       ;;
 
     *) echo "error: cannot process argument: $1"; exit 1; ;;
   esac
@@ -305,6 +404,11 @@ if test $ARG_BEQUIET != 1; then
   printGNUstepSetup;
 fi
 
+# setup some GNUstep dependend defaults
+if test "x$GNUSTEP_HOST_VENDOR" = "xapple"; then
+  setupAppleArgs;
+fi
+
 # ensure the parameters make sense
 validateArgs