Re #1324: Add checking of iOS SDK frameworks in the configure script



git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3701 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/aconfigure b/aconfigure
index fcec330..f45b14a 100755
--- a/aconfigure
+++ b/aconfigure
@@ -696,6 +696,7 @@
 ac_pa_use_alsa
 ac_pa_use_oss
 ac_pjmedia_video
+ac_pjmedia_video_has_ios
 ac_ios_cflags
 ac_pjmedia_video_has_qt
 ac_qt_cflags
@@ -11681,10 +11682,62 @@
   arm-apple-darwin*)
 	ac_pjmedia_video=iphone_os
 
-	ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
-	LIBS="$LIBS -framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
-	{ echo "$as_me:$LINENO: result: Checking video device backend... AVFoundation" >&5
-echo "${ECHO_T}Checking video device backend... AVFoundation" >&6; }
+
+	SAVED_LIBS="$LIBS"
+	LIBS="-framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
+	cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_pjmedia_video_has_ios=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_pjmedia_video_has_ios=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+	LIBS="$SAVED_LIBS"
+	if test "$ac_pjmedia_video_has_ios" = "yes"; then
+	  ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
+	  LIBS="$LIBS -framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
+	  { echo "$as_me:$LINENO: result: Checking if AVFoundation framework is available... yes" >&5
+echo "${ECHO_T}Checking if AVFoundation framework is available... yes" >&6; }
+	else
+	  { echo "$as_me:$LINENO: result: Checking if AVFoundation framework is available... no" >&5
+echo "${ECHO_T}Checking if AVFoundation framework is available... no" >&6; }
+	fi
 	;;
   *darwin*)
 	ac_pjmedia_video=mac_os
@@ -14086,6 +14139,7 @@
 ac_pa_use_alsa!$ac_pa_use_alsa$ac_delim
 ac_pa_use_oss!$ac_pa_use_oss$ac_delim
 ac_pjmedia_video!$ac_pjmedia_video$ac_delim
+ac_pjmedia_video_has_ios!$ac_pjmedia_video_has_ios$ac_delim
 ac_ios_cflags!$ac_ios_cflags$ac_delim
 ac_pjmedia_video_has_qt!$ac_pjmedia_video_has_qt$ac_delim
 ac_qt_cflags!$ac_qt_cflags$ac_delim
@@ -14098,7 +14152,6 @@
 ac_no_g722_codec!$ac_no_g722_codec$ac_delim
 ac_no_g7221_codec!$ac_no_g7221_codec$ac_delim
 ac_no_speex_codec!$ac_no_speex_codec$ac_delim
-ac_no_ilbc_codec!$ac_no_ilbc_codec$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -14140,6 +14193,7 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+ac_no_ilbc_codec!$ac_no_ilbc_codec$ac_delim
 ac_sdl_cflags!$ac_sdl_cflags$ac_delim
 ac_sdl_ldflags!$ac_sdl_ldflags$ac_delim
 ac_has_ffmpeg!$ac_has_ffmpeg$ac_delim
@@ -14159,7 +14213,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 17; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 18; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/aconfigure.ac b/aconfigure.ac
index 4159f20..d055e82 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -599,10 +599,19 @@
  case $target in
   arm-apple-darwin*)
 	ac_pjmedia_video=iphone_os
+	AC_SUBST(ac_pjmedia_video_has_ios)
 	AC_SUBST(ac_ios_cflags)
-	ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
-	LIBS="$LIBS -framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
-	AC_MSG_RESULT([Checking video device backend... AVFoundation])
+	SAVED_LIBS="$LIBS"
+	LIBS="-framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
+	AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_ios=yes],[ac_pjmedia_video_has_ios=no])
+	LIBS="$SAVED_LIBS"
+	if test "$ac_pjmedia_video_has_ios" = "yes"; then
+	  ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
+	  LIBS="$LIBS -framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
+	  AC_MSG_RESULT([Checking if AVFoundation framework is available... yes])
+	else
+	  AC_MSG_RESULT([Checking if AVFoundation framework is available... no])
+	fi
 	;;
   *darwin*)
 	ac_pjmedia_video=mac_os