From 769ea42dbb5cb4f6a4085249e308b0e4482780e3 Mon Sep 17 00:00:00 2001
From: Mayo Roettger <mayo.roettger@uni-duesseldorf.de>
Date: Tue, 22 Sep 2020 10:40:53 +0200
Subject: [PATCH] Change in configure files to guess latest CPLEX_Studio*
 directory instead of first

---
 DESCRIPTION  | 6 +++---
 configure    | 2 +-
 configure.ac | 3 ++-
 inst/NEWS.Rd | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 883f6f2..e5606f2 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -2,7 +2,7 @@ Package: cplexAPI
 Type: Package
 Title: R Interface to C API of IBM ILOG CPLEX
 Version: 1.4.1
-Date: 2020-09-21
+Date: 2020-09-22
 Authors@R: c(person("Mayo", "Roettger", role = "cre", email = "mayo.roettger@hhu.de"),
              person("Gabriel", "Gelius-Dietrich", role = "aut", email = "geliudie@uni-duesseldorf.de"),
              person(c("C.", "Jonathan"), "Fritzemeier", role = c("ctb"), email = "clausjonathan.fritzemeier@uni-duesseldorf.de"))
@@ -14,7 +14,7 @@ License: GPL-3 | file LICENSE
 LazyLoad: yes
 Collate: generics.R cplexConst.R cplexErrorClass.R cplexPtrClass.R
         cplex.R cplexAPI.R cplex_checkAPI.R cplex_longparamAPI.R zzz.R
-Packaged: 2020-09-21 11:49:00 UTC; mayo
+Packaged: 2020-09-22 08:36:00 UTC; mayo
 NeedsCompilation: yes
 Repository: CRAN
-Date/Publication: 2020-09-21 13:49:00
+Date/Publication: 2020-09-22 10:36:00
diff --git a/configure b/configure
index 96c9942..0d9e948 100755
--- a/configure
+++ b/configure
@@ -3198,7 +3198,7 @@ fi
   test -n "$AWK" && break
 done
 
-        CPLEX_DIR=`ls -ld /Applications/CPLEX_Studio* |${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1`
+                CPLEX_DIR=`ls -ldt /Applications/CPLEX_Studio* |${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1`
         if test  -z "$CPLEX_DIR" -o ! -d "$CPLEX_DIR"  ; then
             as_fn_error $? "CPLEX interactive optimizer not found" "$LINENO" 5
         fi
diff --git a/configure.ac b/configure.ac
index 5082b92..a5b3d9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,7 +156,8 @@ if test [ "$ARGS_OK" = "FALSE" -a -z "$CPLEX_DIR" ] ; then
     if test [ "$CPLEX_BIN" = "NONE" ] ; then
         dnl # Try Mac OS default folder guess
         AC_PROG_AWK
-        CPLEX_DIR=`ls -ld /Applications/CPLEX_Studio* |${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1`
+        dnl # Take last modified CPLEX_Studio* directory
+        CPLEX_DIR=`ls -ldt /Applications/CPLEX_Studio* |${AWK} '($1 ~ /^d/) { print $NF }' | head -n 1`
         if test [ -z "$CPLEX_DIR" -o ! -d "$CPLEX_DIR" ] ; then
             AC_MSG_ERROR([CPLEX interactive optimizer not found])
         fi
diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd
index 3d7a3d3..cc03cc4 100644
--- a/inst/NEWS.Rd
+++ b/inst/NEWS.Rd
@@ -4,7 +4,7 @@
 \title{cplexAPI News}
 \encoding{UTF-8}
 % ---------------------------------------------------------------------------- %
-\section{Changes in version 1.4.1 2020-09-21}{
+\section{Changes in version 1.4.1 2020-09-22}{
   \itemize{
     \item Adaptation of configure script to guess CPLEX installation directory on Mac OS, if neither environment variables 
     PKG_CPPFLAGS and PKG_LIBS, nor configure arguments --with-cplex-include and --with-cplex-lib are given, and option 
-- 
GitLab