ifneq ($(INCLUDEDCONFIG),yes)
INCLUDEDCONFIG=yes
export LC_ALL=POSIX
# test,sed,sort,grep etc should produce exactly the intented output.
# Data access don't work anymore if e.g. sort order is changed
# and some idiot made sort (Mandrake 7.2) produce different sort order
# depending on locale. try
#LC_ALL=nl sort
#aA
#AB
export VERSION=@VERSION@
export PROGRAM=bed
SYSTEM=@SYSTEM@
CYGWIN=@CYGWIN@
export CONFFILE=$(PROGRAM)rc
export CONFLASTDIR=$(PROGRAM)-$(VERSION)
export ROOTDIR=
LN_S=@LN_S@
# compile support for the use of plugins. Needs libdl
# if CONFIG_PLUGIN=n then GIVE=.. in plugin/examples/Makefile determines
# which plugins are linked in instead
DL_LIBRARY=@DLLIBS@
CONFIG_PLUGIN=@CONFIG_PLUGIN@
ifneq ($(CYGWIN),yes)
# The user of the program is unix minded
FULLUNIX=y
else
FULLUNIX=n
export EXEEXT=.exe
CONFIG_PLUGIN=n
export BIOSDISK=y
CFLAGS+=-D_WIN32=1 -DUSE_WINFILE -DBIOSDISK
WINDOWS=y
endif
ifeq ($(FULLUNIX),y)
prefix=@prefix@
bindir=@bindir@
datadir=@datadir@
mandir=@mandir@
export MANDIR=$(mandir)/man1
ifneq ($(CYGWIN),yes)
export CONFDIR=$(datadir)/$(CONFLASTDIR)
HAS_X=y
else
# bed under CYGWIN uses windows find file
export CONFDIR=$(datadir)/$(PROGRAM)
endif
export CONFDIRLINK=$(datadir)/$(PROGRAM)
PERSCONFFILE=~/.$(CONFFILE)
GLOBALCONFFILE=$(CONFDIRLINK)/$(CONFFILE)

else
prefix=c:
bindir=c:/windows
datadir=$(prefix)/Program\ Files
mandir=$(CONFDIR)
export MANDIR=$(CONFDIR)
export CONFDIR=$(datadir)/$(PROGRAM)
export CONFDIRLINK=$(datadir)/$(PROGRAM)
PERSCONFFILE=c:/.$(CONFFILE)
GLOBALCONFFILE=$(datadir)/bed/bedrc
CFLAGS+=-DNCURSES_BED=\"$(CONFDIR)/bedn.exe\" -DNCURSES_BEDENV=\"BEDN\" 
endif
CFLAGS+= -DPERSCONFFILE=\"$(PERSCONFFILE)\"
CFLAGS+=  -DGLOBALCONFFILE=\"$(GLOBALCONFFILE)\"
export EXEPROGRAM=bed$(EXEEXT)

exec_prefix=@exec_prefix@
BEDSRCDIR=@BEDSRCDIR@
#HAS_MAKEDEPEND=@HAS_MAKEDEPEND@
export BASEDIR=$(prefix)
export XPROGRAM=x$(PROGRAM)
export BINDIR=$(bindir)

export CONFVAR=BEDRC
#s/AC_SUBST(\(.*\))/\1=@\1@
EXTRALIBS=@EXTRALIBS@
OTHERLIBS=@LIBS@
DYNAMICCURSES=@DYNAMICCURSES@
STATICCURSES=@STATICCURSES@
CURSESLIB=-l@CURSESLIB@
CFLAGS+=-DCURSESTYPE=@CURSESLIB@ -DCURSES=1
OBJECTS=@OBJECTS@
ICONPATH=/usr/share/icons
MENUPATH=/usr/lib/menu
KDEMENU=/usr/share/applnk
GNOMEMENU=/usr/share/gnome/apps
XBEDMENU=Editors
BEDMENU=Utilities
XMENUNAME=bed
MENUNAME=BED
DEFINES_H=$(BEDSRCDIR)/src/defines.h
CFLAGS+=@DEFS@  @EXTRAFLAGS@ -imacros $(DEFINES_H)
CONFIG_XBED=@CONFIG_XBED@
NRXVT=@NRXVT@
RXVT=@RXVT@
CONFIG_PROGMAN=@CONFIG_PROGMAN@
GCC=@GCCS@
CXX=@CXX@
CC=$(GCC)
HAS_X=@HAS_X@
X_CFLAGS=@X_CFLAGS@
X_LIBS=@X_LIBS@
X_EXTRA_LIBS=@X_EXTRA_LIBS@
X_PRE_LIBS=@X_PRE_LIBS@

