-### Check which frontend we want to use. The default is XForms
-###
-AC_DEFUN(LYX_USE_FRONTEND,
-[AC_MSG_CHECKING([what frontend should be used as main GUI])
-AC_ARG_WITH(frontend,
- [ --with-frontend=THIS Use THIS frontend as main GUI:
- Possible values: xforms, qt],
- [lyx_use_frontend="$withval"], [lyx_use_frontend="xforms"])
-AC_MSG_RESULT($lyx_use_frontend)
-AC_SUBST(FRONTEND)
-AC_SUBST(FRONTEND_GUILIB)
-AC_SUBST(FRONTEND_LDFLAGS)
-AC_SUBST(FRONTEND_INCLUDES)
-AC_SUBST(FRONTEND_LIBS)
+## Check what kind of packaging should be used at install time.
+## The default is autodetected.
+AC_DEFUN([LYX_USE_PACKAGING],
+[AC_MSG_CHECKING([what packaging should be used])
+AC_ARG_WITH(packaging,
+ [AS_HELP_STRING([--with-packaging=STR], [set packaging for installation among:
+ posix, windows, macosx, haiku (default is autodetected)])],
+ [lyx_use_packaging="$withval"], [
+ case $host in
+ *-apple-darwin*) lyx_use_packaging=macosx ;;
+ *-pc-mingw*) lyx_use_packaging=windows ;;
+ *-mingw32*) lyx_use_packaging=windows ;;
+ *haiku*) lyx_use_packaging=haiku ;;
+ *) lyx_use_packaging=posix ;;
+ esac])
+AC_MSG_RESULT($lyx_use_packaging)
+lyx_install_posix=false
+lyx_install_macosx=false
+lyx_install_cygwin=false
+lyx_install_windows=false
+case $lyx_use_packaging in
+ macosx) AC_DEFINE(USE_MACOSX_PACKAGING, 1, [Define to 1 if LyX should use a MacOS X application bundle file layout])
+ PACKAGE=LyX${version_suffix}
+ default_prefix="/Applications/${PACKAGE}.app"
+ AC_SUBST(osx_bundle_program_name,"${program_base_name}")
+ bindir='${prefix}/Contents/MacOS'
+ libdir='${prefix}/Contents/Resources'
+ datarootdir='${prefix}/Contents/Resources'
+ pkgdatadir='${datadir}'
+ mandir='${datadir}/man'
+ lyx_install_macosx=true ;;
+ windows) AC_DEFINE(USE_WINDOWS_PACKAGING, 1, [Define to 1 if LyX should use a Windows-style file layout])
+ PACKAGE=LyX${version_suffix}
+ default_prefix="C:/Program Files/${PACKAGE}"
+ bindir='${prefix}/bin'
+ libdir='${prefix}/Resources'
+ datarootdir='${prefix}/Resources'
+ pkgdatadir='${datadir}'
+ mandir='${prefix}/Resources/man'
+ lyx_install_windows=true ;;
+ posix) AC_DEFINE(USE_POSIX_PACKAGING, 1, [Define to 1 if LyX should use a POSIX-style file layout])
+ PACKAGE=lyx${version_suffix}
+ program_suffix=$version_suffix
+ pkgdatadir='${datadir}/${PACKAGE}'
+ default_prefix=$ac_default_prefix
+ case ${host} in
+ *cygwin*) lyx_install_cygwin=true ;;
+ *apple-darwin*) lyx_install_macosx=true ;;
+ esac
+ lyx_install_posix=true ;;
+ haiku) AC_DEFINE(USE_HAIKU_PACKAGING, 1, [Define to 1 if LyX should use a Haiku-style file layout])
+ PACKAGE=lyx${version_suffix}
+ program_suffix=$version_suffix
+ pkgdatadir='${datadir}/${PACKAGE}'
+ default_prefix=$ac_default_prefix
+ lyx_install_posix=true ;;
+ *) AC_MSG_ERROR([unknown packaging type $lyx_use_packaging.]) ;;
+esac
+AM_CONDITIONAL(INSTALL_MACOSX, $lyx_install_macosx)
+AM_CONDITIONAL(INSTALL_WINDOWS, $lyx_install_windows)
+AM_CONDITIONAL(INSTALL_CYGWIN, $lyx_install_cygwin)
+AM_CONDITIONAL(INSTALL_POSIX, $lyx_install_posix)
+AC_SUBST(pkgdatadir)
+AC_SUBST(program_suffix)