1AC_INIT([panoglview], [0.2.2])
2AC_CONFIG_AUX_DIR(config)
3AC_CANONICAL_SYSTEM
4AM_INIT_AUTOMAKE([no-define dist-bzip2 dist-zip])
5AC_PROG_CXX
6
7AC_ARG_ENABLE(plugin,
8              AC_HELP_STRING([--enable-plugin],
9							 [enable the plugin for tuvista (default=no).])
10			  ,, enable_plugin=no)
11
12AM_CONDITIONAL(USE_PLUGIN, test "x$enable_plugin" = 'xyes')
13
14dnl Search for tuvista
15
16if test "x$enable_plugin" = "xyes"; then
17  AC_PATH_PROG(HAVE_TUVISTA, tuvista-config)
18  if test -z "$HAVE_TUVISTA" && test "x$enable_plugin" = "xyes"; then
19	AC_MSG_ERROR([** Coudn't find tuvista-config. You will need it to build the tuvista plugin])
20  else
21	PLUGIN_CXXFLAGS="$PLUGIN_CXXFLAGS `$HAVE_TUVISTA --cxxflags`"
22	PLUGIN_LDFLAGS="$PLUGIN_LDFLAGS `$HAVE_TUVISTA --libs`"
23	dnl Depending on whether installing the file in a system location or not
24	dnl the corresponding plugin-directory is chosen
25  	if test "$INSTALL_FLAG" == 1; then
26	  PLUGIN_DIR="`$HAVE_TUVISTA --plugindir`"
27	  LOCALE_DIR="`$HAVE_TUVISTA --localedir`"
28	else
29	  PLUGIN_DIR="`$HAVE_TUVISTA --noinst-plugindir`"
30	  LOCALE_DIR="`$HAVE_TUVISTA --noinst-localedir`"
31fi
32
33  fi
34else
35  PLUGIN_CXXFLAGS=""
36  PLUGIN_LDFLAGS=""
37  PLUGIN_DIR=""
38  LOCALE_DIR=""
39fi
40
41AC_ARG_WITH([unicode],
42      	    AC_HELP_STRING([--with-unicode=yes/no],
43			[set to 'yes' if you are using unicode wxWidgets library. (default=no)]),
44			[with_unicode=$withval],
45			[with_unicode='yes'])
46
47if test "x$with_unicode" = 'xyes' ; then
48  AM_PATH_WXCONFIG(2.4.2, wxWin=1,,, --unicode=yes)
49else
50  AM_PATH_WXCONFIG(2.4.2, wxWin=1,,, --unicode=no)
51fi
52if test "x$wxWin" != x1; then
53    AC_MSG_ERROR([
54	wxWidgets must be installed on your system
55	but wx-config script couldn't be found.
56
57	Please check that wx-config is in path, the directory
58	where wxWidgets libraries are installed (returned by
59	'wx-config --libs' command) is in LD_LIBRARY_PATH or
60	equivalent variable and wxWidgets version is 2.4.2 or above.
61	])
62else
63  if test "x$with_unicode" = 'xyes' ; then
64	WX_GL_LIBS="`$WX_CONFIG_PATH --gl-libs`"
65  else
66	WX_GL_LIBS="`$WX_CONFIG_PATH --unicode --gl-libs`"
67  fi
68  AC_SUBST(WX_GL_LIBS)
69fi
70
71case "$host" in
72*-*-cygwin* | *-*-mingw*)
73WINBUILD="1"
74;;
75*linux*)
76WINBUILD="0"
77;;
78esac
79
80AM_CONDITIONAL(WIN32_BUILD, test x$WINBUILD = "x1")
81
82AC_SUBST(PLUGIN_LDFLAGS)
83AC_SUBST(PLUGIN_CXXFLAGS)
84AC_SUBST(PLUGIN_DIR)
85
86AM_PROG_LIBTOOL
87
88AC_OUTPUT(Makefile src/Makefile)
89