OSDN Git Service

Merge branch 'develop' into macos-develop
[hengbandforosx/hengbandosx.git] / configure.ac
index 15c2ecd..6955f81 100644 (file)
@@ -21,7 +21,7 @@ if test "$GAMEGROUP" != ""; then
   MY_EXPAND_DIR(game_libpath, "$datarootdir/games/$PACKAGE/lib/")
 else
   MY_EXPAND_DIR(game_libpath, "./lib/")
-  bindir=".."
+  bindir="`pwd`"
 fi
 
 dnl overwrite the path with an user-specified value
@@ -45,6 +45,8 @@ AC_SUBST(DEFAULT_VAR_PATH)
 dnl Checks for programs.
 AC_LANG(C++)
 AC_PROG_CXX
+dnl Note that the -std= option for Objective-C++ is hardwired in
+dnl src/Makefile.am so that should be changed if this is.
 AX_CXX_COMPILE_STDCXX(20, [ext], [mandatory])
 PKG_PROG_PKG_CONFIG
 
@@ -65,16 +67,35 @@ AC_ARG_ENABLE([pch],
 [  --disable-pch           disable use of precompiled headers],
 enable_pch=no, enable_pch=yes)
 AM_CONDITIONAL([PCH], [test x$enable_pch = xyes])
+AC_ARG_ENABLE([cocoa],
+[  --enable-cocoa          enable a Cocoa user interface (OS X only)],
+[AC_DEFINE([MACH_O_COCOA], [1], [Use a Cocoa interface (OS X only)])], [])
+AM_CONDITIONAL([COCOA], [test x$enable_cocoa = xyes])
+dnl Since AC_PROG_OBJCXX has the side effect of setting this conditional,
+dnl guarantee that is is always set, regardless of what happens in the if
+dnl statement.
+AM_CONDITIONAL([am__fastdepOBJCXX], false)
+if test x"$enable_cocoa" = xyes ; then
+  dnl Use AC_LANG_PUSH and AC_LANG_POP to try to get back to the state that
+  dnl AC_LANG_C set in case there are side effects.
+  AC_LANG_PUSH([Objective C++])
+  AC_PROG_OBJCXX
+  AC_LANG_POP([Objective C++])
+  AC_DEFINE(SAFE_DIRECTORY, 1, [Mark var directory with version string])
+  AC_DEFINE(VERSION_STRING, "3.0.0", [Version string to use for var directory])
+fi
 
 dnl Checks for libraries.
 dnl Replace `main' with a function in -lncurses:
-AC_CHECK_LIB(ncursesw, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncursesw"])
-if test "$ac_cv_lib_ncursesw_initscr" != yes; then
-  AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncurses"])
-  if test "$ac_cv_lib_ncurses_initscr" != yes; then
-    AC_CHECK_LIB(curses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) LIBS="$LIBS -lcurses"])
-    if test "$ac_cv_lib_curses_initscr" != yes; then
-      AC_CHECK_LIB(termcap, tgetent, [AC_DEFINE(USE_CAP, 1, [Allow -mCAP environment]) LIBS="$LIBS -ltermcap"])
+if test x"$enable_cocoa" != xyes ; then
+  AC_CHECK_LIB(ncursesw, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncursesw"])
+  if test "$ac_cv_lib_ncursesw_initscr" != yes; then
+    AC_CHECK_LIB(ncurses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) AC_DEFINE(USE_NCURSES, 1, [Use ncurses]) LIBS="$LIBS -lncurses"])
+    if test "$ac_cv_lib_ncurses_initscr" != yes; then
+      AC_CHECK_LIB(curses, initscr, [AC_DEFINE(USE_GCU, 1, [Allow -mGCU environment]) LIBS="$LIBS -lcurses"])
+      if test "$ac_cv_lib_curses_initscr" != yes; then
+        AC_CHECK_LIB(termcap, tgetent, [AC_DEFINE(USE_CAP, 1, [Allow -mCAP environment]) LIBS="$LIBS -ltermcap"])
+      fi
     fi
   fi
 fi
@@ -85,7 +106,7 @@ if test "$use_net" = no; then
   AC_DEFINE(DISABLE_NET, 1, [Disable networking support])
   worldscore=no;
 else
-  PKG_CHECK_MODULES(libcurl, [libcurl])
+  PKG_CHECK_MODULES(libcurl, [libcurl], , [AC_CHECK_LIB([curl], [curl_global_init], [libcurl_LIBS=-lcurl], [AC_MSG_ERROR([Could not find libcurl for networking support])])])
 fi
 
 dnl The world score server is currently only available in Japanese.
@@ -97,8 +118,12 @@ if test "$worldscore" != no; then
 fi
 
 dnl Checks for header files.
+dnl AC_PATH_XTRA has side effects on CPP which are beneficial on Mac OS X.
+dnl Removing it or conditionally executing it will likely lead to warnings
+dnl on that platform about the preprocessor disagreeing with the compiler on
+dnl the tests in AC_CHECK_HEADERS.
 AC_PATH_XTRA
-if test "$have_x" = yes; then
+AS_IF([test "$have_x" = yes && test x"$enable_cocoa" != xyes], [
   LIBS="$LIBS -lX11"
   AC_DEFINE(USE_X11, 1, [Allow -mX11 environment])
   CXXFLAGS="$X_CFLAGS $CXXFLAGS"
@@ -129,7 +154,7 @@ if test "$have_x" = yes; then
     PKG_CHECK_MODULES(XFT, [xft],
       [AC_DEFINE([USE_XFT], [1], [Use XFT])])
   ])
-fi
+])
 
 if test "$use_japanese" != no; then
   AC_CHECK_PROG(NKF, nkf, yes)