preprocessor


m4 does not obey expansion?


I use m4 for a little text preprocessing here, and it behaves in a way I don't understand.
This is the portion in question:
ifdef(`TEST',
define(`O_EXT', `.obj'),
define(`O_EXT', `.o'))
This macro will always be expanded to .o, regardless whether TEST is defined (m4 -DTEST) or not.
What am I doing wrong?
You're not quoting the other arguments to ifdef. Try this:
ifdef(`TEST', `define(`O_EXT', `.obj')', `define(`O_EXT', `.o')')

Related Links

Name of file during compile time in Progress 4gl
Triple conditional check with ifdef in M4
How to process map data from OpenStreetMap with Java?
complex preprocessor symbol for ede project
GNU-C-preprocessing FORTRAN source to change array indices causes recursion whilst expanding macro
indirectly quoting macro in traditional mode
KMP Preprocessing Function
How to detect Apportable with preprocessor flags?
Adjust data vector to have certain variance
Pre-process Laravel 4 view
File iteration with the preprocessor
processing strings of text for neural network input
How to Set Active Target in XCode 4.5+
Preprocessor assertions in arduino
expanding a macro within a macro definition
GNU-M4: Strip empty lines

Categories

HOME
algorithm
grok
numbers
mstest
knitr
access
seo
xbee
rom
cq5
emscripten
echo
jax-ws
openstreetmap
watson-conversation
java.util.logging
cmdb
php-5.6
nancy
gource
atlassian
selectize.js
capistrano3
event-sourcing
mathprog
connector
froala
android-sharedpreferences
bioinformatics
calculation
autodesk-designautomation
xbox
dst
sql-server-2000
git-squash
twos-complement
getpixel
pdw-file-browser
servicestack-text
zoomify
node-mssql
odroid
azure-arm
visa
softmax
naming
tcc
oim
opencmis
x++
nanoc
tinymce-3
amq
filehandle
check-mk
mouseleave
android-instrumentation
polyline
mapxtreme
webjars
pacemaker
ng-grid
gogs
eigenvector
cfchart
yajsw
libav
contentcontrol
dynamics-nav-2016
assertion
r-package
rate-limiting
cgi-bin
finalbuilder
airbrake
graphics2d
alloy-ui
xmltype
qtwebengine
dbaccess
nodelist
sip-server
webfinger
appserver
human-computer-interface
isqlquery
windows-phone-8-sdk
cmmi
actiondispatch
booksleeve
intersect
extreme-programming
midlet
pstack
sentestingkit
pyunit
objectquery
appjs
koken
infobright
matlab-load
automationelement
entitydatasource
tournament
timthumb
web-application-project
sun
complex-event-processing
alsb
sifr3
scrubyt
online-storage
wcf-proxy
leader
idatareader

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App