PDCURSES=@PDCURSES@
HAS_FILE=@HAS_FILE@
USES_ELF=@USES_ELF@
HAS_NROFF=@HAS_NROFF@
# *** spaces and tabs matter!!!! ***
#configuration options:

# link static=y
CONFIG_STATIC=n

# user threads to go on while making a searchlist. Needs libpthread and
# adds instability
CONFIG_THREADS=@CONFIG_THREADS@
THREADSLIB=@THREADSLIB@
ifeq ($(CYGWIN),yes)
CONFIG_THREADS=n
endif




# Uses mmap when searching makes searching (forward, casesensitive,
# non regex) maybe a little bit faster. When true around 0.001%.
# and until 0.2.4 it somehow didn't work on extended files
CONFIG_MMAP=n

# debug -g and making /tmp/bedtrace* and /tmp/beddebug* files. (y=do,m=only -g, n=nodebug, t=only debug files o=only -g -O2)
CONFIG_DEBUG=o

#y: offset in long long instead of long (not always supported)
# needed for large harddrives
CONFIG_LARGEFILES=@CONFIG_LARGEFILES@

# Write the pieces between datatypes and offset numbers
# Objective measures say that doing this makes the screen somehow faster,
# but my subjective impression is that it becomes slower
#y: write over with color TEXT which you should define  ~/.bedrc or $CONFDIR/bedrc
#n: leave them background
#c: give spacebetween new colour SPACEAFTER (little bit slower). When using rxvt
#this leads sometimes to the wrong coloring.
#b: same as c but no line after last datatype ("")
#i: other colour APART between items (much slower)
CONFIG_WRITEBETWEENPARTS=b

# make msdos (edit, turbo-C IDE, Midnight/Norton Commander) lines around some menu's
#y: do
#n: don't do
CONFIG_MENULINES=n

#color support (depends also on color lines in (.)bedrc)
#y: default color, black-white with option -B
#n: not possible
#o: default black-white, color with option -C
CONFIG_COLOR=@CONFIG_COLOR@

ifeq ($(CONFIG_STATIC),y)
CONFIG_PLUGIN=n
endif

#Plugins can also be linked in the main program
#LINKIN: Puts it among other linked in procedures
#LINKINDYN: shows the linked in plugin like a dynamic one. Can not be put in menu's
#Plugins to choice from: bitcontains.plug bitflags.plug duplicate.plug ebcdic2ascii.plug elftables.plug (needs index2table.plug) file.plug filter.plug float.plug gdb.plug nextitem.plug record.plug signed.plug skip.plug index2table.plug time.plug translate.plug  xterm.plug
#defaults:
ifeq ($(CONFIG_PLUGIN),y)
LINKIN+=time.plug signed.plug float.plug bitflags.plug bitcontains.plug  duplicate.plug skip.plug nextitem.plug translate.plug
#LINKINDYN+=
else
LINKIN+= ebcdic2ascii.plug time.plug signed.plug float.plug bitflags.plug bitcontains.plug translate.plug duplicate.plug skip.plug nextitem.plug  helpf1.plug
LINKINDYN+= backward.plug searchclip.plug datatypeinfo.plug cut.plug
ifeq ($(HAS_X),y)
LINKINDYN+=title.plug putselect.plug switchsize.plug rxvt.plug
endif
ifeq ($(FULLUNIX),y)
LINKINDYN+=disass.plug
endif
ifeq ($(HAS_FILE),y)
LINKINDYN+=  file.plug
endif
ifeq ($(USES_ELF),y)
LINKINDYN+=index2table.plug elftables.plug
endif
endif

ifeq ($(CYGWIN),yes)
LINKIN+=clipboard.plug title.plug
endif
LINKIN+=edit.plug # if left out edit src/menu.h

INLINKLIB=inlink.a

CFLAGS+=-DVERSION=\"$(VERSION)\" -DPROGRAM=\"$(PROGRAM)\"  -DCONFDIR=\"$(CONFDIR)\" -DCONFDIRLINK=\"$(CONFDIRLINK)\" -DBINDIR=\"$(BINDIR)\" -DCONFVAR=\"$(CONFVAR)\"  -DCONFFILE=\"$(CONFFILE)\"

endif
